Downloads · 30 days
16
13% of all-time downloads
DhruvSoni/social-engineering-detector
social-engineering-detector is a text classification model from DhruvSoni. Use it when you need a label for a piece of text. It is set up for keras. The card lists the license as mit.
An intelligent ML model that detects social engineering attacks in text messages, emails, and SMS.
Downloads · 30 days
16
13% of all-time downloads
All-time downloads
124
Public
Repo size
32.2 MB
Likes
0
Public
Click a slice to open those files.
.keras16.2 MB · 50%
From the Hugging Face model README
An intelligent ML model that detects social engineering attacks in text messages, emails, and SMS.
Multi-kernel CNN: Embedding(64) → Conv1D(3-gram, 64) + Conv1D(5-gram, 64) → Concat → Dense(64) → Dense(32) → Sigmoid
Total Parameters: 1,323,265 (5.05 MB)
| Metric | Value |
|---|---|
| Accuracy | 0.9844 |
| AUC | 0.9986 |
| Precision | 0.9854 |
| Recall | 0.9812 |
| Loss | 0.0456 |
Trained for 6 epochs with early stopping.
50,112 samples from 3 combined datasets:
Class distribution: ~53% legitimate, ~47% malicious
| File | Description |
|---|---|
social_engineering_detector.keras | Keras native format (recommended) |
social_engineering_detector.h5 | HDF5 format (legacy compatible) |
vocabulary.json | Tokenizer vocabulary (20,000 tokens) |
vectorizer_config.json | Text vectorization settings |
metrics.json | Full evaluation metrics |
training_history.json | Training curves data |
import tensorflow as tf
import numpy as np
# Load model
model = tf.keras.models.load_model("social_engineering_detector.h5")
# Predict
messages = [
"URGENT: Your account compromised! Click to verify: http://fake-bank.xyz",
"Hey, are we meeting for lunch tomorrow?",
"You won $10,000! Send SSN to claim.",
"Please review the Q3 report attached.",
]
predictions = model.predict(tf.constant(messages))
for msg, pred in zip(messages, predictions):
label = "🚨 SOCIAL ENGINEERING" if pred[0] > 0.5 else "✅ LEGITIMATE"
confidence = pred[0] if pred[0] > 0.5 else 1 - pred[0]
print(f"{label} ({confidence:.1%}): {msg}")
from huggingface_hub import hf_hub_download
import tensorflow as tf
# Download .h5 model
path = hf_hub_download("DhruvSoni/social-engineering-detector", "social_engineering_detector.h5")
model = tf.keras.models.load_model(path)
# Or download .keras model
path = hf_hub_download("DhruvSoni/social-engineering-detector", "social_engineering_detector.keras")
model = tf.keras.models.load_model(path)
| Predicted Legitimate | Predicted Malicious | |
|---|---|---|
| Actual Legitimate | 3,962 (TN) | 51 (FP) |
| Actual Malicious | 66 (FN) | 3,438 (TP) |
MIT — free for personal and commercial use.