Skip to content

Instantly share code, notes, and snippets.

@Cyrhades
Created May 1, 2025 17:52
Show Gist options
  • Save Cyrhades/32daef8212788aebfb8ddace093b541c to your computer and use it in GitHub Desktop.
Save Cyrhades/32daef8212788aebfb8ddace093b541c to your computer and use it in GitHub Desktop.
Carotte Radis Tomate
## En construisant un script en python pour récupérer le flag
```py
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
from sympy.ntheory.modular import crt
from Crypto.Util.number import long_to_bytes
n = [17488856370348678479,16548497022403653709,17646308379662286151,14933475126425703583,17256641469715966189]
# les valeurs récupérées dans output.txt
a = [carotte, radis, tomate, pomme, banane]
key_int, _ = crt(n, a)
key_bytes = long_to_bytes(key_int, 32)
E = AES.new(key_bytes, AES.MODE_ECB)
# la valeur encoder
enc = bytes.fromhex("***")
flag = unpad(E.decrypt(enc), 16)
print(flag.decode())
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment