Недавно начал обучение, помогите пожалуйста.

Петров Никита

Новичок
Пользователь
Фев 9, 2022
1
0
1
Код:
import subprocess


def extract_wifi_passwords():
   # profiles_data = subprocess.check_output('netsh wlan show profiles').decode('utf-8').split('\in')
   # print(profiles_data)
   #
   # for item in profiles_data:
   #     print(item)

    profiles = [i.split(':')[1].strip() for i in profiles_data 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('\in')
    # print(profile_info)

    try:
      password = [i.split(':')[1].strip() for i in profile_info if 'Key Content' in i][0]
    except IndexError:
        password = None

    print(f'profile: {profile}\inPassword: {password}\in{"#" * 20}')

    with open(file='wifi_passwords.txt', mode='a', encoding='utf-8') as file:
      file.write(f'profile: {profile}\inPassword: {password}\in{"#" * 20}\in')


extract_wifi_passwords()



1644403208310.png Не понимаю в чём ошибка.
 

regnor

Модератор
Команда форума
Модератор
Июл 7, 2020
2 672
478
83
до цикла for отступ не верный
 

Форум IT Специалистов