Text Classification
Transformers
Safetensors
English
distilbert
cybersecurity
xss
security
web
payload-detection
web-security
Instructions to use kd7979148/XSS_Payload_Detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kd7979148/XSS_Payload_Detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="kd7979148/XSS_Payload_Detector")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("kd7979148/XSS_Payload_Detector") model = AutoModelForSequenceClassification.from_pretrained("kd7979148/XSS_Payload_Detector") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- cybersecurity
|
| 8 |
+
- xss
|
| 9 |
+
- security
|
| 10 |
+
- web
|
| 11 |
+
- payload-detection
|
| 12 |
+
- text-classification
|
| 13 |
+
---
|
| 14 |
+
# XSS Payload Detector
|
| 15 |
+
|
| 16 |
+
DistilBERT-based machine learning model for detecting XSS payloads.
|
| 17 |
+
|
| 18 |
+
## Labels
|
| 19 |
+
|
| 20 |
+
| Label | Description |
|
| 21 |
+
|---------|-------------|
|
| 22 |
+
| NORMAL | Benign input |
|
| 23 |
+
| XSS | Potential XSS payload |
|
| 24 |
+
|
| 25 |
+
## Requirements
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
pip install torch
|
| 29 |
+
pip install transformers
|
| 30 |
+
pip install flask
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
Start the test server:
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
python test_server.py
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Start monitoring:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
python monitor.py
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Open browser:
|
| 48 |
+
|
| 49 |
+
```text
|
| 50 |
+
http://127.0.0.1:8080/?q=abcde
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Example payload:
|
| 54 |
+
|
| 55 |
+
```text
|
| 56 |
+
http://127.0.0.1:8080/?q=<img src='x' onerror='alert("xss")'>
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## CLI Tool
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
python inference_bert_url.py
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
This tool accepts user input and classifies it as NORMAL or XSS.
|
| 66 |
+
|
| 67 |
+
## Model Files
|
| 68 |
+
|
| 69 |
+
- config.json
|
| 70 |
+
- model.safetensors
|
| 71 |
+
- tokenizer.json
|
| 72 |
+
- tokenizer_config.json
|
| 73 |
+
- vocab.txt
|
| 74 |
+
|
| 75 |
+
## Framework
|
| 76 |
+
|
| 77 |
+
- PyTorch
|
| 78 |
+
- Transformers
|