Created
January 10, 2020 09:51
-
-
Save arall/9d2978435b30dd275ba87229d20ffa0f to your computer and use it in GitHub Desktop.
Python WiFi Probe scanner using tcpdump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# Based on :https://gist.github.com/LoranKloeze/6b713022619c2b32b32c6400a55a8433 | |
import subprocess | |
import re | |
import time | |
monitor_dev = "wlan1mon" | |
while True: | |
proc = subprocess.Popen(['tcpdump', '-l', '-I', '-i', monitor_dev, '-e', '-s', '256', 'type', 'mgt', 'subtype', 'probe-req'],stdout=subprocess.PIPE) | |
patt = '(-\d+)dBm signal antenna 0.+SA:([0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+) .+(Probe Request) \((.+)\)' | |
while True: | |
line = proc.stdout.readline() | |
if line != '': | |
m = re.search(patt, line) | |
if m is not None and len(m.groups()) == 4: | |
signal = m.group(1).rstrip() | |
mac = m.group(2).rstrip() | |
ssid = m.group(4).rstrip() | |
timestamp = int(time.time()) | |
print "SSID: ", ssid, "MAC: ", mac, "Signal: ", signal, "Date: ", timestamp | |
else: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment