Views
No views yet
| Property | Value |
|---|---|
| Base Model | sentence-transformers/all-MiniLM-L6-v2 |
| Task | Text Classification (3-class) |
| Labels | benign, suspicious, malicious |
| Training Steps | 204,075 |
| Framework | HuggingFace Transformers + PyTorch |
| Label | Description | Target Distribution |
|---|---|---|
LABEL_0 | Benign - Normal network traffic | ~70% |
LABEL_1 | Suspicious - Anomalous but unconfirmed | ~20% |
LABEL_2 | Malicious - Confirmed threat behavior | ~10% |
1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="OMCHOKSI108/TheKavach",
6 tokenizer="OMCHOKSI108/TheKavach"
7)
8
9text = "Blocked TCP connection detected by firewall log using nmap scanner targeting high-risk path with small data transfer."
10result = classifier(text)
11print(result)
12# [{'label': 'LABEL_1', 'score': 0.9993}]1from models.inference import CybersecurityAI
2
3ai = CybersecurityAI(hf_model="OMCHOKSI108/TheKavach")
4
5raw_log = {
6 "protocol": "TCP",
7 "action": "blocked",
8 "user_agent": "nmap scripting engine",
9 "request_path": "/admin/config",
10 "bytes_transferred": 5000,
11 "log_type": "firewall"
12}
13
14result = ai.analyze_log(raw_log)
15# Returns: threat, confidence, severity, explanation1curl -X POST https://thekavach.onrender.com/api/ai/analyze \
2 -H "Content-Type: application/json" \
3 -d '{
4 "protocol": "TCP",
5 "action": "blocked",
6 "user_agent": "nmap scripting engine",
7 "request_path": "/admin/config",
8 "bytes_transferred": 5000,
9 "log_type": "firewall"
10 }'LogNormalizer. Raw log fields are converted as follows:| Raw Fields | Normalized Text |
|---|---|
| TCP, blocked, Nmap, /admin/config | Blocked TCP connection detected by firewall log using nmap scanner targeting high-risk path |
| HTTP, allowed, Chrome, /login | Permitted HTTP request recorded by application log accessing authentication path |
| HTTPS, blocked, SQLMap, /api/login | Blocked HTTPS request detected by IDS using sqlmap scanner targeting authentication path |
| Metric | Value |
|---|---|
| Accuracy | 79.8% |
| Macro Precision | 0.520 |
| Macro Recall | 0.502 |
| Macro F1-Score | 0.499 |
| Throughput | 16.3 logs/sec |
| Avg Response Time | 11.1 ms |
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| benign | 0.805 | 1.000 | 0.892 | 13,575 |
| suspicious | 0.754 | 0.505 | 0.605 | 3,949 |
| malicious | 0.000 | 0.000 | 0.000 | 1,987 |
| True \ Pred | benign | suspicious | malicious |
|---|---|---|---|
| benign | 13,575 | 0 | 0 |
| suspicious | 1,955 | 1,994 | 0 |
| malicious | 1,337 | 650 | 0 |
| File | Purpose |
|---|---|
model.safetensors | Fine-tuned MiniLM weights (90.9 MB) |
config.json | Model configuration |
tokenizer.json | Text tokenizer |
tokenizer_config.json | Tokenizer settings |
training_args.bin | Training hyperparameters |
threat_classifier.pkl | Sklearn threat classifier |
struct_scaler.pkl | Feature scaler |