> For the complete documentation index, see [llms.txt](https://oklencodes.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oklencodes.gitbook.io/untitled/ctfs/biteme-ctf/python-script-and-bash-script.md).

# Python script and Bash script

Now that I have the username "jason\_test\_account". Now I need the password. Looking back on the clues I got from the function.phps, the password needs to have a md5 has ending in "001"

Going to need a python script for it.

```python
#!/usr/bin/env python3

from hashlib import md5
from string import ascii lowercase
import itertools

counter = 1
while True:
	combinations = intertools.combinations_with_replacement(ascii_lowercase)

	for combo in combinations:
		string = "".join(combo)

		m = md5(string.encode("utf-8"))
		the_hash = m.hexidigest()
		if the_hash.endswith("001"):
			print(string, the_hash)
			exit()
	counter +=1
```

### Explainer:

Imports are the neccesary libaries needed md5 is for the hashes, ascii lowercase is for the strings I am looking for and intertools allows iterators for efficient looping.

```python
m = md5(string.encode("utf-8")
the_hash = m.hexidigest()
```

Allows me to see the hash that comes out of each object.

```python
if the_hash.endswith("001"):
    print(string, the_hash)
    exit()
```

If the hash ends with the string "001" print it. I can then see it in the terminal. Exit is to close the loop, without it, even if I found the hash, the search could keep going infinitely.

![](https://2022164620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtzurpgroDJSMn9AFVmQP%2Fuploads%2FZWesI9UgWqAM7r8Hi2iw%2FPython%20code.PNG?alt=media\&token=46ee6f2e-f136-40b0-bdf8-523b5a2c065a)

Yeah I failed the code a few times before finally succeeding, I can now use the information Jason\_test\_account and akbr as well as completing the captcha to move forward.
