-
Notifications
You must be signed in to change notification settings - Fork 1
/
wifi-decrypt.py
36 lines (28 loc) · 1004 Bytes
/
wifi-decrypt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env nix-shell
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ pycrypto ])"
from Crypto.Cipher import AES
from binascii import b2a_hex
from Crypto.Util.Padding import pad, unpad
# PADDING_SIZE = AES.block_size
PADDING_SIZE = 32
encKey = bytes.fromhex("331248f9789959003729fa90cf16882f")
iv = bytes.fromhex("82931267f734a879b3c4c4b15fda4be7")
def encrypt(msg):
c = AES.new(encKey, AES.MODE_CBC, iv)
msg = msg.ljust(PADDING_SIZE, bytes.fromhex("00"))
return c.encrypt(msg)
def decrypt(cipher):
c = AES.new(encKey, AES.MODE_CBC, iv)
return c.decrypt(cipher)
# msg = b"BananaNet122333"
# # decrypt PSK
# psk = encrypt(msg)
# print(len(psk), b2a_hex(psk))
hash = "5ADAE1EC79BFFA56FE23D1C3EA063F94A07C91BDF7216CEE25C845155278C9EC"
psk = decrypt(bytes.fromhex(hash))
print("Decrypting", hash)
print(psk)
hash = "81044667B2C669BB08A1E270B4C3FE253FF4020E31BBD8D83564A7F7D6712E26"
psk = decrypt(bytes.fromhex(hash))
print("Decrypting", hash)
print(psk)