asive
asive

Reputation: 1

Trying to connect to a wifi network with a list of simple passwords with python

I have writen a script in python to attempt to connect to a defined wifi network with a list of simple passwords.

import wifimangement_linux as wifi              
import os

wifiname = input("Enter Wifi SSID: ")

print("Wifi not stored, testing password...")
file = open('/home/asive/Documents/seclists/wordlists/passwords.lst', 'r')
line = file.readlines()
for i in line:
    try:
        print("Testing Key " + i.strip())
        stream = os.popen("iwconfig wlan0 essid " +  wifiname() + " key s:" + i.strip())
    except:
        print (i.strip() + " failed, trying next.")
    else:
        print ("Success Key==" + i.strip())

The script only runs through the program seemingly without trying to connect.

i've tried using subprocess instead of os and running in root, including adding sudo to the bash command. What am i doing wrong?

Upvotes: 0

Views: 264

Answers (0)

Related Questions