Insane Bolt
4 minutes to read
We have this game:
$ nc 206.189.125.243 30182
1. Instructions
2. Play
> 1
🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩
🔩 🔩
🔩 [*] Help the 🤖 reach the 💎. 🔩
🔩 [*] You need to find the shortest route. 🔩
🔩 [*] You need to collect 500 💎 and at least 5000 🔩. 🔩
🔩 [*] The solution should be given in the format: DLR (Down, Left, Right) 🔩
🔩 🔩
🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩 🔩
1. Instructions
2. Play
> 2
🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥
🔥 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🤖 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ 🔩 🔩 🔩 🔩 🔩 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ ☠️ ☠️ ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ 🔩 🔩 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔩 🔩 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ 🔩 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 ☠️ 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔩 🔩 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 💎 ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ ☠️ 🔥
🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥
>
We need to provide some instructions so that the robot (🤖) finds the diamond (💎) and collects some screws (🔩). Since we need to do this process 500 times, we must use a path finding algorithm.
For instance, we can use Depth First Search (DFS):
movements = {
(0, 1): 'R',
(0, -1): 'L',
(1, 0): 'D',
}
final_path = ''
def dfs(root, maze, visited, path=''):
global final_path
if -1 in root or len(maze) <= root[0] or len(maze[0]) <= root[1]:
return
if maze[root[0]][root[1]] == '💎' and final_path == '':
final_path = path
visited.add(root)
for movement in [(1, 0), (0, -1), (0, 1)]:
node = (root[0] + movement[0], root[1] + movement[1])
if -1 in node or len(maze) <= node[0] or len(maze[0]) <= node[1]:
continue
if node not in visited and maze[node[0]][node[1]] != '☠️':
dfs(node, maze, visited.copy(), path + movements[movement])
So, we only need to parse the maze and use the DFS algorithm on each round:
def main():
global final_path
if len(sys.argv) != 2:
log.warning(f'Usage: python3 {sys.argv[0]} <host:port>')
exit(1)
host, port = sys.argv[1].split(':')
r = remote(host, int(port))
r.sendlineafter(b'> ', b'2')
prog = log.progress('Round')
for round in range(500):
prog.status(str(round + 1))
r.recvline()
maze = list(map(
lambda s: s.split()[1:-1],
r.recvuntil(b'\n\n').strip().decode().splitlines()
))[1:-1]
j = maze[0].index('🤖')
dfs((0, j), maze, {(0, j)})
r.sendlineafter(b'> ', final_path.encode())
final_path = ''
r.recvline()
prog.success(str(round + 1))
print(r.recv().decode())
r.close()
Using this solution script: solve.py
we can obtain the flag:
$ python3 solve.py 206.189.125.243:30182
[+] Opening connection to 206.189.125.243 on port 30182: Done
[+] Round: 500
[+] You have 10016 🔩 !
[+] Congratulations! This is your reward!
HTB{w1th_4ll_th353_b0lt5_4nd_g3m5_1ll_cr4ft_th3_b35t_4ndr01d_3v3r!!!}
[*] Closed connection to 206.189.125.243 port 30182