13#define INVALID_OFFSET (-1)
18 bool is_valid_file_hdr(BYTE *loadedData,
size_t loadedSize, BYTE *hdr_ptr, DWORD charact);
19 bool is_valid_section(BYTE *loadedData,
size_t loadedSize, BYTE *hdr_ptr, DWORD charact);
56 ULONGLONG
dropPeBase(
const ULONGLONG offset_with_pe_base)
const
69 OUT_PADDED(outs, level,
"\"pe_base_offset\" : ");
77 OUT_PADDED(outs, level,
"\"sections_hdrs\" : ");
80 OUT_PADDED(outs, level,
"\"sections_count\" : ");
84 OUT_PADDED(outs, level,
"\"calculated_image_size\" : ");
89 outs << std::dec <<
isDll;
92 outs << std::dec << this->
is64bit;
98 OUT_PADDED(outs, level,
"\"pe_artefacts\" : {\n");
145 OUT_PADDED(outs, level,
"\"workingset_scan\" : {\n");
160 static size_t calcImgSize(HANDLE
processHandle, HMODULE modBaseAddr, BYTE* headerBuffer,
size_t headerBufferSize, IMAGE_SECTION_HEADER *hdr_ptr = NULL);
247 bool findMzPe(ArtefactsMapping &mapping,
const size_t search_offset);
248 bool setMzPe(ArtefactsMapping &mapping, IMAGE_DOS_HEADER* _dos_hdr);
249 bool setSecHdr(ArtefactsMapping &mapping, IMAGE_SECTION_HEADER* _sec_hdr);
A report from the artefacts scan, generated by ArtefactScanner.
virtual const void fieldsToJSON(std::stringstream &outs, size_t level, const pesieve::t_json_level &jdetails)
ArtefactScanReport(HMODULE _module, size_t _moduleSize, t_scan_status status, PeArtefacts &peArt)
virtual const bool toJSON(std::stringstream &outs, size_t level, const pesieve::t_json_level &jdetails)
IMAGE_SECTION_HEADER * sec_hdr
bool operator<(const ArtefactsMapping &map2) const
IMAGE_FILE_HEADER * nt_file_hdr
ArtefactsMapping & operator=(const ArtefactsMapping &other)
IMAGE_DOS_HEADER * dos_hdr
ArtefactsMapping(MemPageData &_memPage, bool _is64bit)
A scanner for detection of artefacts related to PE implants in the process workingset.
ProcessScanReport & processReport
virtual ArtefactScanReport * scanRemote()
bool hasShellcode(HMODULE region_start, size_t region_size, PeArtefacts &peArt)
size_t calcImageSize(MemPageData &memPage, IMAGE_SECTION_HEADER *hdr_ptr, ULONGLONG pe_image_base)
ULONGLONG _findMZoffset(MemPageData &memPage, LPVOID hdr_ptr)
ArtefactScanner(HANDLE _procHndl, const process_details _proc_details, MemPageData &_memPageData, ProcessScanReport &_process_report)
bool findMzPe(ArtefactsMapping &mapping, const size_t search_offset)
IMAGE_SECTION_HEADER * findSecByPatterns(MemPageData &memPageData, const size_t max_search_size, const size_t search_offset)
ULONGLONG calcPeBase(MemPageData &memPage, LPVOID hdr_ptr)
const process_details pDetails
bool setMzPe(ArtefactsMapping &mapping, IMAGE_DOS_HEADER *_dos_hdr)
bool setNtFileHdr(ArtefactScanner::ArtefactsMapping &aMap, IMAGE_FILE_HEADER *_nt_hdr)
IMAGE_DOS_HEADER * _findDosHdrByPatterns(BYTE *search_ptr, const size_t max_search_size)
MemPageData * prevMemPage
bool setSecHdr(ArtefactsMapping &mapping, IMAGE_SECTION_HEADER *_sec_hdr)
bool _validateSecRegions(MemPageData &memPage, LPVOID sec_hdr, size_t sec_count, ULONGLONG pe_image_base, bool is_virtual)
IMAGE_FILE_HEADER * findNtFileHdr(MemPageData &memPage, const size_t start_offset, size_t stop_offset=INVALID_OFFSET)
PeArtefacts * findArtefacts(MemPageData &memPage, size_t start_offset)
IMAGE_DOS_HEADER * findDosHdrByPatterns(MemPageData &memPage, const size_t start_offset, size_t stop_offset=INVALID_OFFSET)
static size_t calcImgSize(HANDLE processHandle, HMODULE modBaseAddr, BYTE *headerBuffer, size_t headerBufferSize, IMAGE_SECTION_HEADER *hdr_ptr=NULL)
PeArtefacts * findInPrevPages(ULONGLONG addr_start, ULONGLONG addr_stop)
PeArtefacts * generateArtefacts(ArtefactsMapping &aMap)
virtual ~ArtefactScanner()
IMAGE_DOS_HEADER * findMzPeHeader(MemPageData &memPage, const size_t search_offset)
BYTE * _findSecByPatterns(BYTE *search_ptr, const size_t max_search_size)
A report about the PE artefact detected in the workingset.
virtual const bool fieldsToJSON(std::stringstream &outs, size_t level, const pesieve::t_json_level &jdetails)
virtual const bool toJSON(std::stringstream &outs, size_t level, const pesieve::t_json_level &jdetails)
ULONGLONG dropPeBase(const ULONGLONG offset_with_pe_base) const
static const size_t JSON_LEVEL
A base class for all the scanners checking appropriate process' features.
The report aggregating the results of the performed scan.
A report from the working set scan, generated by WorkingSetScanner.
virtual const void fieldsToJSON(std::stringstream &outs, size_t level, const pesieve::t_json_level &jdetails)
bool is_process_64bit(IN HANDLE process)
bool is_valid_file_hdr(BYTE *loadedData, size_t loadedSize, BYTE *hdr_ptr, DWORD charact)
bool is_valid_section(BYTE *loadedData, size_t loadedSize, BYTE *hdr_ptr, DWORD charact)
enum pesieve::module_scan_status t_scan_status