kd7979148 commited on
Commit
9feaa8b
·
verified ·
1 Parent(s): f0e28b8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -13
README.md CHANGED
@@ -14,6 +14,7 @@ tags:
14
  # XSS Payload Detector
15
 
16
  DistilBERT-based machine learning model for detecting XSS payloads.
 
17
 
18
  ## Labels
19
 
@@ -30,39 +31,78 @@ 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
 
 
14
  # XSS Payload Detector
15
 
16
  DistilBERT-based machine learning model for detecting XSS payloads.
17
+ This project can be used either as a standalone CLI classifier or as a log-monitoring system that automatically analyzes web server requests and detects potential XSS attacks.
18
 
19
  ## Labels
20
 
 
31
  pip install flask
32
  ```
33
 
34
+ ## Features
35
 
36
+ This project supports two different usage modes.
37
+
38
+ ### 1. CLI Mode
39
+
40
+ Run:
41
 
42
  ```bash
43
+ python inference_bert_url.py
44
+ ```
45
+
46
+ Enter a string or URL directly from the command line.
47
+
48
+ The model will classify the input as:
49
+
50
+ - NORMAL
51
+ - XSS
52
+
53
+ and display a confidence score.
54
+
55
+ Example:
56
+
57
+ ```text
58
+ Input:
59
+ <script>alert(1)</script>
60
+
61
+ Result:
62
+ XSS
63
+ Confidence:
64
+ 0.9998
65
  ```
66
 
67
+ ---
68
+
69
+ ### 2. Log Monitoring Mode
70
+
71
+ Run the monitoring service:
72
 
73
  ```bash
74
  python monitor.py
75
  ```
76
 
77
+ The monitor automatically reads web server access logs and analyzes incoming requests.
78
 
79
+ Detected XSS payloads are logged for further inspection.
80
+
81
+ This allows the model to be integrated into a web application environment without manually entering payloads.
82
+
83
+ ---
84
+
85
+ ### Test Environment
86
+
87
+ Run the example Flask server:
88
+
89
+ ```bash
90
+ python test_server.py
91
  ```
92
 
93
+ Then open:
94
 
95
  ```text
96
+ http://127.0.0.1:8080/?q=abcde
97
  ```
98
 
99
+ Example XSS payload:
100
 
101
+ ```text
102
+ http://127.0.0.1:8080/?q=<img src='x' onerror='alert("xss")'>
103
  ```
104
 
105
+ The request will be reflected by the test page and analyzed by the monitoring service.
106
 
107
  ## Model Files
108