added few ctfs

This commit is contained in:
2025-05-27 03:40:34 +02:00
parent 9fe7119118
commit e36053882b
62 changed files with 3981391 additions and 18 deletions

View File

@@ -0,0 +1,24 @@
from pwn import remote
import re
from base64 import b64decode
from sympy import factorint
from Crypto.Util.number import bytes_to_long, inverse, long_to_bytes
with remote("d7c40d8ec4e734fe7ac812f9-1338-shadows-of-neon-city.challenge.cscg.live", "1337", ssl=True) as conn:
data = conn.recvuntil(b":\n").decode("utf-8")
print(data)
matches = re.findall(r'(\w+)\s*=\s*([\w/=+]+)', data)
locals().update({key: value if not value.isdigit() else int(value) for key, value in matches})
cipher = bytes_to_long(b64decode(cipher))
p,q = factorint(n).keys()
n = p * q
phi_n = (p-1) * (q-1)
d = inverse(e, phi_n)
plain_int = pow(cipher, d, n)
plaintext = long_to_bytes(plain_int)
conn.sendline(plaintext)
conn.interactive()