python script to detect xss vulnerability on chase website free

Messages
2
Reputation
0
Reaction score
0
Points
1
import requests
from bs4 import BeautifulSoup
import re

url = "https://www.chase.com/"

# Make a GET request to the URL
response = requests.get(url)

# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(response.text, 'html.parser')

# Find all input fields
inputs = soup.find_all('input')

# Iterate over the input fields
for input_field in inputs:
# Check if the input field has a value attribute
if 'value' in input_field.attrs:
# Check if the value attribute contains user input
if re.search(r'user_input|query|search|keyword', input_field['value'], re.IGNORECASE):
print(f"Potential XSS vulnerability found in input field with value: {input_field['value']}")

# Find all text fields
textareas = soup.find_all('textarea')

# Iterate over the text fields
for textarea in textareas:
# Check if the text field has user input
if re.search(r'user_input|query|search|keyword', textarea.text, re.IGNORECASE):
print(f"Potential XSS vulnerability found in textarea with value: {textarea.text}")

# Find all script tags
scripts = soup.find_all('script')

# Iterate over the script tags
for script in scripts:
# Check if the script contains user input
if re.search(r'user_input|query|search|keyword', script.text, re.IGNORECASE):
print(f"Potential XSS vulnerability found in script with content: {script.text}")

# Find all URL parameters
params = re.findall(r'(\w+)=(\w+)', url)

# Iterate over the URL parameters
for param in params:
# Check if the parameter contains user input
if re.search(r'user_input|query|search|keyword', param[1], re.IGNORECASE):
print(f"Potential XSS vulnerability found in URL parameter: {param[0]}={param[1]}")
 
Top