Tags: algorithms python programming 

Rating:

```
from pwn import *

def sort_bubble(x):
s = ''
for i in range(len(x)):
for j in range(len(x) - 1):
if x[j] > x[j + 1]:
x[j], x[j + 1] = x[j + 1], x[j]
s = s + 's '
s = s + 'c '
s = s + 'c '
return s.strip()

nc = remote('challenges.ctfd.io', 30267)
nc.sendlineafter('Enter 1, 2, 3, 4, or 5.\n', '3')
nc.recvline()
nc.recvline()
nc.recvline()
nc.recvline()
x = nc.recvline().decode().strip().replace(' ', '').split(',')
nc.recv()
nc.sendline(sort_bubble(x))
print(nc.recvline().decode())
x = nc.recvline().decode().strip().replace(' ', '').split(',')
nc.sendline(sort_bubble(x))
print(nc.recv().decode())
```
```
[x] Opening connection to challenges.ctfd.io on port 30267
[x] Opening connection to challenges.ctfd.io on port 30267: Trying 159.203.148.124
[+] Opening connection to challenges.ctfd.io on port 30267: Done
Here's what the robot did:

???????? That's correct!! ????????
nactf{1t_t4k35_tw0_t0_m4n90_8a51c7b47fbe227}
```
```
nactf{1t_t4k35_tw0_t0_m4n90_8a51c7b47fbe227}
```