Python: fake access point script

With the python script in this article you can create a fake access point. I didn’t make the script myself. I’m not sure where it’s originally from. In order to execute this script successfully you need a wifi adapter and put it in monitor mode first. This video explains how to do that.

What is a fake access point?

A fake AP is an access point that’s not part of a home network, hotel or train but was created by a hacker. Fake access points are often open, meaning that you don’t need a password to connect to them.

Why would someone create a fake access point?

Hackers can create fake access points and try to make people connect to them. When they are connected the hacker has several options to steal information or intercept traffic. For example he could redirect requests to facebook to a fake facebook page made by the hacker. When they log in he receives the login credentials.

Explanation of the code

This is the complete script:

Now let’s break it down bit by bit.

In this part you import all functions from the scapy module and set the name of the adapter in monitor mode. When an adapter is put in monitor mode usually ‘mon’ is added to the name, so ‘wlan0’ would become ‘wlan0mon’.

Then we generate a random MAC address for the fake access point and give the access point a name.

Here the dot11 layer of the packet is created. The dot11 layer must be in packets that are sent over wifi.

Now the beacon layer and essid layer are created. The essid contains the information about the access point.

All layers that were just made are now combined into one packet and saved in the variable ‘frame’. The packets are sent using sendp(). ‘Loop’ is set to 1, which means it will keep sending packets.

The packets are broadcasted to the surrounding to let other devices know there is a new access point.

The packets are sent via the data link layer.

Executing the script

The fake AP has now appeared among the available access points.

Leave a Comment

Your email address will not be published. Required fields are marked *