mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 10:12:53 +01:00
Initial support for Live Queries in Hunt
This commit is contained in:
16
salt/elasticsearch/files/ingest/osquery.live_query
Normal file
16
salt/elasticsearch/files/ingest/osquery.live_query
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"description" : "osquery live query",
|
||||
"processors" : [
|
||||
{
|
||||
"script": {
|
||||
"lang": "painless",
|
||||
"source": "def dict = ['columns': new HashMap()]; for (entry in ctx['rows'].entrySet()) { dict['columns'][entry.getKey()] = entry.getValue(); } ctx['result'] = dict; "
|
||||
}
|
||||
},
|
||||
{ "remove": { "field": [ "rows" ], "ignore_missing": true, "ignore_failure": true } },
|
||||
{ "rename": { "field": "distributed_query_execution_id", "target_field": "result.query_id", "ignore_missing": true } },
|
||||
{ "rename": { "field": "computer_name", "target_field": "host.hostname", "ignore_missing": true } },
|
||||
{ "pipeline": { "name": "osquery.normalize" } },
|
||||
{ "pipeline": { "name": "common" } }
|
||||
]
|
||||
}
|
||||
14
salt/elasticsearch/files/ingest/osquery.normalize
Normal file
14
salt/elasticsearch/files/ingest/osquery.normalize
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"description" : "osquery normalize",
|
||||
"processors" : [
|
||||
{ "rename": { "field": "result.columns.cmdline", "target_field": "process.command_line", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.cwd", "target_field": "process.working_directory", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.name", "target_field": "process.name", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.path", "target_field": "process.executable", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.pid", "target_field": "process.pid", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.parent", "target_field": "process.ppid", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.uid", "target_field": "user.id", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.username", "target_field": "user.name", "ignore_missing": true } },
|
||||
{ "rename": { "field": "result.columns.gid", "target_field": "group.id", "ignore_missing": true } }
|
||||
]
|
||||
}
|
||||
@@ -1,24 +1,19 @@
|
||||
{
|
||||
"description" : "osquery",
|
||||
"processors" : [
|
||||
{ "json": { "field": "message", "target_field": "message2", "ignore_failure": true } },
|
||||
{ "gsub": { "field": "message2.columns.data", "pattern": "\\\\xC2\\\\xAE", "replacement": "", "ignore_missing": true } },
|
||||
{ "rename": { "if": "ctx.message2.columns?.eventid != null", "field": "message2.columns", "target_field": "winlog", "ignore_missing": true } },
|
||||
{ "json": { "field": "message", "target_field": "result", "ignore_failure": true } },
|
||||
{ "gsub": { "field": "result.columns.data", "pattern": "\\\\xC2\\\\xAE", "replacement": "", "ignore_missing": true } },
|
||||
{ "rename": { "if": "ctx.result.columns?.eventid != null", "field": "result.columns", "target_field": "winlog", "ignore_missing": true } },
|
||||
{ "json": { "field": "winlog.data", "target_field": "unparsed", "ignore_failure": true} },
|
||||
{ "set": { "if": "!(ctx.unparsed?.EventData instanceof Map)", "field": "error.eventdata_parsing", "value": true, "ignore_failure": true } },
|
||||
{ "rename": { "if": "!(ctx.error?.eventdata_parsing == true)", "field": "unparsed.EventData", "target_field": "winlog.event_data", "ignore_missing": true, "ignore_failure": true } },
|
||||
{ "rename": { "field": "winlog.source", "target_field": "winlog.channel", "ignore_missing": true } },
|
||||
{ "rename": { "field": "winlog.eventid", "target_field": "winlog.event_id", "ignore_missing": true } },
|
||||
{ "pipeline": { "if": "ctx.winlog?.channel == 'Microsoft-Windows-Sysmon/Operational'", "name": "sysmon" } },
|
||||
{ "pipeline": { "if": "ctx.winlog?.channel != 'Microsoft-Windows-Sysmon/Operational'", "name":"win.eventlogs" } },
|
||||
{
|
||||
"script": {
|
||||
"lang": "painless",
|
||||
"source": "def dict = ['result': new HashMap()]; for (entry in ctx['message2'].entrySet()) { dict['result'][entry.getKey()] = entry.getValue(); } ctx['osquery'] = dict; "
|
||||
}
|
||||
},
|
||||
{ "pipeline": { "if": "ctx.winlog?.channel != 'Microsoft-Windows-Sysmon/Operational' && ctx.containsKey('winlog')", "name":"win.eventlogs" } },
|
||||
{ "set": { "field": "event.module", "value": "osquery", "override": false } },
|
||||
{ "set": { "field": "event.dataset", "value": "{{osquery.result.name}}", "override": false} },
|
||||
{ "set": { "field": "event.dataset", "value": "{{result.name}}", "override": false} },
|
||||
{ "pipeline": { "if": "!(ctx.containsKey('winlog'))", "name": "osquery.normalize" } },
|
||||
{ "pipeline": { "name": "common" } }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -365,6 +365,10 @@
|
||||
"request":{
|
||||
"type":"object",
|
||||
"dynamic": true
|
||||
},
|
||||
"result":{
|
||||
"type":"object",
|
||||
"dynamic": true
|
||||
},
|
||||
"rfb":{
|
||||
"type":"object",
|
||||
|
||||
Reference in New Issue
Block a user