Crypto - Ice Creamer
Description: Elia’s swamped with algebra but craving a new ice-cream flavor, help him crack these equations so he can trade books for a cone!
nc cramer.ctf.pascalctf.it 5002
We have main.py from the chall.
import os
from random import randint
def generate_variable():
flag = os.getenv("FLAG", "pascalCTF{REDACTED}") # The default value is a placeholder NOT the actual flag
flag = flag.replace("pascalCTF{", "").replace("}", "")
x = [ord(i) for i in flag]
return x
def generate_system(values):
for _ in values:
eq = []
sol = 0
for i in range(len(values)):
k = randint(-100, 100)
eq.append(f"{k}*x_{i}")
sol += k * values[i]
streq = " + ".join(eq) + " = " + str(sol)
print(streq)
def main():
x = generate_variable()
generate_system(x)
print("\nSolve the system of equations to find the flag!")
if __name__ == "__main__":
main()When nc to the challenge we get a long output of equations.

plan for this challenge was to: - Copy the equations from the server output - Build matrix A (coefficients) and vector b (right-hand side) - Solve the linear system - Convert each solution x_i to a character - Wrap the result in pascalCTF{}
Solve.py
Note: THe server output was first put in a file "equations.txt".
FLAG:
pascalCTF{0h_My_G0DD0_too_much_m4th_:O}
Last updated

