What’s the issue here ?
#5
(01-13-2021, 04:53 PM)FancyBear Wrote: #!/usr/bin/python3
Import sys
Import scapy.all
From scapy.all import *
conf.iface= “wlan0mon”
Devices = set()
def PacketHandler(pkt):
        if pkt.haslayer(Dot11):
            dot11_layer=pkt.get layer(Dot11)
            if dot11_layer.addr2 and (dot11_layer.addr2 not in Devices):
                            Devices.add(dot11_layer.addr2)
                            print(dot11_layer.addr2)
sniff(iface=sys.argv[1], count=int(sys.argv[2]), prn=PacketHandler)

I am having a hard time remaining patient with you. Code tags work like so:

[ code ]

Code goes here

[ /code]

If you remove the spaces and paste your source between the tags it will look like this:

Code:
#!/usr/bin/python3
Import sys
Import scapy.all
From scapy.all import *
conf.iface= “wlan0mon”
Devices = set()
def PacketHandler(pkt):
        if pkt.haslayer(Dot11):
            dot11_layer=pkt.get layer(Dot11)
            if dot11_layer.addr2 and (dot11_layer.addr2 not in Devices):
                            Devices.add(dot11_layer.addr2)
                            print(dot11_layer.addr2)
sniff(iface=sys.argv[1], count=int(sys.argv[2]), prn=PacketHandler)

Ok great, but you still did not post any error messages. Do you even know how to use your Terminal?

Even without error messages i can tell you that:
Code:
# If you do this
From scapy.all import *
# This becomes redundant
Import scapy.all
#Not only that, doing it like that will only instantiate the scapy.all module object

Also, by doing `From scapy.all import *` you are only aggregating the top level objects from all scapy modules. `pkt.haslayer` is class notation. There is no `pkt` class in any top level object for scapy.

I can go on for multiple pages here but you get the point. And unless you post the entirety of your source code in proper code tags i am going to assume you have no clue on how any of this works, and don't know what you are doing.
Reply


Messages In This Thread
What’s the issue here ? - by FancyBear - 01-12-2021, 05:00 PM
RE: What’s the issue here ? - by poppopret - 01-12-2021, 05:22 PM
RE: What’s the issue here ? - by Vector - 01-13-2021, 03:04 AM
RE: What’s the issue here ? - by FancyBear - 01-13-2021, 04:53 PM
RE: What’s the issue here ? - by Vector - 01-13-2021, 06:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Having an issue writing a python script with vim FancyBear 4 22,491 01-03-2021, 11:27 PM
Last Post: FancyBear
  Here is a quick Python tool i wrote. Vector 0 10,396 04-09-2017, 01:46 PM
Last Post: Vector
  Here is a little bash script i wrote to help with kernel management. Vector 8 23,943 12-31-2016, 01:08 PM
Last Post: Vector