Writeups
  • Writeups
  • CTF Writeups
    • ctfs
      • BRCTF
      • CloudSEK - BSides Cyber Security CTF 2023
      • CloudSEK - Nullcon Cyber Security CTF 2023
      • CyberHavoc CTF 2023
      • Cyber Heroines CTF
      • IWCON CTF 2023
      • SecurityBoat - October CTF 2023
      • The Hacker101 CTF
      • Wizer CTF Event 6 Hour Challenge
      • FooBar CTF 2023
      • Lag and Crash 3.0
      • NahamCon CTF 2022
        • Crash Override:
        • Exit Vim:
        • Flagcat:
        • Flaskmetal Alchemist:
        • Personnel:
        • Poller:
        • Prisoner:
        • Quirky:
        • Read The Rules:
        • Technical Support:
        • Wizard:
      • picoCTF
        • crypto
          • Easy Peasy
    • files
  • HTB
    • HTB Challenges
      • Baby Time Capsule
      • Lost Modulus
      • RLotto
      • Toxic | HTB Web Challenge
      • xorxorxor
    • HTB Machines
      • HTB Machine Precious
      • HTB Machine Stocker
  • Other Challenges
    • Academy Box - PEH Capstone TCM Security
    • Saptang Labs Hiring Challenge
Powered by GitBook
On this page

Was this helpful?

  1. HTB
  2. HTB Challenges

RLotto

EASY , Crypto

CHALLENGE DESCRIPTION: Are you ready to win lottery? Guess the Random Lotto Numbers. It's TIME you become a millionaire.


In the given code we can see that it is using seed = int(time.time()) to generate 5 random digits using random.randint(1, 90) It will give us the first 5 random digits and we have to guess next 5 to get the flag.

Because we have the first 5 random generated digits we can brute force the seed. Initial seed value would be time.time() befor we connect to server and incriment it by one. when we get the seed we can generate the next 5 digits.

python code:

import time
import random

# seed = int(time.time())
seed = 1703848677

def find_solution(s_extracted):
    global seed
    s_extracted = [int(i) for i in s_extracted.split(" ")]
    while True:
        random.seed(seed)
        extracted = []
        while len(extracted) < 5:
            r = random.randint(1, 90)
            if(r not in extracted):
                extracted.append(r)
        if extracted == s_extracted:
            print(seed)
            break
        seed += 1
    solution = ""
    next_five = []
    while len(next_five) < 5:
        r = random.randint(1, 90)
        if(r not in next_five):
            next_five.append(r)
            solution += str(r) + " "
    solution = solution.strip()
    print("[+] SOLUTION: " + solution)
    pass

find_solution("40 8 6 17 63") # [+] EXTRACTION Value

Flag: HTB{n3v3r_u53_pr3d1c74bl3_533d5_1n_p53ud0-r4nd0m_numb3r_63n3r470r}

PreviousLost ModulusNextToxic | HTB Web Challenge

Last updated 1 year ago

Was this helpful?