Last active
July 7, 2022 09:42
-
-
Save fanbyprinciple/30acd6b1d28a5e40becea4be82e4c699 to your computer and use it in GitHub Desktop.
RLotto htb solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://medium.com/@wiiz4rd/hackthebox-rlotto-challenge-68f4b01006ba | |
# connect to rlotto using nc or telnet | |
# get the first sequence of numbers | |
# input into this program | |
import time | |
import random | |
seed = int(input("Enter the timestamp (enter 0 if not aware) :")) | |
if seed == 0: | |
seed = int(time.time()) - 2_500_500 #2_500_500 10 sec | |
if seed == 1: | |
seed = int(time.time()) - 15_000_000 | |
winning_numbers = list(int(x) for x in input("Enter extracted numbers from the rlotto program: ").split(" ")) | |
print("starred seed: ", seed) | |
while True: | |
random.seed(seed) | |
extracted = [] | |
for item in winning_numbers: | |
r = random.randint(1,90) | |
if item != r: | |
seed +=1 | |
break | |
else: | |
extracted.append(r) | |
if len(extracted) == 5: | |
break | |
print("Found seed: ", seed) | |
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("\nsolution: " , solution) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment