diff --git a/scanners/thread_scanner.cpp b/scanners/thread_scanner.cpp index 8ca980286..5aa2474b8 100644 --- a/scanners/thread_scanner.cpp +++ b/scanners/thread_scanner.cpp @@ -179,7 +179,7 @@ size_t pesieve::ThreadScanner::analyzeStackFrames(IN const std::vectorstatus = SCAN_NOT_SUSPICIOUS; return my_report; } -#endif // proceed with detailed checks: HANDLE hThread = OpenThread( THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | SYNCHRONIZE, @@ -440,35 +439,19 @@ ThreadScanReport* pesieve::ThreadScanner::scanRemote() GetExitCodeThread(hThread, &exit_code); CloseHandle(hThread); - if (!is_ok) { - // could not fetch the thread context and information - my_report->status = SCAN_ERROR; - return my_report; - } + if (exit_code != STILL_ACTIVE) { #ifdef _DEBUG - std::string bits = cDetails.is64b ? "64" : "32"; - std::cout << "[" << bits << "-bit] " << std::hex << " Rip: " << cDetails.rip << " Rsp: " << cDetails.rsp; - if (exit_code != STILL_ACTIVE) - std::cout << " ExitCode: " << exit_code; - - if (cDetails.ret_addr != 0) { - std::cout << std::hex << " Ret: " << cDetails.ret_addr; - } - std::cout << "\n"; + std::cout << " ExitCode: " << std::dec << exit_code << "\n"; #endif - - if (exit_code != STILL_ACTIVE) { my_report->status = SCAN_NOT_SUSPICIOUS; return my_report; } -#ifdef _DEBUG - // if compiled in a debug mode, make this check AFTER scan - // (so that we can see first what was skipped) - if (!should_scan_context(info)) { - my_report->status = SCAN_NOT_SUSPICIOUS; + + if (!is_ok) { + // could not fetch the thread context and information + my_report->status = SCAN_ERROR; return my_report; } -#endif is_shc = isAddrInShellcode(cDetails.rip); if (is_shc) { @@ -484,7 +467,7 @@ ThreadScanReport* pesieve::ThreadScanner::scanRemote() #ifdef _SHOW_THREAD_INFO std::cout << "Checking shc candidate: " << std::hex << addr << "\n"; #endif //_SHOW_THREAD_INFO - //automatically verifies if the address is legit + //automatically verifies if the address is legit: if (reportSuspiciousAddr(my_report, addr)) { if (my_report->status == SCAN_SUSPICIOUS) { #ifdef _SHOW_THREAD_INFO