-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpwdHTMLParse.py
More file actions
40 lines (37 loc) · 1.18 KB
/
SpwdHTMLParse.py
File metadata and controls
40 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from bs4 import BeautifulSoup
from colorama import Fore,Back,Style
################### HTMLParser
def SpwdHTMLParser(data2feed):
soup = BeautifulSoup(data2feed, "html.parser")
inputs = soup.find_all("input")
pass_name=""
for inputx in inputs:
if inputx.get("type")=="password":
pass_name=inputx.get("name")
else:
pass
return pass_name
def SpwdCookieParser(response):
print("Looking for CSRF tokens...")
headers=response.headers
if "Set-Cookie" in headers:
CSRFcookie=headers["Set-Cookie"]
#print("Found CSRF cookie: ",CSRFcookie)
return CSRFcookie
else:
print("Couldn't find CSRF token.")
return 0
################### HTMLCSRFParser
def SpwdCSRFParser(data2feed):
print("Looking for CSRF fields...")
soup = BeautifulSoup(data2feed, "html.parser")
inputs = soup.find_all("input")
csrf_name=""
for inputx in inputs:
if inputx.get("type")=="hidden":
csrf_name=inputx.get("name")
value=inputx.get("value")
else:
pass
#print(csrf_name,value)
return [csrf_name,value]