Rick has been captured by the council of ricks and in this dimmention morty has to save him, the chamber holding rick needs a key . Can you help him find the key ?
In summary, the main function has a while loop which on each iteration prints two random numbers (a and b), then it accepts an input x and checks if function2(function1(a, b) + 3). On closer inspection, it is clear that function1 is gcd and function2 is factorial. So we have to keep reading inputs and provide the right answers to print the flag. This cannot be done manually because there's a time check, so had to use pwntools:
1 2 3 4 5 6 7 8 9 10 11 12 13
from pwn import * from math import gcd, factorial io = remote('chall.csivit.com', 30827) while io.can_recv(1) == True: inp = io.recvline() inp = inp.decode() if inp.split(' ')[0] == 'fun()': break a, b = inp.split(' ') a = int(a) b = int(b) io.sendline(str(factorial(gcd(a,b) + 3))) print(io.recvall())