32 lines
668 B
Python
32 lines
668 B
Python
import hashlib
|
|
import uuid
|
|
|
|
SSID_HEAD = "LiShuZuoXun-"
|
|
|
|
|
|
def get_computer_name():
|
|
mac = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
|
return mac
|
|
|
|
|
|
def wifi_password_generate(ssid):
|
|
m = hashlib.sha1()
|
|
m.update(ssid.encode())
|
|
# 10层sha1加密
|
|
for i in range(10):
|
|
password_bytes = m.digest()
|
|
m.update(password_bytes)
|
|
password = m.hexdigest()
|
|
return password[0:16]
|
|
|
|
|
|
def wifi_ap_name_generate():
|
|
ssid = SSID_HEAD + hashlib.sha1(get_computer_name().encode()).hexdigest().upper()[0:8]
|
|
return ssid[0:32]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
ssid = wifi_ap_name_generate()
|
|
print(ssid)
|
|
print(wifi_password_generate(ssid))
|