-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.py
34 lines (27 loc) · 1 KB
/
test1.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
import subprocess
# import atexit
def run_continuously(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
while True:
line = process.stdout.readline().rstrip()
yield line
# def exit_handler():
# print("Exiting...stopping scan..")
if __name__ == "__main__":
# atexit.register(exit_handler)
routerIP = "192.168.5.36"
routerInterface = "wlan1"
address = "C0:CC:F8:6D:45:8D"
newParag = False
prgStr = ""
for line in run_continuously('ssh admin@'+ routerIP +' "interface wireless snooper flat-snoop '+ routerInterface +'"'):
if (len(line) == 0):
if (prgStr.find("address="+address)!=-1):
start = prgStr.find("signal-strength=")+len("signal-strength=")
stop = prgStr.find("dB",start)
print(prgStr[start:stop] +" =======> "+ prgStr)
# print(prgStr)
print("######")
prgStr = ""
else:
prgStr += line