0

我是 Python 的新手,正在尝试学习如何编写一个 SSID 扫描器来执行以下操作:

  1. 询问用户扫描的时间长度
  2. 使用 wlan 通过 Airmon-NG 启用监控模式
  3. 检查是否确实启用了 Mon0,然后进行下一步
  4. 检查 Mon0 后,使用 Mon0 启动 Airmon-NG 并扫描 5 分钟
  5. 让程序看到一旦达到 5 分钟标记,打印出“SSID Scan Complete”
  6. 关闭程序

我想最终在 5 分钟后获取扫描输出并将其转储到文本文件中以供以后查看,但我还没有到那里,所以请原谅我继续学习时对 Python 的无知。到目前为止我所拥有的只是经过研究,但我觉得卡住了,我知道的一些部分是错误的,我无法弄清楚,例如:

  1. 实际上在启动 airodump-NG 之前验证 Mon0 是否打开
  2. 等待输入的时间长度才结束

这是我到目前为止所拥有的:

#!/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)
4

1 回答 1

0

您可以查看在 shell 命令中运行“ifconfig”。如果列出了 MON0,您可以跳过将 WLAN2 置于无线模式。

于 2015-04-06T06:14:12.903 回答