我是Python的新手,并试图学习如何编写将执行以下操作的SSID扫描程序:
我希望最终在5分钟后获取扫描输出并将其转储到文本文件中供以后查看,但我还没有,所以请原谅我的Python无知,因为我继续学习。到目前为止我所有人都在研究之后,但我感到困惑,我知道的一些部分是错的,我无法弄明白,例如:
这是我到目前为止所做的:
#!/usr/bin/env python
import os
import subprocess
from datetime import datetime
#Clear the screen
subprocess.call("clear")
#Ask for the length of time in Minutes to scan for SSIDs
scan_ssid = raw_input("How many minutes would you like to scan for: ")
scan_length = scan_ssid
#Print banner
print "Scanning for SSIDs for " + scan_ssid " minutes."
#Start and verify airmon-ng in monitor mode
print "Placing wlan iface in Monitor Mode"
os.system("airmon-ng start wlan2")
monitor = mon0
if monitor == True:
print "Monitor Mode: Enabled"
#Start airodump-ng with monitor enabled
print "Starting SSID scan with Monitor Mode"
os.system("airodump-ng mon0")
#Scan for the user requested timefame
scan_length = time.time()
while True:
scan_length = 0
if scan_length == 5 or time.time() > scan_length:
break
scan_length = scan_length - 1
print "SSID Scan Complete!"
sys.exit(0)
答案 0 :(得分:0)
您可以在shell命令中运行“ifconfig”。如果列出MON0,则可以跳过将WLAN2置于无线模式。