-
-
Save frankenstein91/d56c2162353fc94d01e9c4287b320be4 to your computer and use it in GitHub Desktop.
A simple python script which records and logs wifi probe requests.
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
import multiprocessing,argparse,chardet | |
from scapy.all import sniff, Dot11 | |
from mac_vendor_lookup import MacLookup | |
mac = MacLookup() | |
def handle_packet(pkt): | |
thisProb = {} | |
if not pkt.haslayer(Dot11): | |
return | |
if pkt.type == 0 and pkt.subtype == 4: | |
if b"" == pkt.info: | |
thisProb["ssid"] = None | |
else: | |
thisProb["ssid"] = pkt.info.decode(chardet.detect(pkt.info)['encoding']) | |
thisProb["src MAC"] = pkt.addr2.upper() | |
try: | |
thisProb["vendor"] = mac.lookup(thisProb["src MAC"]) | |
except KeyError: | |
thisProb["vendor"] = "unknown manufacturer" | |
print(thisProb) | |
if __name__ == '__main__': | |
multiprocessing.freeze_support() | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--interface', '-i', default='mon0', # Change mon0 to your monitor-mode enabled wifi interface | |
help='monitor mode enabled interface') | |
args = parser.parse_args() | |
mac.update_vendors() | |
sniff(iface=args.interface, prn=handle_packet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment