diff --git a/README.md b/README.md index cf40527..eb4da19 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,12 @@ LGLAF.py depends on: - Python 2.7 or 3: https://www.python.org/ - (Windows) LG driver, - [LGMobileDriver\_WHQL\_Ver\_4.0.3.exe](http://18d5a.wpc.azureedge.net/8018D5A/tool/dn/downloader.dev?fileKey=UW00120120425) - (12986920 bytes, - sha256sum: 86e893b7f5da7f7d2656d9ce2563f082271983bb63903d0ed5cb279c560db459) + [LGMobileDriver\_WHQL\_Ver\_4.2.0.exe](http://oceanhost.eu/wylc5rg7a8ou/LGMobileDriver_WHQL_Ver_4.2.0.exe.htm) + (16691672 bytes, + sha256sum: d78ae6dfe7d34b9cabb8c4de5c6e734b6fed20b513d0da0183871bd77abba56c), + **WARNING**: This file was found via google search, it's not downloaded directly from LG servers - (Linux) PyUSB: https://walac.github.io/pyusb/ + - Cryptography library: https://cryptography.io/en/latest/ On Linux, you must also install [rules.d/42-usb-lglaf.rules](rules.d/42-usb-lglaf.rules) to `/etc/udev/rules.d/` diff --git a/laf_crypto.py b/laf_crypto.py index 16d87eb..bb025a2 100644 --- a/laf_crypto.py +++ b/laf_crypto.py @@ -1,11 +1,15 @@ -from Crypto.Cipher import AES +import struct +from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes +from cryptography.hazmat.backends import default_backend from lglaf import int_as_byte def key_transform(old_key): new_key = b'' + old_key = bytearray(old_key) for x in range(32, 0, -1): - new_key += int_as_byte(old_key[x-1] - (x % 0x0C)) + c = old_key[x-1] + new_key += int_as_byte(c - (x % 0x0C)) return new_key @@ -13,11 +17,10 @@ def xor_key(key, kilo_challenge): # Reserve key key_xor = b'' pos = 0 + challenge = struct.unpack('>I', kilo_challenge)[0] for i in range(8): - key_xor += int_as_byte(key[pos] ^ kilo_challenge[3]) - key_xor += int_as_byte(key[pos + 1] ^ kilo_challenge[2]) - key_xor += int_as_byte(key[pos + 2] ^ kilo_challenge[1]) - key_xor += int_as_byte(key[pos + 3] ^ kilo_challenge[0]) + k = struct.unpack('