Python fake access point - problem with finding working iface attribute on scapy

Viewed 13

I'm trying to create a fake access point using Python (scapy library) on Windows 10. I followed a tutorial and everything should work but the only issue is the iface attribute. I get an error when I'm trying to put what I saw on the tutorial. My code:

from scapy.all import *
from scapy.layers.dot11 import Dot11, Dot11Beacon, Dot11Elt, RadioTap

iface = "wlan0mon"
print(iface)

fake_mac = RandMAC()

# Name of the fake access point
ssid = "free_wifi"

frame = Dot11(type=0, subtype=8, addr1="ff:ff:ff:ff:ff:ff", addr2=fake_mac, addr3=fake_mac)

# Beacon layer
beacon = Dot11Beacon()

# Put all properties in the frame
essid = Dot11Elt(ID="SSID", info=ssid, len=len(ssid))

# Connect all layers together
frame = RadioTap() / frame / beacon / essid

# Send the packet to the network every 100ms
sendp(frame, iface=iface, inter=0.1, loop=1)

The error in line:

sendp(frame, iface=iface, inter=0.1, loop=1)

About the iface:

iface = "wlan0mon"

The error:

OSError: b'wlan0mon: No such device exists (No such device exists)'

What should I put in to make it work?

I tried:

iface = conf.iface

Not like in the tutorial. It works but I can't see the hotspot on another device.

0 Answers
Related