-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairlock_exechistories.kql
75 lines (75 loc) · 2.41 KB
/
airlock_exechistories.kql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Syslog
| where Computer == "airlock_server"
|extend DeviceVendor = tostring(split(SyslogMessage,"|")[1])
, DeviceProduct = tostring(split(SyslogMessage,"|")[2])
, DeviceVersion = tostring(split(SyslogMessage,"|")[3])
, DeviceEventClassID = tostring(split(SyslogMessage,"|")[4])
, DeviceEventName = tostring(split(SyslogMessage,"|")[5])
, DeviceSeverity = tostring(split(SyslogMessage,"|")[6])
, CefEvent = tostring(split(SyslogMessage,"|")[7])
| where DeviceEventName == "FileActivityMessage"
// KQL is stupid and I had to rename the datetime field because parse-kv didn't like
// having a data type name as a field name. So I have renamed it with the below statement
| extend CefEvent = replace_string(CefEvent, "datetime", "eventstarttime")
| parse-kv CefEvent as (event:string
, eventstarttime:datetime
, hostname:string
, username:string
, path:string
, filename:string
, md5:string
, sha1:string
, publisher:string
, parentgroup:string
, group:string
, execution_type:string
, parentprocess:string
, commandline:string
) with (pair_delimiter=' ', kv_delimiter='=', greedy=true)
| extend EventSchema = "ProcessEvent"
, EventSchemaVersion = "0.1.4"
, EventType = case(execution_type == "Untrusted Execution [Audit]", "ProcessCreated"
, execution_type == "Untrusted Execution [OTP]", "ProcessCreated"
, "Other"
)
| project-rename DvcHostname = hostname
, EventProduct = DeviceProduct
, EventVendor = DeviceVendor
, DvcVersion = DeviceVersion
, TargetUserName = username
, Operation = execution_type
, EventStartTime = eventstarttime
, TargetProcessName = filename
, TargetProcessFolderPath = path
, TargetProcessMD5 = md5
, TargetProcessSHA1 = sha1
, TargetProcessCommandLine = commandline
, TargetProcessPulisher = publisher
, VendorGroup = group
, VendorParentGroup = parentgroup
, ParentProcessName = parentprocess
| extend Dvc = DvcHostname
, User = TargetUserName
, Hash = TargetProcessSHA1
, HashType = "SHA"
| project-away Device*
, CefEvent
, SyslogMessage
, Facility
, HostName
, HostIP
, SeverityLevel
, Process*
, Type
, event
, TenantId
, SourceSystem
, EventTime
, EventProduct
| project-reorder EventStartTime
, DvcHostname
, Operation
, Target*
, ParentProcessName
, VendorGroup
, VendorParentGroup