forked from EmpireProject/Empire
-
-
Notifications
You must be signed in to change notification settings - Fork 580
/
invoke_bypass.py
31 lines (27 loc) · 957 Bytes
/
invoke_bypass.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
from empire.server.common.empire import MainMenu
from empire.server.core.db.base import SessionLocal
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 = "",
):
script = ""
with SessionLocal.begin() as db:
for name in params["Bypasses"].split():
bypass = main_menu.bypassesv2.get_by_name(db, name)
if bypass:
script += bypass.code
script = main_menu.modulesv2.finalize_module(
script=script,
script_end="",
obfuscate=obfuscate or params["Obfuscate"],
obfuscation_command=obfuscation_command
if obfuscation_command != ""
else params["ObfuscateCommand"],
)
return script