python 查看windows电脑WIFI密码

#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
os.system("netsh wlan show profiles > wifi_list.txt")
with open("wifi_list.txt") as f:
    data = f.readlines()[10:]
    #print(data)
    num = 1
    
    for i in data:
        print(str(num)+"."+i.replace('所有用户配置文件 :',''))
        num += 1
    select = input("请输入WIFI序号:")
    # print(data[int(select)-1].replace('所有用户配置文件 :',''))
    wifiname = data[int(select)-1].replace('所有用户配置文件 :','').replace("   ","").replace("  ","")
    #print(type(wifiname))
    #print(wifiname)
    str = 'netsh wlan show profiles name="{}" key=clear'.format(wifiname).replace('\n','')
    #print(str)
    os.system(str)
    print("WIFI密码请查看【关键内容】!!!")

 

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注