Base information
CTF name: Nixu Challenge
Challenge name: numb3rs
Challenge description: Hello, friend. You don’t know me, but I know you. I want to play a game. There is only one combination of numbers that gives you the answer. Know what to do. You better hurry up. Make your choice.
Target: nc numb3rs.thenixuchallenge.com 1337
Challenge category: Scripting
Challenge points: 50
Year: 2020
Solution
When connected you must give correct unchanging numbers in response. If provided number was correct, you get asked another number, if false you will be given the next number, and you must start from the beginning. Although the challenge could be solved manually, there are quite a many numbers, so we want a way to automate this process of finding the correct numbers. After few rounds I came up with this one line script:
for run in {1..100}; do while read -r line; do if [[ $line =~ '^[0-9]+$' ]]; then sleep 0.5; echo "$line";fi; done < msg1.txt | nc numb3rs.thenixuchallenge.com 1337 > msg2.txt; cp msg2.txt msg1.txt; echo 1 >> msg1.txt; tail msg1.txt; done