Код:
import subprocess
def extract_wifi_password():
profiles_data = subprocess.check_output('netsh wlan show profiles').decode('utf-8').split('\n')
profiles = [i.split(':')[1].split() for i in profiles_data if 'All User Profile' in i]
for profile in profiles:
profile_info = subprocess.check_output(f'netsh wlan show profile {profile} key=clear').decode('utf-8').split('\n')
try:
password = [i.split(':')[1].split() for i in profile_info if 'Key Content' in i][0]
except IndexError:
password = None
print(f'Profile: {profile}\nPassword: {password}\n{"#" * 20}')
extract_wifi_password()
Ошибка:
Traceback (most recent call last):
File "C:\ooo.py", line 17, in
extract_wifi_password()
File "C:\ooo.py", line 4, in extract_wifi_password
profiles_data = subprocess.getoutput('netsh wlan show profiles').decode('utf-8').split('\n')
AttributeError: 'str' object has no attribute 'decode'