Tags: n1tp ctk ctf
Rating:
# Challenge N1TP
CTK MTA
We easily notice this challenge using One Time Pad to encode
##### You can read more about One Time Pad here:
[One time pad](https://en.wikipedia.org/wiki/One-time_pad)
### This is my code :
```
from pwn import *
from binascii import hexlify, unhexlify
connect = remote("challenge.ctf.games" ,31921)
connect.recvline('NINA: Hello! I found a flag, look!')
encrypted_flag = connect.recvline().decode().strip()
# print(encrypted_flag)
fake_flag = "flag{90bc54705794a62015369fd8e86e557b}"
connect.sendlineafter(b">", fake_flag.encode())
connect.recvline('NINA: Ta-daaa!! I think this is called a \'one\' \'time\' \'pad\' or something?')
enc_fake =connect.recvline().decode().strip()
def decode(encflag, encfake,fake):
fake = int(hexlify(fake.encode()),16)
encflag = int(encflag,16)
encfake = int(encfake,16)
dec = hex(fake^encfake^encflag)
print(bytearray.fromhex(dec[2:]).decode())
decode(encrypted_flag,enc_fake,fake_flag)
```
And Flag is flag{9276cdb76a3dd6b1f523209cd9c0a11b}