Advertisement
Guest User

HTTPBasicAuth login-tryer or some other name

a guest
Oct 26th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. from requests.auth import HTTPBasicAuth
  2. import requests
  3.  
  4. webAddress = raw_input('Enter address to send auth to: ')
  5. print 'Enter username and password in the following format: \"username:password\"'
  6.  
  7. while True:
  8.     rawUserPass = raw_input('> ')
  9.     splitUserPass = rawUserPass.split(':')
  10.     username = splitUserPass[0]
  11.     password = splitUserPass[1]
  12.     r = requests.get(webAddress, auth=HTTPBasicAuth(username, password))
  13.     if r.status_code == 401:
  14.         print 'Username and Password rejected'
  15.     elif r.status_code == 200:
  16.         print 'HOLY FUCKING SHIT YOU GOT IT!!!'
  17.     else:
  18.         print 'Unknown error, look up HTTP status code ' + str(r.status_code) + ' for information on what happened...'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement