Search code examples
pythonwindowsnetworkingscapypacket-sniffers

Wifi interface for windows


This ARP spoofing script is taken from the book "Black hat python" by Justin Seitz (2014). Since it is written for Linux, how could you find the right interface if you were to use it on Windows?

from scapy.all import *
import os, sys, threading, signal

interface = "wlan0"

(...)

# set our interface
conf.iface = interface

# turn off output
conf.verb = 0

print(("[*] Setting up %s" % interface))

(...)

try:
    print(("[*] Starting program for %d packets" % packet_count))
    bpf_filter = "ip host %s" % target_ip
    packets = sniff(count=packet_count, filter=bpf_filter, iface=interface)

Thank you :)


Solution

  • On windows, the scapy libraries detects your interfaces and store them in an IFACES variable.

    After having installed/downloaded scapy, start the scapy shell (command: scapy if it you have downloaded it manually, run_scapy.bat) and type IFACES

    It will give you the list of the installed interfaces. You can then either use

    • interface = "[The full interface name as shown in scapy]"
    • interface = IFACES.dev_from_index([the index of the interface as shown by scapy])

    If you don’t have other interfaces than the WiFi one, you can even use interface = conf.iface