Skip to content

Commit 3c54066

Browse files
committed
Now skips scanning 32bit processes until 32bit support is added.
1 parent 7b86197 commit 3c54066

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

BeaconEye.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ public static List<int> IndexOfSequence(byte[] buffer, byte[] pattern, int start
5454

5555
static Configuration ProcessHasConfig(NtProcess process) {
5656

57-
IntPtr processHeap = process.GetPeb().GetProcessHeap();
58-
var memoryInfo = process.QueryMemoryInformation(processHeap.ToInt64());
59-
6057
try {
6158

59+
IntPtr processHeap = process.GetPeb().GetProcessHeap();
60+
var memoryInfo = process.QueryMemoryInformation(processHeap.ToInt64());
6261
var memory = process.ReadMemory(memoryInfo.BaseAddress, (int)memoryInfo.RegionSize);
6362

6463
using(var ctx = new YaraContext()) {
@@ -77,8 +76,8 @@ static Configuration ProcessHasConfig(NtProcess process) {
7776
}
7877
}
7978

80-
} catch (Exception) {
81-
79+
} catch (Exception e) {
80+
8281
}
8382

8483
return null;
@@ -186,14 +185,19 @@ static void Main(string[] args) {
186185
var processes = NtProcess.GetProcesses(ProcessAccessRights.AllAccess);
187186
var originalColor = Console.ForegroundColor;
188187
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+
}
193197
} else {
194-
Console.ForegroundColor = ConsoleColor.Green;
195-
Console.WriteLine($"\t{process.Name} ({process.ProcessId})");
196-
}
198+
Console.ForegroundColor = ConsoleColor.Yellow;
199+
Console.WriteLine($"\tSkipped 32bit process {process.Name} ({process.ProcessId})");
200+
}
197201
}
198202
Console.ForegroundColor = originalColor;
199203

0 commit comments

Comments
 (0)