Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scapy is not able to sniff packets at my network interface. #5572

Closed
Alinaahmad opened this issue Jul 10, 2020 · 3 comments
Closed

Scapy is not able to sniff packets at my network interface. #5572

Alinaahmad opened this issue Jul 10, 2020 · 3 comments

Comments

@Alinaahmad
Copy link

I'm using Scapy, on WSL. I checked for my network interface which is "wifi0". Using scapy I am trying to implement a packet sniffer.

import scapy.all as scapy
from scapy.layers import http
def sniff(interface):
8. scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)

def process_sniffed_packet(packet):
if packet.haslayer(http.HTTPRequest):

    #Extracting useful URLs
    url = packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path
    print("[+] HTTP Request >>" + URL)

.
.
.
.
.
.
.

  1. sniff("wifi0")

Executing this throws an error, as under.

Traceback (most recent call last):
File "Packet_Sniffer.py", line 27, in
sniff("wifi0")
File "Packet_Sniffer.py", line 8, in sniff
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)
File "/usr/local/lib/python3.8/dist-packages/scapy/sendrecv.py", line 972, in sniff
sniffer._run(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/scapy/sendrecv.py", line 841, in _run
sniff_sockets[L2socket(type=ETH_P_ALL, iface=iface,
File "/usr/local/lib/python3.8/dist-packages/scapy/arch/linux.py", line 467, in init
self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type)) # noqa: E501
File "/usr/lib/python3.8/socket.py", line 231, in init
_socket.socket.init(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol

@therealkenc
Copy link
Collaborator

self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type)) # noqa: E501
OSError: [Errno 97] Address family not supported by protocol

/dupe #717 #1349 et al.

@ghost
Copy link

ghost commented Jul 10, 2020

Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.

Thanks for your report!

@ghost ghost added the duplicate label Jul 10, 2020
@omarakl
Copy link

omarakl commented Sep 2, 2021

If you are using kali Linux and installing it on a virtual machine then you need to buy a wifi adapter. Or you should install the kali linux on your real machine. Also remove the iface argument from sniff function.

That worked for me

Good luck :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants