| 460 | } |
| 461 | |
| 462 | void IScanner::ScanModule(HANDLE hProcess, const std::string & szModuleName, DWORD64 dwModuleBase, DWORD dwModuleSize) |
| 463 | { |
| 464 | std::lock_guard <std::recursive_mutex> __lock(m_Mutex); |
| 465 | |
| 466 | SCANNER_LOG(LL_SYS, "Module scanner has been started! Target module: %s(%p-%p) Target proc: %p(%u)", |
| 467 | szModuleName.c_str(), dwModuleBase, dwModuleSize, hProcess, g_winapiApiTable->GetProcessId(hProcess)); |
| 468 | |
| 469 | if (IsScannedModule(szModuleName)) |
| 470 | { |
| 471 | SCANNER_LOG(LL_SYS, "Module already scanned!"); |
| 472 | return; |
| 473 | } |
| 474 | |
| 475 | // Add to checked list |
| 476 | m_vScannedModuleNames.push_back(szModuleName); |
| 477 | |
| 478 | // Scan routine |
| 479 | |
| 480 | auto bRet = false; |
| 481 | |
| 482 | // TODO: Scan export names |
| 483 | |
| 484 | /// 1 |
| 485 | // Scan module file |
| 486 | bRet = ScanFile(hProcess, FILE_TYPE_MODULE); |
| 487 | // SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "Module file scan routine completed! Result: %d", bRet); |
| 488 | |
| 489 | /// 2 |
| 490 | // Scan module entrypoint |
| 491 | bRet = ScanModuleBase(hProcess, szModuleName, dwModuleBase, dwModuleSize); |
| 492 | // SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "Module link scan routine completed! Result: %d", bRet); |
| 493 | |
| 494 | /// 3 |
| 495 | // Scan module informations |
| 496 | bRet = ScanModuleInformations(hProcess, szModuleName, dwModuleBase, dwModuleSize); |
| 497 | // SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "Module information scan routine completed! Result: %d", bRet); |
| 498 | |
| 499 | /// 4 |
| 500 | // Scan module pe header |
| 501 | bRet = ScanModuleHeader(hProcess, szModuleName, dwModuleBase, dwModuleSize); |
| 502 | // SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "Module header scan routine completed! Result: %d", bRet); |
| 503 | } |
| 504 | |
| 505 | |
| 506 | std::vector < std::shared_ptr <SModuleEnumContext> > IScanner::GetModuleList(HANDLE hProcess) |
nothing calls this directly
no test coverage detected