-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
86 lines (73 loc) · 2.93 KB
/
main.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python
import platform
from payload import exploit_library
from pyfiglet import Figlet
from beautifultable import BeautifulTable
import sys
def manual_search_check(user_input): #If user wants to use manual search feature
# Check if user entered an index or 's' or something completely different
try:
return int(user_input)
except:
if user_input == "s":
return "s"
else:
print("Wrong input!!!")
user_input = input("Enter the number of the exploit you want to use or enter s to make a new call: ")
manual_search_check(user_input)
if __name__ == '__main__':
'''Variables'''
exploit = exploit_library.Exploit_Library()
exploit_lib = exploit.exploit_lib
'''Banner'''
custom_figlet = Figlet(font="doh", width=200)
print(custom_figlet.renderText("MacPER"))
custom_figlet = Figlet(font="digital", width=80)
print(custom_figlet.renderText(" ....MacOS Priv. Esc Research.... "))
'''Gather Current MacOS Version'''
print("Gathering OS version...")
version = platform.mac_ver()
print("Target OS Version: " + str(version[0]))
e = exploit.is_target_vulnerable(version[0], exploit_lib[0])
'''Suggest Feasible Exploits & Search Feature '''
print("Searching for Feasible Exploits...")
feasible_exploits = exploit.search_exploit(version[0])
print("Suitable Exploits: ")
table = BeautifulTable()
table.columns.header = ["#", "cve", "name"]
exp_index = 1
for i in feasible_exploits:
table.rows.append([exp_index, str(i[1]["cve"]), i[1]["name"]])
exp_index = exp_index +1
print(table)
print("\n")
user_input = input("Enter the number of the exploit you want to use or enter s to make a new call (0 to exit!!): ")
if user_input == "0":
print("Exiting...")
sys.exit()
else:
exploit_index = manual_search_check(user_input)
# Manual search
if exploit_index == 's':
user_input = input("Enter cve, exploit name, or an application: ")
feasible_exploits = exploit.search_exploit(user_input)
# Table View
table = BeautifulTable()
table.columns.header = ["#", "cve", "name"]
exp_index = 1
for i in feasible_exploits:
table.rows.append([exp_index, str(i[1]["cve"]), i[1]["name"]])
exp_index = exp_index + 1
print(table)
print("\n")
user_input = input("Enter the number of the exploit you want to use or enter s to make a new call (0 to exit!!): ")
exploit_index = manual_search_check(user_input)
if user_input == "0":
print("Exiting...")
sys.exit()
else:
exploit_index = manual_search_check(user_input)
'''Execute Selected Exploit'''
result = exploit.run_exploit(version[0], feasible_exploits[int(exploit_index)-1][1])
'''Process Completion'''
print("Process Completed !!!")