Created
March 31, 2020 12:25
-
-
Save Areizen/d014119ae9c0563140feb4ec24fea42e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import zlib | |
import json | |
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad, unpad | |
magic_number = b"ACBJA\x01\x00" | |
def uncipherAES(data : bytes): | |
key = b"" | |
key += b"Iu[Ki}96TZp]pri/"[4:8] | |
key += b"Iu[Ki}96TZp]pri/"[0:4] | |
key += b"Iu[Ki}96TZp]pri/"[12:16] | |
key += b"Iu[Ki}96TZp]pri/"[8:12] | |
aes = AES.new(key, AES.MODE_ECB) | |
padded_output = aes.decrypt(data) | |
return unpad(padded_output,16) | |
def main(filename): | |
with open(filename,'rb') as file: | |
have_magic = file.read(7) == magic_number | |
file_data = b"" | |
if(have_magic): | |
file_data = uncipherAES(file.read()) | |
file_data = zlib.decompress(file_data) | |
else: | |
file_data = file.read() | |
json_object = json.loads(file_data) | |
json_formatted_str = json.dumps(json_object, indent=2) | |
print(json_formatted_str) | |
if __name__ == '__main__': | |
if(len(sys.argv) != 2): | |
print(f"[-] Usage : {sys.argv[0]} <file>") | |
sys.exit(-1) | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment