python文件转换为exe |程序运行,但没有输出

j9per5c4  于 2021-09-08  发布在  Java
关注(0)|答案(0)|浏览(326)

我正在创建一个程序,通过保存在计算机上的有关已保存网络的信息运行。如果我忘记了密码,它应该是我可以依靠的东西(就像平常一样)。直接从我的ide(intellij)运行,.py文件为我提供了输出。但是,当我在没有python的计算机上运行它时,它失败了(显然)。所以,我把它转换成了一个.exe文件,并希望这样做。尽管终端运行时没有给出任何可见错误,但它不会输出应该显示的信息。我已将其设置为将终端信息保存到日志中。它记录的只是IP,而不是wifi信息。下面是我编写的python代码以及用于运行它的bat文件(exe和ip抓取程序)。如果您有任何想法想知道为什么这不起作用,我们将不胜感激。
我的python未转换为exe

import subprocess
import re

command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output = True).stdout.decode()

profile_names = (re.findall("All User Profile     : (.*)\r", command_output))

wifi_list = []

if len(profile_names) != 0:
    for name in profile_names:

        wifi_profile = {}

        profile_info = subprocess.run(["netsh", "wlan", "show", "profile", name], capture_output = True).stdout.decode()

        if re.search("Security key           : Absent", profile_info):
            continue
        else:

            wifi_profile["ssid"] = name

            profile_info_pass = subprocess.run(["netsh", "wlan", "show", "profile", name, "key=clear"], capture_output = True).stdout.decode()

            password = re.search("Key Content            : (.*)\r", profile_info_pass)

            if password == None:
                wifi_profile["password"] = None
            else:

                wifi_profile["password"] = password[1]

            wifi_list.append(wifi_profile)

for x in range(len(wifi_list)):
    print(wifi_list[x]) 
enter code here
enter code here

运行输出的bat文件。

@echo off

SET LOGFILE=MyLogFile.log
call :Logit >> %LOGFILE% 
exit /b 0

:Logit
@ipconfig/all | find "IPv6" 
@ipconfig/all | find "IPv4" 

START C:\Users\*******\IdeaProjects\********\.idea\dist\ConfigureWifiPassW.exe

exit

出于安全原因,我已“***”列出了一些目录位置。再一次,任何帮助和洞察都将是惊人的!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题