
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
A Python package for detecting Cross-Site Scripting (XSS) attacks using machine learning.
pip install xss-detector
Check a specific string for XSS:
xss-detector check "<script>alert(1)</script>"
Check a file for XSS:
xss-detector file suspicious.html
Check a URL:
xss-detector url "https://example.com/?param=value"
Start the API server:
xss-detector server --port 5000
from xss_detector import XSSDetector
# Initialize the detector
detector = XSSDetector()
# Check a single string
result = detector.detect('<img src="x" onerror="alert(1)">')
print(f"XSS detected: {result['is_xss']}, Confidence: {result['confidence']}")
# Analyze a full HTTP request
analysis = detector.analyze_request(
url_params={'search': 'something<script>alert(1)</script>'},
headers={'User-Agent': 'Mozilla/5.0'},
cookies={'session': 'abc123'}
)
print(f"Request contains XSS: {analysis['xss_detected']}")
Start the server:
xss-detector server
Then make requests:
# Check a single string
curl -X POST http://localhost:5000/check \
-H "Content-Type: application/json" \
-d '{"text": "<script>alert(1)</script>"}'
# Analyze a full request
curl -X POST http://localhost:5000/proxy \
-H "Content-Type: application/json" \
-d '{"param": "<img src=x onerror=alert(1)>"}'
The package automatically downloads a dataset and trains a model on first use. To manually train a new model:
xss-detector train
MIT
FAQs
A package for detecting XSS attacks using machine learning
We found that xss-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.