Skip to content

Commit

Permalink
display MAC's OUI if available
Browse files Browse the repository at this point in the history
  • Loading branch information
SkypLabs committed Sep 19, 2017
1 parent f179078 commit d716fe3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
argparse==1.4.0
scapy-python3==0.21
argparse>=1.4.0
netaddr>=0.7.19
scapy-python3>=0.21
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
scripts = ['sniff-probe-req'],
install_requires = ['argparse', 'scapy-python3'],
install_requires = ['argparse>=1.4.0', 'netaddr>=0.7.19', 'scapy-python3>=0.21'],
)
16 changes: 15 additions & 1 deletion sniff-probe-req
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-

from scapy.all import *
from netaddr import EUI, NotRegisteredError
from csv import writer
from re import compile, match
from os import geteuid
Expand All @@ -13,6 +14,8 @@ def parseProbeReq(packet):
s_mac = packet.getlayer(RadioTap).addr2
essid = packet.getlayer(Dot11ProbeReq).info.decode("utf-8")

mac_org = getMACOrganisation(s_mac)

# If the probe request contains an ESSID.
if essid:
if "essid_filter" in globals() and not essid in essid_filter:
Expand All @@ -21,11 +24,22 @@ def parseProbeReq(packet):
if "essid_regex" in globals() and not match(essid_regex, essid):
return

print("{timestamp} - {s_mac} -> {essid}".format(timestamp=timestamp, s_mac=s_mac, essid=essid))
print("{timestamp} - {s_mac} ({mac_org}) -> {essid}".format(
timestamp=timestamp,
s_mac=s_mac,
mac_org=mac_org,
essid=essid
))

if "outfile" in globals():
outfile.writerow([timestamp, s_mac, essid])

def getMACOrganisation(mac):
try:
return EUI(mac).oui.registration().org
except NotRegisteredError:
return None

if __name__ == "__main__":
ap = ArgumentParser(description="Wi-Fi Probe Requests Sniffer")
essid_arguments = ap.add_mutually_exclusive_group()
Expand Down

0 comments on commit d716fe3

Please sign in to comment.