Смотрел ролик про то, как узнать пароль от WiFi с помощью Python на канале PythonToday. Параллельно писал код в PyCharm.
Код:
import subprocess
def extract_wifi_passwords() -> object:
profiles_date = subprocess.check_output('netsh wlan show profiles').decode('utf-8').split('\n')
# print(profiles_date)
#
# from item in profiles_date
# print(item)
profiles = [i.split(':')[1].strip() for i in profiles_date if 'All User Profile' in i]
# print(profiles)
for profile in profiles:
profile_info = subprocess.check_output(f'netsh wlan show profile {profile} key=clear').decode('utf-8').split('\n')
# print(profile_info)
try:
password = [i/split(':')[1].sprit() for i in profile_info if 'Key Content' in i][1]
except IndexError:
password = None
# print (f'Profiles: {profile}\nPassword: {password}\n{"#" * 20}')
with open(file='wifi_password.txt', mode='a', encoding='utf-8') as file:
file.write(f'Profiles: {profile}\nPassword: {password}\n{"#" * 20}\n')
extract_wifi_passwords()
Не особо разбираюсь в Python, при Run Script выводит такое - 'utf-8' codec can't decode byte 0x81 in position 0: invalid start byte. Помогите как это исправить!
Окно Run:
"C:\PyCharm Projects\WiPassTheft\venv\Scripts\python.exe" "C:/PyCharm Projects/WiPassTheft/wpt.py"
Traceback (most recent call last):
File "C:\PyCharm Projects\WiPassTheft\wpt.py", line 29, in <module>
extract_wifi_passwords()
File "C:\PyCharm Projects\WiPassTheft\wpt.py", line 5, in extract_wifi_passwords
profiles_date = subprocess.check_output('netsh wlan show profiles').decode('utf-8').split('\n')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 0: invalid start byte
Process finished with exit code 1