Skip to content

Instantly share code, notes, and snippets.

@lttn1204
Created April 9, 2021 14:50
Show Gist options
  • Save lttn1204/ed6cd1b855363f2909f4630f1af38993 to your computer and use it in GitHub Desktop.
Save lttn1204/ed6cd1b855363f2909f4630f1af38993 to your computer and use it in GitHub Desktop.
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import os
key = os.urandom(32)
flag = open("flag","rb").read()
while 1:
try:
i = bytes.fromhex(input("give input: "))
if not i:
break
except:
break
iv = os.urandom(16)
inp = i.replace(b"{}", flag)
if len(inp) % 16:
inp = pad(inp, 16)
print(
AES.new(key, AES.MODE_CBC, iv=iv).decrypt(inp).hex()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment