MCPcopy Create free account
hub / github.com/NoMercy-ac/NoMercy / ScanFile

Method ScanFile

Source/Client/NM_Engine/IFileScanner.cpp:663–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663bool IScanner::ScanFile(const std::string & szFileName, EFileScanTypes fileType)
664{
665 std::lock_guard <std::recursive_mutex> __lock(m_Mutex);
666
667 SCANNER_LOG(LL_SYS, "File scanner has been started! Target file: %s", szFileName.c_str());
668
669 if (IsScannedFile(szFileName))
670 {
671 SCANNER_LOG(LL_SYS, "File already scanned!");
672 return false;
673 }
674
675 // Add to checked list
676 m_vScannedFileNames.push_back(szFileName);
677
678 // Scan routine
679
680 /// 1
681 // Exist check
682 auto bRet = CheckFileExist(szFileName);
683 SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File exist scan completed! Result: %d", bRet);
684
685 /// 2
686 // File name + file size + Entropy + Hash
687 bRet = CheckFileBasicInformations(szFileName);
688 SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File basic information scan completed! Result: %d", bRet);
689
690 /// 3
691 // nFileIndexLow, nFileIndexHigh, dwVolumeSerialNumber
692 bRet = CheckFileInformations(szFileName);
693 SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File information scan completed! Result: %d", bRet);
694
695 /// 4
696 // PE Informations
697 bRet = CheckFilePEInformations(szFileName);
698 SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File PE information scan completed! Result: %d", bRet);
699
700 /// 4
701 // Region hash Informations
702 bRet = CheckFileRegionHashes(szFileName);
703 SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File PE information scan completed! Result: %d", bRet);
704
705 return true;
706}
707
708bool IScanner::ScanFile(HANDLE hProcess, EFileScanTypes fileType)
709{

Callers

nothing calls this directly

Calls 8

CheckFileExistFunction · 0.85
CheckFileInformationsFunction · 0.85
CheckFilePEInformationsFunction · 0.85
CheckFileRegionHashesFunction · 0.85
GetProcessIdMethod · 0.80
IsValidHandleMethod · 0.80
DynamicWinapiInstanceMethod · 0.80

Tested by

no test coverage detected