Sinisterly
Sniffer: Probe Request Sniffer - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Sniffer: Probe Request Sniffer (/Thread-Sniffer-Probe-Request-Sniffer)



Sniffer: Probe Request Sniffer - hunt3r972 - 01-06-2014

Code:
#!/usr/bin/env python #RUN WITH python probreqsniff.py import os from scapy.all import * def check_wireless_interfaces(): chk_wl_int=os.popen("ifconfig | sed 's/[ \t].*//;/^\(lo\|\)$/d;/eth/d' | grep wlan").read() #Check if wlan interfaces are activated if not chk_wl_int: print ("[+] No wireless interface available. You must turn on a wireless interface.") print ("[+] Closing") exit() else: print ("[+] Wireless interface detected") def check_monitor(): chk_mon=os.popen("ifconfig | sed 's/[ \t].*//;/^\(lo\|\)$/d;/eth/d' | grep mon").read() #Check if monitor mode has been enabled if not chk_mon: print ("[+] No monitoring interface detected") print ("[+] Available wireless interface(s)\n") wl_int_list=os.popen("ifconfig | sed 's/[ \t].*//;/^\(lo\|\)$/d;/eth/d' | grep wlan").read() #Listing wlan interfaces print wl_int_list int_mon=raw_input("[+] Which interface do you want to monitor?: ") while (int_mon != "wlan0") and (int_mon != "wlan1") and (int_mon != "wlan2") and (int_mon != "wlan3"): int_mon=raw_input("[+] Choose an interface from the list: ") print ("[+] Trying to enable monitoring on interface "+int_mon) os.system("airmon-ng start "+int_mon+" > /dev/null 2>&1") #Activate monitoring on choosen interface chk_mon=os.popen("ifconfig | sed 's/[ \t].*//;/^\(lo\|\)$/d;/eth/d' | grep mon").read() #Checking again if monitor mode is enabled if not chk_mon: print ("[+] Monitoring couldn't be enabled on interface "+int_mon) print ("[+] Closing") else: print ("[+] Monitoring enabled on interface "+int_mon) else: print ("[+] Monitoring interface detected") def sniff_probe(p): if (p.haslayer(Dot11ProbeReq)): #Checking if Dot11ProbeReq is present mac_address=(p.addr2) #Grabbing source mac address ssid=p[Dot11Elt].info #Grabbing ssid ssid=ssid.decode('utf-8','ignore') #Translating ssid if ssid == "": ssid="null" else: print "[>] Probe Request from %s for SSID '%s'" %(mac_address,ssid) print ("[+] Checking wireless interface") check_wireless_interfaces() print ("[+] Checking monitoring mode") check_monitor() print ("[+] Starting capture - CTRL + C to stop") sniff(iface="mon0",prn=sniff_probe)

This script allows you to sniff probe requests. You can perform Rogue AP attack easily thanks to it because you will know which device is asking for which ESSID.