Created
April 24, 2015 13:39
-
-
Save kukat/5caa319c808f5b38f4d3 to your computer and use it in GitHub Desktop.
MAC address scanner
This file contains hidden or 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
from scapy.all import * | |
PROBE_REQUEST_TYPE=0 | |
PROBE_REQUEST_SUBTYPE=4 | |
WHITELIST = ['00:00:00:00:00:00',] # Replace this with your phone's MAC address | |
def PacketHandler(pkt): | |
if pkt.haslayer(Dot11): | |
if pkt.type==PROBE_REQUEST_TYPE and pkt.subtype == PROBE_REQUEST_SUBTYPE: | |
PrintPacket(pkt) | |
def PrintPacket(pkt): | |
print "Probe Request Captured:" | |
try: | |
extra = pkt.notdecoded | |
except: | |
extra = None | |
if extra!=None: | |
signal_strength = -(256-ord(extra[-4:-3])) | |
else: | |
signal_strength = -100 | |
print "No signal strength found" | |
print "Target: %s Source: %s SSID: %s RSSi: %d"%(pkt.addr3,pkt.addr2,pkt.getlayer(Dot11ProbeReq).info,signal_strength) | |
def main(): | |
from datetime import datetime | |
print "[%s] Starting scan"%datetime.now() | |
print "Scanning for:" | |
print "\n".join(mac for mac in WHITELIST) | |
sniff(iface=sys.argv[1],prn=PacketHandler) | |
if __name__=="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment