Created
March 23, 2023 17:56
-
-
Save khr0x40sh/0c0f2513674e3fff715dc6ecae5795a1 to your computer and use it in GitHub Desktop.
HTB:CA2023 Forensics Interstellar python decrypt for phase 1
This file contains 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
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad, unpad | |
### borrowed from https://gist.github.com/lopes/168c9d74b988391e702aac5f4aa69e41 | |
def decrypt(data, key, iv): | |
cipher = AES.new(key, AES.MODE_CBC, iv) | |
return unpad(cipher.decrypt(data[0:]), AES.block_size) | |
key = [0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0] | |
iv = [0,1,1,0,0,0,0,1,0,1,1,0,0,1,1,1] | |
### get the encrypted bytes | |
with open('./destdir/94974f08-5853-41ab-938a-ae1bd86d8e51','rb') as f: | |
bytes = f.read() | |
with open('./phase1.dec','wb') as f: | |
f.write(decrypt(bytes, bytearray(key),bytearray(iv))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment