admin管理员组

文章数量:1123697

Trying to extract the vendor information (Apple, Samsung, etc) from Probe Request coming from mobile, So far no luck. Not sure where the corrections to be made to get this info.

Adding my code:

import codecs
from scapy.all import *
from netaddr import *

def handler(p):

    if not (p.haslayer(Dot11ProbeResp) or p.haslayer(Dot11ProbeReq) or p.haslayer(Dot11Beacon)):
        return
    
    rssi = p[RadioTap].dBm_AntSignal
    dst_mac = p[Dot11].addr1
    src_mac = p[Dot11].addr2
    ap_mac = p[Dot11].addr2

    global macf
    maco = EUI(src_mac)
    try:
        macf = maco.oui.registration()
    except NotRegisteredError:
        macf = "Not available"
    
    info = f"rssi={rssi:2}dBm, dst={dst_mac}, src={src_mac}, ap={ap_mac}, manf= {macf}"
    
    if p.haslayer(Dot11ProbeReq):
        stats = p[Dot11ProbeReq]work_stats()
        ssid = str(stats['ssid'])
        channel = None
        
        if "channel" in stats:
            channel = stats['channel']

        print(f"[ProbReq ] {info}")
        print(f"ssid = {ssid}, channel ={channel}") #rate= {rates}
    
sniff(iface="wlan1", prn=handler, store=0)

本文标签: pythonExtracting vendor info from Probe Request using ScapyStack Overflow