Views
No views yet
| Class | Description | Common Indicators |
|---|---|---|
Vulnerability_Scan | Automated scanning for known vulnerabilities | sqlmap, nikto, nmap user-agents; repeated probing patterns |
System_Cmd_Execution | OS command injection attempts | |, ;, &&, wget, curl, /bin/sh, boot.ini |
HOST_Scan | Network host discovery and port scanning | Minimal headers, bare GET /, nmap scripting engine |
Path_Disclosure | Directory traversal and file path exposure | ../, ..%2F, /etc/passwd, /etc/shadow, /proc/ |
SQL_Injection | SQL injection in query parameters | UNION SELECT, OR 1=1, --, ', boolean-based blind patterns |
Cross_Site_Scripting | XSS payload injection | <script>, onerror=, javascript:, alert(), prompt() |
Automatically_Searching_Infor | Automated information gathering | Crawlers, /_vti_pvt/, robots.txt, sitemap.xml probing |
Leakage_Through_NW | Sensitive file access via network | Access to config files, logs, backups (.ico, .conf, .bak) |
Directory_Indexing | Browsing exposed directory listings | Trailing / on directory paths, source/workspace/src paths |
| File | Model | Feature Extraction | Test Accuracy | Notes |
|---|---|---|---|---|
tdidf-svc.joblib | TF-IDF + LinearSVC | word, default | 87.4% | Best generalization |
xgb_char.joblib | TF-IDF + XGBoost | char, ngram(1,2), max_features=1024 | 88.5% | Best local accuracy |
xgb_word.joblib | TF-IDF + XGBoost | word, NLTK tokenizer | 86.7% | |
lgb_model.joblib | TF-IDF + LightGBM | word, NLTK tokenizer | 86.5% | |
rf_nltk.joblib | TF-IDF + RandomForest | word, NLTK, n_estimators=1000 | 84.8% | |
rf_gridsearch.joblib | TF-IDF + RandomForest | word, GridSearchCV best | 83.6% | best: max_depth=None, n_estimators=150 |
rf_basic.joblib | TF-IDF + RandomForest | word, default | 83.3% | |
catboost.joblib | TF-IDF + CatBoost | word, NLTK tokenizer | 83.0% | |
multinomial_nb.joblib | CountVectorizer + MultinomialNB | word, default | 67.5% | Baseline |
lstm_bidirectional.h5 | BiLSTM | Keras Tokenizer, maxlen=216 | 85.2% | Requires Keras/TF |
textcnn_model.h5 | TextCNN | Keras Tokenizer, maxlen=256 | 86.1% | Requires Keras/TF |
1import urllib.parse
2
3def preprocess(payload: str) -> str:
4 return urllib.parse.unquote_plus(payload)tdidf-svc.joblib, xgb_char.joblib, xgb_word.joblib, lgb_model.joblib, rf_*.joblib, catboost.joblib, multinomial_nb.joblib1import joblib
2
3model = joblib.load("xgb_char.joblib")
4
5payloads = [
6 "GET /../../../../etc/passwd HTTP/1.1\r\nHost: 10.0.0.1\r\n",
7 "GET /search?q=' OR 1=1-- HTTP/1.1\r\nHost: example.com\r\n",
8]
9predictions = model.predict(payloads)
10print(predictions)
11# ['Path_Disclosure', 'SQL_Injection']1import numpy as np
2from tensorflow.keras.models import load_model
3from tensorflow.keras.preprocessing.sequence import pad_sequences
4import joblib
5
6model = load_model("lstm_bidirectional.h5") # or textcnn_model.h5
7tokenizer = joblib.load("tokenizer.joblib") # must be saved separately during training
8
9payloads = ["GET /../../../../etc/passwd HTTP/1.1\r\nHost: 10.0.0.1"]
10sequences = tokenizer.texts_to_sequences(payloads)
11padded = pad_sequences(sequences, maxlen=216) # maxlen=256 for TextCNN
12
13pred = model.predict(padded)
14label_idx = np.argmax(pred, axis=1)
15print(label_idx)| Model | Accuracy | Macro F1 | Weakest Class (F1) |
|---|---|---|---|
| TF-IDF + XGBoost (char) | 88.5% | 0.92 | System_Cmd_Execution (0.84) |
| TF-IDF + LinearSVC | 87.4% | — | System_Cmd_Execution |
| TF-IDF + XGBoost (word) | 86.7% | 0.90 | System_Cmd_Execution (0.83) |
| TF-IDF + LightGBM | 86.5% | 0.91 | System_Cmd_Execution (0.83) |
| TextCNN | 86.1% | 0.89 | System_Cmd_Execution (0.79) |
| BiLSTM | 85.2% | 0.89 | System_Cmd_Execution (0.78) |
Automatically_Searching_Infor and Leakage_Through_NW achieve F1 ≥ 0.99 across all models — highly distinctive tool signatures (nmap, crawlers) and file access patterns make them trivial to separate.System_Cmd_Execution consistently scores the lowest F1 (0.75–0.84) due to pattern overlap with Vulnerability_Scan. Both classes involve probing behavior with similar HTTP structure.../, <script>, UNION more robustly than word tokenization, especially for obfuscated payloads.Embedding(22,883 vocab, dim=100, maxlen=216)
→ Bidirectional(LSTM(64)) → LSTM(32) → Dense(512) → Dense(9, softmax)lstm_bidirectional.h5 (28 MB)Embedding(20,000 vocab, dim=128, maxlen=256)
→ Conv1D(128, kernel=3) ─┐
→ Conv1D(128, kernel=4) ──→ GlobalMaxPool → Concat(384) → Dense(256) → Dropout(0.3) → Dense(9, softmax)
→ Conv1D(128, kernel=5) ─┘
Total params: 2.86Mtextcnn_model.h5 (33 MB)UNION SELECT, ../, <script>, wget). Bag-of-words representations capture these directly, while sequential models can be distracted by irrelevant header noise.%3Cscript%3E vs <script>).Vulnerability_Scan dominates at 37.5% — models tend to over-predict this class for ambiguous samples.| Item | Value |
|---|---|
| Python | 3.12 |
| scikit-learn | 1.x |
| XGBoost | 3.2.0 |
| LightGBM | 4.6.0 |
| CatBoost | 1.2.10 |
| TensorFlow / Keras | 2.x |