Add raw access to NumberOfProcessors detection method

This commit is contained in:
Alberto Ortega 2015-05-09 02:25:06 +02:00
parent 882a67a33e
commit 9f8c035739
3 changed files with 20 additions and 0 deletions

View File

@ -133,6 +133,16 @@ int gensandbox_sleep_patched() {
else return TRUE;
}
int gensandbox_one_cpu() {
DWORD NumberOfProcessors = 0;
__asm__ volatile (
"mov %%fs:0x18, %%eax;"
"mov %%ds:0x30(%%eax), %%eax;"
"mov %%ds:0x64(%%eax), %%eax;"
: "=a"(NumberOfProcessors));
return NumberOfProcessors < 2 ? TRUE : FALSE;
}
int gensandbox_one_cpu_GetSystemInfo() {
SYSTEM_INFO siSysInfo;
GetSystemInfo(&siSysInfo);

View File

@ -16,6 +16,8 @@ int gensandbox_drive_size2();
int gensandbox_sleep_patched();
int gensandbox_one_cpu();
int gensandbox_one_cpu_GetSystemInfo();
#endif

View File

@ -175,6 +175,14 @@ int main(void)
}
else print_not_traced();
printf("[*] Checking if NumberOfProcessors is < 2 via raw access ... ");
if (gensandbox_one_cpu() == TRUE) {
print_traced();
write_log("Sandbox traced by checking if NumberOfProcessors is less than 2 via raw access");
write_trace("hi_sandbox_NumberOfProcessors_less_2_raw");
}
else print_not_traced();
printf("[*] Checking if NumberOfProcessors is < 2 via GetSystemInfo() ... ");
if (gensandbox_one_cpu_GetSystemInfo() == TRUE) {
print_traced();