Rating:

```
#!/usr/bin/env python3

* snowcrash
* [email protected]
* https://github.com/snowcra5h/

from pwn import *
from base64 import b64decode as decode
from base64 import b64encode as encode

def do_xor(inp, even):
result = []
if (even):
print("[*] Got even secret")
key = [0xde, 0xad, 0xbe, 0xef, 0xc0, 0xc0, 0xda, 0xda]
else:
print("[*] Got odd secret")
key = [0xca, 0xca, 0xfe, 0xed, 0xca, 0xca, 0xf0, 0x0d]
c = 0
for i in inp:
result.append(i ^ key[c % 8])
c += 1
return bytes(result)

conn = remote("pwn64.ctf.ihack.computer", 5678)
rand = conn.recvuntil(b'\n')
rand_decoded = decode(rand)
no_bytes = len(rand_decoded)
rand_int = int.from_bytes(rand_decoded, 'big')
print(f"[+] Yo we got {hex(rand_int)} {no_bytes} bytes long")
result = do_xor(rand_decoded, 0 if no_bytes & 1 else 1)
no_bytes = len(result)
result_int = int.from_bytes(result, 'big')
print(f"[+] password {hex(result_int)} is {no_bytes} bytes long")
send_back = encode(result)
print(f"[+] sending back: {send_back}")
conn.recvuntil(b':')
conn.send(send_back)
conn.send(b'\n')
conn.recvuntil(b':\n')
flag = conn.recvuntil(b'\n').decode()
print(f"[+] Flag: {flag}")
```

Original writeup (https://github.com/snowcra5h/).