-
-
Save kkrypt0nn/9eea8f2d950f10a7126bafdebb8897c5 to your computer and use it in GitHub Desktop.
Solver script for the Gopher Archive challenge
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
def solve_first() -> str: | |
from string import ascii_lowercase | |
import itertools | |
import hashlib | |
def iter(): | |
for s in itertools.product(ascii_lowercase, repeat=6): | |
yield "".join(s) | |
for s in iter(): | |
s = s[::-1] | |
x = 7331 | |
i = 0 | |
while (True): | |
if (i >= len(s)): | |
break | |
x += ord(s[i]) + (i * ord(s[i])) | |
i += 1 | |
print(f"Trying {s[::-1]}", end="\r") | |
if (x == 9580) and (hashlib.sha1(hashlib.md5(s.encode()).hexdigest().encode()).hexdigest() == 'df4c2d865b38db152e7f6bb4ad2f325de9570185'): | |
return s | |
def solve_second() -> str: | |
import hashlib | |
with open('rockyou.txt', 'r', encoding="latin-1") as f: | |
for l in f.read().splitlines(): | |
print(f"Trying {l}", end="\r") | |
reversed = l[::-1] | |
if (hashlib.sha1(hashlib.md5(reversed.encode()).hexdigest().encode()).hexdigest() == 'a2ce7d4c220df20b186f5458d9449a56e0e36149'): | |
return l | |
first = solve_first() | |
print(f"Found first string: {first[::-1]}") | |
second = solve_second() | |
print(f"Found second string: {second}") | |
print(f"\nFlag/password: {first}-{second}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment