01-13-2021, 06:50 PM
(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.