All About Timing

Description

I'm always late for class but my prof told me that time is relative Comment Suggest edit

Author: jloh02

nc challs.nusgreyhats.org 31111

https://storage.googleapis.com/greyctf-challs/dist-All-About-Timing.zip


Code Analysis

import time
import random

random.seed(int(time.time()))

print("Guess the number I'm thinking of? It's all about the timing")
x = input("Your guess:")

n = random.randint(1000000000000000, 10000000000000000-1)

if int(x) == n:
    with open("flag.txt") as f:
        print(f.readline())
else: 
    print(f"Wrong answer! The number I was thinking of was {n}\nRemember it's all about the timing!")

The code generated a random integer, using the time as seed


Exploit

As python random is pseudo random, with the same seed, we are able to generate the same number each time.

I wrote a simple solve script using pwntools.

Flag: grey{t1m3_i5_a_s0c1al_coNstRucT}

Last updated

Was this helpful?