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
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()
|
Loading…
Add table
Add a link
Reference in a new issue