Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scapy question
#1
Hi guys,

I'm trying to use scapy for the first time and I picked up a script that monitors Probe requests,

from scapy.all import *

PROBE_REQUEST_TYPE=0
PROBE_REQUEST_SUBTYPE=4

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)
ai
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()
The challenge I'm facing is with the signal strength, 
signal_strength = -(256-ord(extra[-4:-3]))
The output I get for every probe request is -256.

Has anyone ever face this behaviour?

Thanks
Reply
#2
What is "extra", and why is ord(extra[-4:-3]) always 0?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Scapy Basics Shivi 0 904 Sep-25-2023, 07:37 AM
Last Post: Shivi
  How to send a HTTP response packet using scapy JeffreyStoner 0 2,629 Apr-18-2022, 05:23 AM
Last Post: JeffreyStoner
  How to get every IP found by a Scapy traceroute? jao 0 2,435 Feb-06-2022, 01:00 AM
Last Post: jao
  scapy wifi scan to get payload \ data korenron 0 2,110 Nov-16-2021, 01:47 PM
Last Post: korenron
  can I set scan interval for scapy? korenron 0 2,305 Dec-31-2020, 01:43 PM
Last Post: korenron
  scapy trazom 1 2,607 Aug-30-2020, 04:17 PM
Last Post: micseydel
  network and scapy trazom 0 2,043 Aug-16-2020, 03:54 PM
Last Post: trazom
  Need Help with creating an IP packet with timestamp field using Scapy RTD 0 3,432 Jun-15-2019, 08:21 PM
Last Post: RTD
  Scapy, creating response for GET request. SyRex1013 4 5,077 Dec-11-2018, 07:39 AM
Last Post: SyRex1013
  sniffing real time with pyshark or scapy jeanapala 2 7,412 Nov-16-2017, 09:07 PM
Last Post: jeanapala

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020