@@ -54,11 +54,10 @@ public static List<int> IndexOfSequence(byte[] buffer, byte[] pattern, int start
54
54
55
55
static Configuration ProcessHasConfig ( NtProcess process ) {
56
56
57
- IntPtr processHeap = process . GetPeb ( ) . GetProcessHeap ( ) ;
58
- var memoryInfo = process . QueryMemoryInformation ( processHeap . ToInt64 ( ) ) ;
59
-
60
57
try {
61
58
59
+ IntPtr processHeap = process . GetPeb ( ) . GetProcessHeap ( ) ;
60
+ var memoryInfo = process . QueryMemoryInformation ( processHeap . ToInt64 ( ) ) ;
62
61
var memory = process . ReadMemory ( memoryInfo . BaseAddress , ( int ) memoryInfo . RegionSize ) ;
63
62
64
63
using ( var ctx = new YaraContext ( ) ) {
@@ -77,8 +76,8 @@ static Configuration ProcessHasConfig(NtProcess process) {
77
76
}
78
77
}
79
78
80
- } catch ( Exception ) {
81
-
79
+ } catch ( Exception e ) {
80
+
82
81
}
83
82
84
83
return null ;
@@ -186,14 +185,19 @@ static void Main(string[] args) {
186
185
var processes = NtProcess . GetProcesses ( ProcessAccessRights . AllAccess ) ;
187
186
var originalColor = Console . ForegroundColor ;
188
187
foreach ( var process in processes ) {
189
-
190
- if ( IsBeaconProcess ( process ) ) {
191
- Console . ForegroundColor = ConsoleColor . Red ;
192
- Console . WriteLine ( $ "\t { process . Name } ({ process . ProcessId } )") ;
188
+
189
+ if ( process . Is64Bit ) {
190
+ if ( IsBeaconProcess ( process ) ) {
191
+ Console . ForegroundColor = ConsoleColor . Red ;
192
+ Console . WriteLine ( $ "\t { process . Name } ({ process . ProcessId } )") ;
193
+ } else {
194
+ Console . ForegroundColor = ConsoleColor . Green ;
195
+ Console . WriteLine ( $ "\t { process . Name } ({ process . ProcessId } )") ;
196
+ }
193
197
} else {
194
- Console . ForegroundColor = ConsoleColor . Green ;
195
- Console . WriteLine ( $ "\t { process . Name } ({ process . ProcessId } )") ;
196
- }
198
+ Console . ForegroundColor = ConsoleColor . Yellow ;
199
+ Console . WriteLine ( $ "\t Skipped 32bit process { process . Name } ({ process . ProcessId } )") ;
200
+ }
197
201
}
198
202
Console . ForegroundColor = originalColor ;
199
203
0 commit comments