Reputation: 61
i try to create scapy tools to test sniffing, this is my code :
def scan(ip):
arp_req = sc.ARP(pdst=ip)
bc = sc.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_req_bc = bc/arp_req
answer = sc.srp(arp_req_bc, timeout=1, verbose=True)[0]
print("IP\t\t\tMAC Address\n-----------------------")
for element in answer:
print(element[1].psrc + "\t\t" + element[1].hwsrc)
scan("192.168.43.1/24")
the output is :
"Sniffing and sending packets is not available at layer 2: "
RuntimeError: Sniffing and sending packets is not available at layer 2: winpcap is not installed. You may use conf.L3socket orconf.L3socket6 to access layer 3
Upvotes: 5
Views: 14339
Reputation: 1
Initialize the layer 3 sniffer using: conf.L3Socket= L3RawSocket; this would help you in the sniffing process..since a sniffer needs a raw socket to implement its functionality..
Upvotes: 0
Reputation: 1929
Download and Install WinPcap from this link: https://www.winpcap.org/install/ and Run your program again.
Note: You have to close and restart Terminal Window, if You are using Command Line Terminal to run your program.
Upvotes: 1
Reputation: 3
for using scapy module in windows, first you need to install npcap or wincap.
Upvotes: 0