Skip to content

Instantly share code, notes, and snippets.

@chrispetrou
Created November 3, 2018 01:40
Show Gist options
  • Save chrispetrou/9283f1cdf92ed8be088c7201b9d2724a to your computer and use it in GitHub Desktop.
Save chrispetrou/9283f1cdf92ed8be088c7201b9d2724a to your computer and use it in GitHub Desktop.
Login & interact with dvwa application using python
#!/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
@Hacking-Wibsite
Copy link

welcome

@Hacking-Wibsite
Copy link

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