@@ -62,19 +62,23 @@ func TestWrite(t *testing.T) {
62
62
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
63
63
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
64
64
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
65
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
65
66
},
66
67
},
67
68
& pstypes.PS {
68
- PID : uint32 (os .Getpid ()),
69
- Ppid : uint32 (os .Getppid ()),
70
- Name : "spotify.exe" ,
71
- Cmdline : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --type=crashpad-handler /prefetch:7 --max-uploads=5 --max-db-size=20 --max-db-age=5 --monitor-self-annotation=ptype=crashpad-handler "--metrics-dir=C:\Users\admin\AppData\Local\Spotify\User Data" --url=https://crashdump.spotify.com:443/ --annotation=platform=win32 --annotation=product=spotify --annotation=version=1.1.4.197 --initial-client-data=0x5a4,0x5a0,0x5a8,0x59c,0x5ac,0x6edcbf60,0x6edcbf70,0x6edcbf7c` ,
72
- Exe : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --parent` ,
73
- Cwd : "C:\\ fibratus\\ pkg\\ ps" ,
74
- SessionID : 1 ,
75
- SID : "S-1-5-18" ,
76
- Username : "SYSTEM" ,
77
- Domain : "NT AUTHORITY" ,
69
+ PID : uint32 (os .Getpid ()),
70
+ Ppid : uint32 (os .Getppid ()),
71
+ Name : "spotify.exe" ,
72
+ Cmdline : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --type=crashpad-handler /prefetch:7 --max-uploads=5 --max-db-size=20 --max-db-age=5 --monitor-self-annotation=ptype=crashpad-handler "--metrics-dir=C:\Users\admin\AppData\Local\Spotify\User Data" --url=https://crashdump.spotify.com:443/ --annotation=platform=win32 --annotation=product=spotify --annotation=version=1.1.4.197 --initial-client-data=0x5a4,0x5a0,0x5a8,0x59c,0x5ac,0x6edcbf60,0x6edcbf70,0x6edcbf7c` ,
73
+ Exe : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --parent` ,
74
+ Cwd : "C:\\ fibratus\\ pkg\\ ps" ,
75
+ SessionID : 1 ,
76
+ SID : "S-1-5-18" ,
77
+ Username : "SYSTEM" ,
78
+ Domain : "NT AUTHORITY" ,
79
+ IsWOW64 : true ,
80
+ IsPackaged : true ,
81
+ IsProtected : false ,
78
82
},
79
83
},
80
84
{"write state from spawned process with parent" ,
@@ -89,6 +93,7 @@ func TestWrite(t *testing.T) {
89
93
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
90
94
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
91
95
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
96
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
92
97
},
93
98
PID : uint32 (os .Getpid ()),
94
99
},
@@ -102,10 +107,13 @@ func TestWrite(t *testing.T) {
102
107
Parent : & pstypes.PS {
103
108
PID : uint32 (os .Getpid ()),
104
109
},
105
- SessionID : 1 ,
106
- SID : "S-1-5-18" ,
107
- Username : "SYSTEM" ,
108
- Domain : "NT AUTHORITY" ,
110
+ SessionID : 1 ,
111
+ SID : "S-1-5-18" ,
112
+ Username : "SYSTEM" ,
113
+ Domain : "NT AUTHORITY" ,
114
+ IsWOW64 : true ,
115
+ IsPackaged : true ,
116
+ IsProtected : false ,
109
117
},
110
118
},
111
119
{"write state from rundown event" ,
@@ -120,19 +128,23 @@ func TestWrite(t *testing.T) {
120
128
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
121
129
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
122
130
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
131
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
123
132
},
124
133
},
125
134
& pstypes.PS {
126
- PID : uint32 (os .Getpid ()),
127
- Ppid : 8390 ,
128
- Name : "spotify.exe" ,
129
- Cmdline : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --type=crashpad-handler /prefetch:7 --max-uploads=5 --max-db-size=20 --max-db-age=5 --monitor-self-annotation=ptype=crashpad-handler "--metrics-dir=C:\Users\admin\AppData\Local\Spotify\User Data" --url=https://crashdump.spotify.com:443/ --annotation=platform=win32 --annotation=product=spotify --annotation=version=1.1.4.197 --initial-client-data=0x5a4,0x5a0,0x5a8,0x59c,0x5ac,0x6edcbf60,0x6edcbf70,0x6edcbf7c` ,
130
- Exe : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --parent` ,
131
- Cwd : "C:\\ fibratus\\ pkg\\ ps" ,
132
- SessionID : 1 ,
133
- SID : "S-1-5-18" ,
134
- Username : "SYSTEM" ,
135
- Domain : "NT AUTHORITY" ,
135
+ PID : uint32 (os .Getpid ()),
136
+ Ppid : 8390 ,
137
+ Name : "spotify.exe" ,
138
+ Cmdline : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --type=crashpad-handler /prefetch:7 --max-uploads=5 --max-db-size=20 --max-db-age=5 --monitor-self-annotation=ptype=crashpad-handler "--metrics-dir=C:\Users\admin\AppData\Local\Spotify\User Data" --url=https://crashdump.spotify.com:443/ --annotation=platform=win32 --annotation=product=spotify --annotation=version=1.1.4.197 --initial-client-data=0x5a4,0x5a0,0x5a8,0x59c,0x5ac,0x6edcbf60,0x6edcbf70,0x6edcbf7c` ,
139
+ Exe : `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --parent` ,
140
+ Cwd : "C:\\ fibratus\\ pkg\\ ps" ,
141
+ SessionID : 1 ,
142
+ SID : "S-1-5-18" ,
143
+ Username : "SYSTEM" ,
144
+ Domain : "NT AUTHORITY" ,
145
+ IsWOW64 : true ,
146
+ IsPackaged : true ,
147
+ IsProtected : false ,
136
148
},
137
149
},
138
150
}
@@ -197,6 +209,7 @@ func TestRemove(t *testing.T) {
197
209
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
198
210
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
199
211
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
212
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
200
213
},
201
214
},
202
215
false ,
@@ -236,6 +249,7 @@ func TestAddThread(t *testing.T) {
236
249
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
237
250
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
238
251
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
252
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
239
253
},
240
254
}
241
255
require .NoError (t , psnap .Write (evt ))
@@ -316,6 +330,7 @@ func TestRemoveThread(t *testing.T) {
316
330
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
317
331
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
318
332
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
333
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
319
334
},
320
335
}
321
336
require .NoError (t , psnap .Write (pevt ))
@@ -363,6 +378,7 @@ func TestAddModule(t *testing.T) {
363
378
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
364
379
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
365
380
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
381
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
366
382
},
367
383
}
368
384
require .NoError (t , psnap .Write (evt ))
@@ -427,6 +443,7 @@ func TestRemoveModule(t *testing.T) {
427
443
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
428
444
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
429
445
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
446
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
430
447
},
431
448
}
432
449
require .NoError (t , psnap .Write (pevt ))
@@ -476,6 +493,7 @@ func TestReapDeadProcesses(t *testing.T) {
476
493
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
477
494
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
478
495
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
496
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
479
497
},
480
498
},
481
499
{
@@ -489,6 +507,7 @@ func TestReapDeadProcesses(t *testing.T) {
489
507
kparams .UserSID : {Name : kparams .UserSID , Type : kparams .WbemSID , Value : []byte {224 , 8 , 226 , 31 , 15 , 167 , 255 , 255 , 0 , 0 , 0 , 0 , 15 , 167 , 255 , 255 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 5 , 18 , 0 , 0 , 0 }},
490
508
kparams .StartTime : {Name : kparams .StartTime , Type : kparams .Time , Value : time .Now ()},
491
509
kparams .SessionID : {Name : kparams .SessionID , Type : kparams .Uint32 , Value : uint32 (1 )},
510
+ kparams .ProcessFlags : {Name : kparams .ProcessFlags , Type : kparams .Flags , Value : uint32 (0x00000010 )},
492
511
},
493
512
},
494
513
}
@@ -520,8 +539,11 @@ func TestFindQueryOS(t *testing.T) {
520
539
require .NotNil (t , proc )
521
540
522
541
assert .Equal (t , notepadPID , proc .PID )
523
- assert .Equal (t , "notepad.exe" , proc .Name )
542
+ assert .Equal (t , "notepad.exe" , strings . ToLower ( proc .Name ) )
524
543
assert .Equal (t , uint32 (os .Getpid ()), proc .Ppid )
544
+ assert .True (t , proc .IsPackaged )
545
+ assert .False (t , proc .IsWOW64 )
546
+ assert .False (t , proc .IsProtected )
525
547
assert .Equal (t , strings .ToLower (filepath .Join (os .Getenv ("windir" ), "notepad.exe" )), strings .ToLower (proc .Exe ))
526
548
assert .Equal (t , filepath .Join (os .Getenv ("windir" ), "notepad.exe" ), proc .Cmdline )
527
549
assert .True (t , len (proc .Envs ) > 0 )
0 commit comments