def main(stdin: IStdin, stdout: IStdout): stdout.write( "Just repeat after me. You will figure it out. Secret is one word. Wrap it in donnuCTF{}\n" ) secret = "".join([f"{bin(ord(i))[2:]:0>8s}" for i in "penguins"]) index = 0 print(secret) while True: if secret[index] == '0': word = "" for i in range(4): word += random.choice(ascii_lowercase) stdout.write(word + "\n") answer = stdin.readline().strip() if word != answer: stdout.write("Wrong!\n") return else: word = "" for i in range(5): word += random.choice(ascii_lowercase) stdout.write(word + "\n") answer = stdin.readline().strip() if word != answer: stdout.write("Wrong!\n") return index = (index + 1) % len(secret)
def main(stdin: IStdin, stdout: IStdout): stdout.write('Hello, world!\n') stdout.write('What is your name? ') stdout.flush() name = stdin.readline().strip() stdout.write(f'Hello, {name}!\n')
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you 1000 roman numbers. To get the flag convert each of it to decimal and send back\n" ) stdout.write( "Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.\n" ) stdout.write("I - 1, V - 5, X - 10, L - 50, C - 100, D - 500, M - 1000\n") stdout.write( "For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II.\n" ) stdout.write( "Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:\n" ) stdout.write("\t- I can be placed before V and X to make 4 and 9\n") stdout.write("\t- X can be placed before L and C to make 40 and 90\n") stdout.write("\t- C can be placed before D and M to make 400 and 900\n") for i in range(1000): number = random.randint(1, 3999) roman = int_to_roman(number) stdout.write(f"Number {i + 1}: {roman}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if answer != number: stdout.write("Wrong\n") return None except Exception: stdout.write("Error occurred. Send one number only\n") return None stdout.write( "Congratulations! Your flag: donnuCTF{364e0898e04eb0fd0f97a0381ff50aed}\n" )
def main(stdin: IStdin, stdout: IStdout): stdout.write( "You will be given 100 arrays of integers consisting 2 * n elements in the form [X1, X2, ..., Xn, Y1, Y2, ..., Yn].\n" ) stdout.write( "Return the array in the form [X1, Y1, X2, Y2, ..., Xn, Yn]\n") for i in range(100): l = random.randint(20, 1000) if l % 2: l += 1 arr = [str(random.randint(-1000, 1000)) for _ in range(l)] stdout.write(f"Array {i + 1}: {' '.join(arr)}\n") stdout.write(f"Answer >> ") stdout.flush() answer = stdin.readline().strip().split() if answer != shuffle(arr): stdout.write("Wroong.\n") return stdout.write( "Good job! Your flag is: donnuCTF{c7761b034d20022d7fafb42e14096677}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "Welcome to a classic 'Bulls and Cows' game. You can find rules here: https://ru.wikipedia.org/wiki/Быки_и_коровы\n" ) stdout.write( "To get the flag you have to guess the number in 7 tries or less. Good luck\n" ) digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] number = "" for i in range(4): d = random.choice(digits) digits.remove(d) number += d t = 1 while True: stdout.write(f"Try {t} >> ") stdout.flush() answer = stdin.readline().strip() if len(set(answer)) != len(answer) or len(answer) != 4: stdout.write("You are doing it wrong!\n") t += 1 else: if answer == number: stdout.write( "Yes! That is a number. Your flag: " + open("./src/ctf_tasks/bulls_and_cows/flag.txt").read() + '\n') return bulls = 0 cows = 0 for k in answer: if k in number: if number.index(k) == answer.index(k): bulls += 1 else: cows += 1 stdout.write(f"Bulls: {bulls} Cows: {cows}\n") t += 1 if t > 7: stdout.write("You're out of tries. See ya.\n") return
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you 100 arrays. For each array find the contiguous subarray (containing at least one number) which has the largest sum and sand back its sum\n" ) stdout.write("Example:\n") stdout.write( "For array -2 1 -3 4 -1 2 1 -5 4 largest number is 6 (4 -1 2 1)\n") for i in range(100): array = [ random.randint(-100, 100) for _ in range(random.randint(10, 40)) ] maxSum = largestSubArray(array) stdout.write(f"Array {i + 1}: {' '.join(str(j) for j in array)}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if answer != maxSum: stdout.write("Wrong\n") return None except Exception: stdout.write("Error occurred. Send one number only\n") return None stdout.write( "Congratulations! Your flag: donnuCTF{b2ec60d5c8d9618bc114e1c4c943894f}\n" )
def main(stdin: IStdin, stdout: IStdout): stdout.write("This time you will have to sort an array\n") a = [random.randint(-200, 200) for _ in range(random.randint(10, 30))] stdout.write(f"Array: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != " ".join(map(str, sorted(a))): stdout.write("Wrooong!\n") return stdout.write("Flag: donnuCTF{d1d_u_us3_th3_bubble_s0r7}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write("For given 100 arrays apply the following filters:\n") stdout.write(" - never delete 0\n") stdout.write(" - delete number if it is multiple by 5\n") stdout.write(" - delete number if it is even and is on even position\n") stdout.write(" - delete number if it is odd and is on odd position\n") for i in range(100): a = [random.randint(0, 1000) for _ in range(random.randint(10, 100))] a.append(0) random.shuffle(a) stdout.write(f"Array {i + 1}: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() filtered = apply_filters(a) try: answer = list(map(int, stdin.readline().strip().split(" "))) if filtered != answer: stdout.write("Wroong!\n") return except Exception: stdout.write("Wrong input.\n") return stdout.write("Good job! Flag: donnuCTF{th3_mas73r_of_filt3r1ng}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "To get the flag you need to convert 100 4x4 matrices into 1x16 vector\n" ) stdout.write("Let's go!\n") for _ in range(100): matrix = [random.randint(0, 100) for i in range(16)] for i in range(0, 16, 4): stdout.write( f"{matrix[i]} {matrix[i + 1]} {matrix[i + 2]} {matrix[i + 3]}\n" ) try: stdout.write("Your array >> ") stdout.flush() line = stdin.readline().strip() array = [int(i) for i in line.split(" ")] if array == matrix: stdout.write("Right\n") else: stdout.write("Wrooong. That's another array\n") return except Exception as exception: print(exception) stdout.write("Wrooong. That doesn't look like numbers -_-\n") return stdout.write("Well done! Here's your flag:" + open("src/ctf_tasks/matrix2bytes/flag.txt", 'r').read())
def main(stdin: IStdin, stdout: IStdout): stdout.write( "Welcome to note taker. Here you can save and read up to 10 your notes\n\n" ) while True: stdout.write("Choose the option to perform:\n") stdout.write("\t1. Get new token\n") stdout.write("\t2. Add the note\n") stdout.write("\t3. Get my notes\n") stdout.write("\t4. Exit\n") stdout.write(">> ") option = stdin.readline().strip() if option == '1': token = generateToken() stdout.write(f"Your token: {token}\n\n") if option == '2': stdout.write(f"Enter your token >> ") try: token = stdin.readline().strip() except Exception: stdout.write("Token has wrong format!\n") continue stdout.write(f"Enter your note >> ") note = stdin.readline().strip() if addNote(token, note): stdout.write("Your note successfully saved!\n\n") else: stdout.write("Failed to save your note, token is wrong!\n\n") if option == '3': stdout.write(f"Enter your token >> ") try: token = stdin.readline().strip() except Exception: stdout.write("Token has wrong format!\n") continue stdout.write("\nNotes for given token: \n") for i, note in enumerate(getNotes(token)): stdout.write(f"{i}: {note}\n\n") if option == '4': break
def main(stdin: IStdin, stdout: IStdout): stdout.write("This time you will have to sort 100 arrays\n") for i in range(100): a = [random.randint(-200, 200) for _ in range(random.randint(10, 30))] stdout.write(f"Array {i + 1}: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != " ".join(map(str, sorted(a))): stdout.write("Wrooong!\n") return stdout.write("Flag: donnuCTF{kinda_s0r71ng_sta710n}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write("To get the flag you need to perform shift or inverse shift to the given 100 4x4 matrices\n") stdout.write("First line is operation to perform: 1 - to shift forward, 2 - to inverse shift\n") stdout.write("Next four lines will be the matrix\n") stdout.write("Send answers as a 1x16 vectors\n") stdout.write("Let's go!\n") for k in range(100): stdout.write(f"Round {k + 1}:\n") operation = random.randint(1, 2) stdout.write(f"{operation}\n") matrix = [] for i in range(4): matrix.append([random.randint(0, 100) for _ in range(4)]) stdout.write(f"{matrix[i][0]} {matrix[i][1]} {matrix[i][2]} {matrix[i][3]}\n") if operation == 1: matrix = shift_rows(matrix) elif operation == 2: matrix = inv_shift_rows(matrix) try: stdout.write("Your array >> ") stdout.flush() line = stdin.readline().strip() right_answer = "" for i in range(4): right_answer += " ".join([str(i) for i in matrix[i]]) + " " if line == right_answer.strip(): stdout.write("Right\n") else: print(right_answer) stdout.write("Wrooong. That's another array\n") return except Exception as exception: print(exception) stdout.write("Wrooong. That doesn't look like numbers -_-\n") return stdout.write("Well done! Here's your flag:" + open("src/ctf_tasks/permutation/flag.txt", 'r').read())
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I am thinking of the number in range 1 - 100. Can you guess it in 7 or less tries?\n" ) counter = 7 c = 1 n = random.randint(1, 100) while True: stdout.write(f"Try {c} >> ") stdout.flush() t = int(stdin.readline().strip()) if t == n: stdout.write( "Yeah, that's the number! Your flag: " + open("./src/ctf_tasks/guess_the_number/flag.txt", 'r').read() + "\n") return else: if t < n: stdout.write("Higher\n") else: stdout.write("Less\n") counter -= 1 c += 1 if counter == 0: stdout.write("You are out of tries. Good luck next time\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "Find max in the array I will send you and send it back to me\n") a = [random.randint(-100, 100) for _ in range(random.randint(10, 40))] stdout.write(f"Array: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if answer != max(a): stdout.write("Wrooong.\n") return except Exception: stdout.write("Wrong input!\n") return stdout.write("Good job. Flag: donnuCTF{lin3ar_s3arch_it_is}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you an array of positive numbers, you should send back count of numbers in the array with even number of digits in them.\n" ) count = 0 a = [random.randint(2**2, 2**64) for _ in range(random.randint(10, 50))] for c in a: if not (len(str(c)) % 2): count += 1 stdout.write(f"Array: {' '.join(list(map(str, a)))}\n") stdout.write("Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != str(count): stdout.write("Wrooong!\n") return stdout.write("Good job! Flag: donnuCTF{so_y0u_can_count}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "Find max in the arrays I will send you and send it back to me. There will be 100 arrays\n" ) for i in range(100): a = [random.randint(-100, 100) for _ in range(random.randint(10, 40))] stdout.write(f"Array {i + 1}: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if answer != max(a): stdout.write("Wrooong.\n") return except Exception: stdout.write("Wrong input!\n") return stdout.write("Good job. Flag: donnuCTF{ha_c1assic}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "In this task you will need to convert given array into a single hex string 100 times\n" ) for i in range(100): a = [random.randint(0, 255) for _ in range(random.randint(10, 100))] stdout.write(f"Array {i + 1}: {' '.join(map(str, a))}\n") stdout.write("Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != "".join([hex(j)[2:] for j in a]): stdout.write("Wrong!\n") return stdout.write("Flag: donnuCTF{just_h3xlify}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you 100 arrays. For each array check if the array is a mountain array and return 1 if it is a mountain or 0 otherwise\n" ) stdout.write( "Array is a mountain array if there is an index i (peak of the array) such that:\n" ) stdout.write("\t- for any j < i array[j] < array[j + 1]\n") stdout.write("\t- for any k > i array[k] < array[k - 1]\n") for i in range(100): array, is_mountain = generate_array() stdout.write(f"Array {i + 1}: {' '.join(str(j) for j in array)}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if (answer and not is_mountain) or (not answer and is_mountain): stdout.write("Wroong\n") return None except Exception: stdout.write("Error occurred.Send only 1 or 0 as an answer\n") return None stdout.write("Congratulations! Your flag: donnuCTF{reached_th3_peak}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write("Hi, in this task you need to solve 100 quadratic equations to get the flag\n") stdout.write("I will send coefficients as three numbers and you should send the answer back\n") stdout.write("Example: 2, 5, 2 is for equation 2 * x^2 + 5 * x + 2 = 0\n") stdout.write("And the answer will be: -2 -0.5. Round answers to two decimal places stripping zeros\n") for i in range(100): a, b, c, x1, x2 = generate_equation() stdout.write(f"Equation {i + 1}: {a}, {b}, {c}\n") stdout.write(f"Answer >> ") stdout.flush() try: a1, a2 = tuple(map(float, stdin.readline().strip().split(" "))) if str(round(a1, 2)) != str(round(x1, 2)) and str(round(a1, 2)) != str(round(x2, 2)): stdout.write("Wrooong.\n") return if str(round(a2, 2)) != str(round(x1, 2)) and str(round(a2, 2)) != str(round(x2, 2)): stdout.write("Wrooong.\n") return except Exception: stdout.write("Wrong input!\n") return stdout.write("Congratulations. Your flag is: donnuCTF{back_2_sch00l}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "You will be given 100 integers N. For each N return array containing N unique integers such that they add up to 0.\n" ) for i in range(100): l = random.randint(1, 100) stdout.write(f"Number {i + 1}: {l}\n") stdout.write(f"Answer >> ") stdout.flush() answer = sum(list(map(int, stdin.readline().strip().split()))) if answer: stdout.write("Wroong.\n") return stdout.write( "Good job! Your flag is: donnuCTF{495818deb0ac365473fd51033e3fa8fb}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write( "Hi! I am The Riddler! I have a flag for you, but you have to answer a few questions about AES to get it. So, should we start?\n" ) for i in range(5): stdout.write(questions[i] + "\n") stdout.write("Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != answers[i]: stdout.write("No it's not. See ya.\n") return stdout.write( f"Good job. Here's your flag: {open('./src/ctf_tasks/riddler/flag.txt', 'r').read().strip()}\n" )
def main(stdin: IStdin, stdout: IStdout): stdout.write( "To get the flag you will need to calculate the Hamming distance of two numbers 100 times.\n" ) stdout.write( "Hamming distance is number of bits at which two numbers differ.\n") stdout.write( "Example: for 3 (011) and 5 (101) Hamming distance equals 2\n") for i in range(100): x, y = random.randint(1, 2**32), random.randint(1, 2**32) stdout.write(f"Round {i + 1}: {x} {y}\n") stdout.write("Answer >> ") stdout.flush() try: answer = int(stdin.readline().strip()) if answer != hamming_distance(x, y): stdout.write("Wrooong\n") return None except Exception: stdout.write("You must answer with a single number\n") return None stdout.write("Congratulations! Your flag is donnuCTF{x0r_15_th3_answer}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write("To get the flag you need to encrypt or decrypt 100 blocks of data with AES using ECB mode\n") stdout.write("You will receive 3 lines for each round\n") stdout.write("First line will contain operation to perform: 1 - encrypt, 2 - decrypt\n") stdout.write("Second line will contain key as a hexadecimal string\n") stdout.write("Third line will contain hexadecimal string to perform operation on\n") stdout.write("Let's go!\n") for k in range(100): stdout.write(f"Round {k + 1}:\n") operation = random.randint(1, 2) stdout.write(f"{operation}\n") key = os.urandom(16) data = os.urandom(16) stdout.write(f"{key.hex()}\n") stdout.write(f"{data.hex()}\n") required = "" if operation == 1: required = AES.new(key, AES.MODE_ECB).encrypt(data).hex() elif operation == 2: required = AES.new(key, AES.MODE_ECB).decrypt(data).hex() try: stdout.write("Your answer >> ") stdout.flush() answer = stdin.readline().strip() if required == answer: stdout.write("Right\n") else: stdout.write("Wrooong. Your answer is incorrect\n") return except Exception as exception: print(exception) stdout.write("Wrooong. Exception occurred processing your answer\n") return stdout.write("Well done! Here's your flag:" + open("src/ctf_tasks/full_aes/flag.txt").read())
def main(stdin: IStdin, stdout: IStdout): stdout.write( "To get the flag you need to add 100 4x4 round key matrices to the 4x4 state matrix\n" ) stdout.write("Send answers as a 1x16 vectors\n") stdout.write("Initial state:\n") initial_state = [random.randint(1, 50) for _ in range(16)] for i in range(0, 16, 4): stdout.write( f"{initial_state[i]} {initial_state[i + 1]} {initial_state[i + 2]} {initial_state[i + 3]}\n" ) for k in range(100): stdout.write(f"Round key {k + 1}:\n") round_key = [random.randint(51, 99) for _ in range(16)] for i in range(0, 16, 4): stdout.write( f"{round_key[i]} {round_key[i + 1]} {round_key[i + 2]} {round_key[i + 3]}\n" ) initial_state = [initial_state[i] ^ round_key[i] for i in range(16)] try: stdout.write("Your array >> ") stdout.flush() answer = stdin.readline().strip() array = [int(i) for i in answer.split(" ")] if array == initial_state: stdout.write("Right\n") else: stdout.write("Wrooong. That's another array\n") return except Exception as exception: print(exception) stdout.write("Wrooong. That doesn't look like numbers -_-\n") return stdout.write("Well done! Here's your flag:" + open("src/ctf_tasks/add_round_key/flag.txt", 'r').read()) stdout.flush()
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you 100 strings and you must reverse them and send back to me to get the flag\n" ) for i in range(100): s = "".join( [random.choice(alphabet) for _ in range(random.randint(10, 100))]) stdout.write(f"String {i + 1}: {s}\n") stdout.write(f"Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != "".join(reversed(s)): stdout.write("Wroong!\n") return stdout.write("Nice! Flag: donnuCTF{r3v3rsa1_1s_wha7_i_d0}\n")
def main(stdin: IStdin, stdout: IStdout): stdout.write("Hi, do you like music? I, myself, love it! But those note sheets are just too complicated. All those clefs and time signatures and there are so much lines! So I came up with another system. Let me explain.\n") stdout.write("1) All notes are represented by letters C, D, E, F, G, A and B. Letter 'P' is used for pauses\n") stdout.write("2) Next to the letter there is a number showing which octave it is (you will find octaves numbers here https://en.wikipedia.org/wiki/octave). Example: C5\n") stdout.write("3) Also note can be followed by # to raise it by a half tone. Example: A5#\n") stdout.write("4) After that there is a slash ('/') followed by a note's length (1 - is a whole note, 2 - 1/2 of the whole, 4 - 1/4 of the whole etc.). Example: D4#/2\n") stdout.write("5) Moreover, to increase note's length by a half dot ('.') is used. Like this: F3#/4.\n") stdout.write("6) Also note length might be expressed by a numbers sum within the parentheses like 'B2/(2+4)'. This means the note length is equals to two notes (B2/2 and B2/4) together. That's a tie in standard music theory.\n") stdout.write("7) And at the very beginning of the line there is a time signature. (3x4) is for 3 1/4 notes per bar (waltz time signature).\n") stdout.write("8) So here is an example of a whole line:\n") stdout.write("\t(4x4) C4/4 D4/4 E4/4 F4/4 G4/4 A4/4 B4/4\n") stdout.write("Pretty easy isn't it? Now I will send you 10 melodies written in such notation. Try to guess what melody it is. For every guessed melody you will get the flag for 2 points.\nThat makes 20 points for the whole task. Now let's go. BTW, answers are case insensetive\n") stdout.write("\n") for i in range(11): stdout.write(guess[i]) stdout.write("Answer >> ") stdout.flush() answer = stdin.readline() if answer.lower().strip() == songs[i].lower().strip(): stdout.write("That's right! Go for the next one. Here is your flag: " + open(flags[i]).read() + "\n") stdout.write("\n") else: print(f"Should be {songs[i]} but {answer.lower().strip()} received") stdout.write("Nope!\n") exit(0)
def main(stdin: IStdin, stdout: IStdout): stdout.write( "To get the flag you need to apply the following S-box (16x16 hex matrix) to 100 4x4 matrices\n" ) stdout.write("Send answers as 1x16 vectors\n") stdout.write("S-box:\n") for i in range(0, 256, 16): stdout.write( f"{inv_s_box[i]:>02x} {inv_s_box[i + 1]:>02x} {inv_s_box[i + 2]:>02x} {inv_s_box[i + 3]:>02x} " f"{inv_s_box[i + 4]:>02x} {inv_s_box[i + 5]:>02x} {inv_s_box[i + 6]:>02x} {inv_s_box[i + 7]:>02x} " f"{inv_s_box[i + 8]:>02x} {inv_s_box[i + 9]:>02x} {inv_s_box[i + 10]:>02x} {inv_s_box[i + 11]:>02x} " f"{inv_s_box[i + 12]:>02x} {inv_s_box[i + 13]:>02x} {inv_s_box[i + 14]:>02x} {inv_s_box[i + 15]:>02x}\n" ) for l in range(100): stdout.write(f"Matrix {l + 1}:\n") matrix = [random.randint(0, 255) for i in range(16)] for i in range(0, 16, 4): stdout.write( f"{matrix[i]} {matrix[i + 1]} {matrix[i + 2]} {matrix[i + 3]}\n" ) matrix = [inv_s_box[i] for i in matrix] try: stdout.write("Your array >> ") stdout.flush() line = stdin.readline().strip() array = [int(i) for i in line.split(" ")] if array == matrix: stdout.write("Right\n") else: stdout.write("Wrooong. That's another array\n") return except Exception as exception: print(exception) stdout.write("Wrooong. That doesn't look like numbers -_-\n") return stdout.write("Well done! Here's your flag:" + open("src/ctf_tasks/sbox/flag.txt", 'r').read())
def main(stdin: IStdin, stdout: IStdout): stdout.write( "I will send you a string and you must reverse it and send back to me to get the flag\n" ) s = "".join( [random.choice(alphabet) for _ in range(random.randint(10, 100))]) stdout.write(f"String: {s}\n") stdout.write(f"Answer >> ") stdout.flush() answer = stdin.readline().strip() if answer != "".join(reversed(s)): stdout.write("Wroong!\n") return stdout.write("Nice! Flag: donnuCTF{unr3adable_3ith3r_way}\n")