Created
November 3, 2018 01:40
-
-
Save chrispetrou/9283f1cdf92ed8be088c7201b9d2724a to your computer and use it in GitHub Desktop.
Login & interact with dvwa application using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
from bs4 import BeautifulSoup | |
url = "http://127.0.0.1/dvwa/login.php" | |
def get_token(source): | |
soup = BeautifulSoup(source, "html.parser") | |
return soup.find('input', { "type" : "hidden" })['value'] | |
with requests.Session() as s: | |
src = s.get(url).text | |
creds = { | |
"username" : "admin", | |
"password" : "password", | |
"Login" : "Submit", | |
"user_token" : get_token(src) | |
} | |
r = s.post(url, data = creds) | |
print r.text |
welcome fix user_token requests python Log in DVWA applction
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
welcome