Addition
Posted on Mon 05 August 2024 in ctf
This is a writeup of the misc challenge Addition in the n00bz CTF 2024.
The attached server.py
contained the following code:
import time
import random
questions = int(input("how many questions do you want to answer? "))
for i in range(questions):
a = random.randint(0, 10)
b = random.randint(0, 10)
yourans = int(input("what is " + str(a) + ' + ' + str(b) + ' = '))
print("calculating")
totaltime = pow(2, i)
print('.')
time.sleep(totaltime / 3)
print('.')
time.sleep(totaltime / 3)
print('.')
time.sleep(totaltime / 3)
if yourans != a + b:
print("You made my little brother cry ðŸ˜")
exit(69)
f = open('/flag.txt', 'r')
flag = f.read()
print(flag[:questions])
We can skip the whole for loop by stating that we want to anser -1
questions: