Tags: rev python baby 

Rating:

**Description**
hey I lost the password :(

**Knowledge required :**
1) Basic Python Understanding

**Solution:**

1) We are given a code that can generate the flag based on our input
```
# I'm thinking of a number from 0 to 2^32 - 1
# Can you guess it?

import random

def generate(seed):
random.seed(seed)
c = 0
while c != ord('}'):
c = random.randint(97, 126)
print(chr(c), end='')
print()

secret = 'ly9ppw=='

import base64

s = int(input("password? >>> "))

if int(base64.b64decode(secret).hex(), 16) == s:
generate(s)
else:
print('nope')
```

2) To figure out the correct input/number we can simply make a python code that generates based on the requirement

```
import base64

secret = 'ly9ppw=='

print(int(base64.b64decode(secret).hex(), 16))
```

3) The code we made gives us the number `2536466855`. Running the original code with this number gives us the flag :

```
python3 main.py
password? >>> 2536466855
wctf{ywtp}
```