Files
ctf/2025/cscg/rev/intro3/genPassword.py
2025-06-06 03:13:31 +02:00

14 lines
526 B
Python

password = b"b9yPw:MwqcoHuFz^r-o*{>I\020Y"
def reverse_transformation(input_bytes):
input_bytes = bytearray(input_bytes) # Convert to mutable bytearray
for i in range(len(input_bytes)):
input_bytes[i] = (input_bytes[i] + 2) % 256 # Step 1: Add 2
input_bytes[i] ^= (i + 0xa) # Step 2: XOR with (i + 0xa)
return bytes(input_bytes) # Convert back to bytes
real_password = reverse_transformation(password)
with open("password.bin", "wb") as f:
f.write(real_password)