@@ -137,24 +137,25 @@ def exploit_matcher(self):
137
137
self .my_sender ('text/html' , data )
138
138
139
139
def exploit (self ):
140
- path = unquote (self .path .rsplit ('/' , 1 )[- 1 ])
141
- if not path or path == '/' :
142
- path = 'index.html'
143
- which = unquote (self .path .rsplit ('/' )[- 2 ])
144
- mime = mimetypes .guess_type (path )
140
+ path = unquote (self .path .split ('/' , 2 )[- 1 ])
141
+ if path [- 1 :] == '/' :
142
+ path += 'index.html'
143
+ mime = mimetypes .guess_type (self .path .rsplit ('/' , 1 )[- 1 ])
145
144
if mime [0 ]:
146
145
mime = mime [0 ]
147
146
else :
148
147
mime = 'application/octet-stream'
149
- with open (os .path .join (EXPLOIT_LOC , which , path ), 'rb' ) as buf :
148
+ with open (os .path .join (EXPLOIT_LOC , path ), 'rb' ) as buf :
150
149
data = buf .read ()
151
150
if path == 'index.html' :
152
151
data = data .replace (b'0.0.0.0' , bytes (get_lan (), 'utf-8' ))
153
152
self .my_sender (mime , data )
154
153
155
154
def static_request (self ):
156
- path = unquote (self .path .rsplit ('/' , 1 )[- 1 ])
157
- mime = mimetypes .guess_type (path )
155
+ path = unquote (self .path .split ('/' , 2 )[- 1 ])
156
+ if path [- 1 :] == '/' :
157
+ path += 'index.html'
158
+ mime = mimetypes .guess_type (self .path .rsplit ('/' , 1 )[- 1 ])
158
159
if mime [0 ]:
159
160
mime = mime [0 ]
160
161
else :
@@ -178,19 +179,31 @@ def payload_launcher(self):
178
179
179
180
def inject_exploit_html (self , html ):
180
181
try :
181
- exploits = os .listdir (EXPLOIT_LOC )
182
- if 'PUT EXPLOITS HERE' in exploits :
183
- exploits .remove ('PUT EXPLOITS HERE' )
184
- exploits .sort ()
185
- if len (exploits ) == 0 :
186
- return html
187
- elif len (exploits ) == 1 :
188
- data = '" {}"' .format (exploits [0 ])
182
+ firmwares = os .listdir (EXPLOIT_LOC )
183
+ if 'PUT EXPLOITS HERE' in firmwares :
184
+ firmwares .remove ('PUT EXPLOITS HERE' )
185
+ firmwares .sort ()
186
+ if len (firmwares ) == 0 :
187
+ return html . replace ( b'{{EXPLOITS}}' , '{"firmwares": ["No Exploits Found"]}' )
188
+ elif len (firmwares ) == 1 :
189
+ data = '{"firmwares": [" {}"]}} ' .format (firmwares [0 ])
189
190
else :
190
- data = '"' + '", "' .join (exploits ) + '"'
191
+ data = '{"firmwares": ["' + '", "' .join (firmwares ) + '"]}'
192
+
193
+ for firmware in firmwares :
194
+ exploits = os .listdir (os .path .join (EXPLOIT_LOC , firmware ))
195
+ exploits .append ('[Back]' )
196
+ if len (exploits ) == 1 :
197
+ data = data [:- 1 ]
198
+ data += ', "{}": ["{}"]}}' .format (firmware , exploits [0 ])
199
+ else :
200
+ data = data [:- 1 ]
201
+ data += ', "{}": ["' .format (firmware )
202
+ data += '", "' .join (exploits ) + '"]}'
203
+
191
204
data = bytes (data , 'utf-8' )
192
205
except IOError :
193
- pass
206
+ return html . replace ( b'{{EXPLOITS}}' , '{"firmwares": ["I/O Error on Host"]}' )
194
207
195
208
return html .replace (b'{{EXPLOITS}}' , data )
196
209
@@ -201,7 +214,11 @@ def check_ua(self):
201
214
'Mozilla/5.0 (PlayStation 4 4.05) AppleWebKit/537.78 (KHTML, like Gecko)' ,
202
215
'Mozilla/5.0 (PlayStation 4 5.05) AppleWebKit/537.78 (KHTML, like Gecko)' ,
203
216
'Mozilla/5.0 (PlayStation 4 4.55) AppleWebKit/601.2 (KHTML, like Gecko)' ,
204
- 'Mozilla/5.0 (PlayStation 4 5.05) AppleWebKit/601.2 (KHTML, like Gecko)'
217
+ 'Mozilla/5.0 (PlayStation 4 5.05) AppleWebKit/601.2 (KHTML, like Gecko)' ,
218
+ 'Mozilla/5.0 (PlayStation 4 5.01) AppleWebKit/601.2 (KHTML, like Gecko)' ,
219
+ 'Mozilla/5.0 (PlayStation 4 5.03) AppleWebKit/601.2 (KHTML, like Gecko)' ,
220
+ 'Mozilla/5.0 (PlayStation 4 5.05) AppleWebKit/601.2 (KHTML, like Gecko)' ,
221
+ 'Mozilla/5.0 (PlayStation 4 5.50) AppleWebKit/601.2 (KHTML, like Gecko)'
205
222
]
206
223
207
224
if self .headers ['User-Agent' ] in allowed :
@@ -241,7 +258,7 @@ def do_GET(self):
241
258
except IOError :
242
259
self .send_error (404 )
243
260
244
- if self .path .rsplit ('/' , 1 )[- 1 ] == 'kernel .js' :
261
+ if self .path .rsplit ('/' , 1 )[- 1 ] == 'rop .js' :
245
262
print ('>> Exploit sent...' )
246
263
try :
247
264
payloads_file = os .path .join (EXPLOIT_LOC , self .path .rsplit ('/' , 2 )[- 2 ], 'nopayloads' )
0 commit comments