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
demo.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3import os
4import pesieve
5
6# set absolute path to the directory with pe-sieve32.dll/pe-sieve64.dll (if different than a directory with pesieve.py)
7#os.environ['PESIEVE_DIR'] = os.path.abspath(os.getcwd())
8
9# prepare parameters
11params.pid = os.getpid()
12params.dotnet_policy = pesieve.t_dotnet_policy.PE_DNET_SKIP_MAPPING
13params.imprec_mode = pesieve.t_imprec_mode.PE_IMPREC_AUTO
14params.quiet = False
15params.out_filter = pesieve.t_output_filter.OUT_FULL
16params.no_hooks = False
17params.shellcode = pesieve.t_shellc_mode.SHELLC_PATTERNS
18params.obfuscated = pesieve.t_obfusc_mode.OBFUSC_NONE
19params.threads = True
20params.iat = pesieve.t_iat_scan_mode.PE_IATS_CLEAN_SYS_FILTERED
21params.data = pesieve.t_data_scan_mode.PE_DATA_SCAN_NO_DEP
22params.minidump = False
23params.dump_mode = pesieve.t_dump_mode.PE_DUMP_AUTO
24params.json_output = True
25params.make_reflection = False
26params.use_cache = False
27params.json_lvl = pesieve.t_json_level.JSON_BASIC
28params.output_dir = b"/path/to/output/dir"
29params.modules_ignored = pesieve.PARAM_STRING(length=10, buffer=b'ignored1;ignored2')
30
31# run the function
32json_max_size = 2000
33(report, json, out_size) = pesieve.PESieve_scan_ex(params, pesieve.t_report_type.REPORT_ALL, json_max_size)
34
35# print the report
36print("PID: %d" % report.pid)
37print("Scanned: %d" % report.scanned)
38print("suspicious: %d" % report.suspicious)
39print("JSON: %s" % json)
40print("out_size: %d" % out_size)
(t_report, str, int) PESieve_scan_ex(t_params params, t_report_type rtype, int buf_size)
Definition pesieve.py:186