Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jedy
Created June 5, 2020 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedy/60d5559ae80acf6a0414e42995802fc1 to your computer and use it in GitHub Desktop.
Save jedy/60d5559ae80acf6a0414e42995802fc1 to your computer and use it in GitHub Desktop.
read mylogin.cnf
import struct
from Crypto.Cipher import AES
LOGIN_KEY_LEN = 20
MY_LOGIN_HEADER_LEN = 24
MAX_CIPHER_STORE_LEN = 4
f = open(".mylogin.cnf", "rb")
f.seek(4)
b = f.read(LOGIN_KEY_LEN)
key = [0] * 16
for i in range(LOGIN_KEY_LEN):
key[i % 16] ^= b[i]
key = struct.pack('16B', *key)
encryptor = AES.new(key, AES.MODE_ECB)
f.seek(MY_LOGIN_HEADER_LEN)
while True:
b = f.read(MAX_CIPHER_STORE_LEN)
if len(b) < MAX_CIPHER_STORE_LEN:
break
cipher_len, = struct.unpack("<i", b)
b = f.read(cipher_len)
plain = encryptor.decrypt(b)
print(plain[:-plain[-1]])
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment