Views
No views yet
| Category | Count | Best Accuracy |
|---|---|---|
| Classical ML | 9 | ~99.5% |
| Deep Learning | 5 | ~99.3% |
| Transformers | 1 | ~97.4% |
| Hybrid Models | 0 | ~99.6% |
| GNN Models | 2 | ~98.5% |
1from huggingface_hub import hf_hub_download
2import pickle
3
4# Download TF-IDF vectorizer
5vectorizer_path = hf_hub_download(
6 repo_id="Dr-KeK/sqli-xss-models",
7 filename="features/tfidf_vectorizer.pkl"
8)
9
10# Download a model (e.g., XGBoost)
11model_path = hf_hub_download(
12 repo_id="Dr-KeK/sqli-xss-models",
13 filename="models/classical_ml/XGBoost.pkl"
14)
15
16# Load and use
17with open(vectorizer_path, 'rb') as f:
18 vectorizer = pickle.load(f)
19
20with open(model_path, 'rb') as f:
21 model = pickle.load(f)
22
23# Predict
24query = "' OR '1'='1"
25features = vectorizer.transform([query])
26prediction = model.predict(features)
27print("Attack detected!" if prediction[0] == 1 else "Safe query").
├── models/
│ ├── classical_ml/ # Sklearn models (XGBoost, RandomForest, etc.)
│ ├── deep_learning/ # Keras models (MLP, CNN, LSTM, BiLSTM)
│ ├── transformers/ # Fine-tuned DistilBERT, BERT
│ ├── hybrid/ # Ensemble models
│ └── gnn/ # Graph Neural Networks
├── features/
│ ├── tfidf_vectorizer.pkl
│ ├── word2vec.model
│ └── fasttext.model
└── README.md123 → NUMSELECT → SQL_SELECT' → SQUOTE, = → EQUALSInput: ' OR '1'='1
Output: SQUOTE SQL_OR SQUOTE NUM SQUOTE EQUALS SQUOTE NUM1import pickle
2from huggingface_hub import hf_hub_download
3
4model_path = hf_hub_download(
5 repo_id="Dr-KeK/sqli-xss-models",
6 filename="models/classical_ml/RandomForest.pkl"
7)
8with open(model_path, 'rb') as f:
9 model = pickle.load(f)1from tensorflow import keras
2from huggingface_hub import hf_hub_download
3
4model_path = hf_hub_download(
5 repo_id="Dr-KeK/sqli-xss-models",
6 filename="models/deep_learning/BiLSTM.h5"
7)
8model = keras.models.load_model(model_path)1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3model_name = "DistilBERT"
4tokenizer = AutoTokenizer.from_pretrained(
5 "Dr-KeK/sqli-xss-models",
6 subfolder=f"models/transformers/{model_name}"
7)
8model = AutoModelForSequenceClassification.from_pretrained(
9 "Dr-KeK/sqli-xss-models",
10 subfolder=f"models/transformers/{model_name}"
11)1@misc{sqli-xss-models-2026,
2 author = {Dr-KeK},
3 title = {SQL Injection & XSS Attack Detection Models},
4 year = {2026},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/Dr-KeK/sqli-xss-models}}
7}