PE-sieve
Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).
Loading...
Searching...
No Matches
artefacts_util.h
Go to the documentation of this file.
1#pragma once
2#include <windows.h>
3#include <sig_finder.h>
4#define PATTERN_NOT_FOUND (-1)
5
6namespace pesieve {
7 namespace util {
8 /*
9 Scans the buffer of given size, in a search of the supplied pattern (using simple memcmp)
10 If the number of iterations is not specified (0) it scans full space, otherwise it takes only max_iter number of steps.
11 Returns the pointer to the found pattern, or nullptr if not found.
12 */
13 BYTE* find_pattern(BYTE *buffer, size_t buf_size, BYTE* pattern_buf, size_t pattern_size, size_t max_iter = 0);
14
15 /*
16 Scans the buffer searching for the hardcoded 32-bit code patterns. If found, returns the match offset, otherwise returns CODE_PATTERN_NOT_FOUND
17 */
18 size_t is_32bit_code(BYTE *loadedData, size_t loadedSize);
19
20 /*
21 Scans the buffer searching for the hardcoded 64-bit code patterns. If found, returns the match offset, otherwise returns CODE_PATTERN_NOT_FOUND
22 */
23 size_t is_64bit_code(BYTE *loadedData, size_t loadedSize);
24
25 /*
26 Scans the buffer searching for any hardcoded code patterns (both 32 and 64 bit).
27 */
28 bool is_code(BYTE *loadedData, size_t loadedSize);
29
30 bool is_executable(DWORD mapping_type, DWORD protection);
31
32 bool is_readable(DWORD mapping_type, DWORD protection);
33
34 bool is_normal_inaccessible(DWORD state, DWORD mapping_type, DWORD protection);
35 }; // namespace util
36
37 namespace matcher {
38
39 /* using the global matcher */
40
41 bool is_matcher_ready();
42
44
45 size_t load_pattern_file(const char* filename);
46
47 size_t find_all_patterns(BYTE* loadedData, size_t loadedSize, std::vector<sig_finder::Match>& allMatches);
48
49 size_t filter_custom(std::vector<sig_finder::Match>& allMatches, std::vector<sig_finder::Match>& customPatternMatches);
50
51 }; //namespace matcher
52}
size_t load_pattern_file(const char *filename)
size_t find_all_patterns(BYTE *loadedData, size_t loadedSize, std::vector< sig_finder::Match > &allMatches)
size_t filter_custom(std::vector< sig_finder::Match > &allMatches, std::vector< sig_finder::Match > &customPatternMatches)
size_t is_32bit_code(BYTE *loadedData, size_t loadedSize)
bool is_readable(DWORD mapping_type, DWORD protection)
BYTE * find_pattern(BYTE *buffer, size_t buf_size, BYTE *pattern_buf, size_t pattern_size, size_t max_iter=0)
bool is_normal_inaccessible(DWORD state, DWORD mapping_type, DWORD protection)
bool is_code(BYTE *loadedData, size_t loadedSize)
bool is_executable(DWORD mapping_type, DWORD protection)
DWORD(__stdcall *_PssCaptureSnapshot)(HANDLE ProcessHandle
size_t is_64bit_code(BYTE *loadedData, size_t loadedSize)
size_t fill_iat(BYTE *vBuf, size_t vBufSize, IN const peconv::ExportsMapper *exportsMap, IN OUT IATBlock &iat, IN ThunkFoundCallback *callback)
Definition iat_finder.h:31