🔧 Bibliothèque des 29+ patterns spam
Statistiques globales
| Source | Patterns | Score moyen | Sévérité dominante |
|---|---|---|---|
| Manuels | 13 | ~78 | high |
| Kaggle | 6 | 75 | high |
| UCI Spambase | 4 | 53 | low-medium |
| HuggingFace | 6 | 72 | medium-high |
| Total | 29+ | — | — |
Source 1 — Patterns manuels (spam_patterns.json)
Patterns artisanaux couvrant les scénarios les plus fréquents en France.
| ID | Nom | Type | Sévérité | Score |
|---|---|---|---|---|
| PHISH-001 | Faux colis livraison | phishing | high | 85 |
| PHISH-002 | Faux email bancaire | phishing | critical | 90 |
| PHISH-003 | Faux remboursement impôts | phishing | critical | 92 |
| PHISH-004 | Faux Google/Microsoft 365 | phishing | high | 87 |
| SCAM-001 | Loterie / Héritage | scam | critical | 95 |
| SCAM-002 | Prince nigérian / Transfert | scam | critical | 98 |
| MALW-001 | Pièce jointe malveillante | malware | high | 88 |
| COMM-001 | Spam commercial générique | commercial | low | 40 |
| COMM-002 | Pharmacie en ligne | commercial | medium | 75 |
| BANK-001 | Faux PayPal / Stripe | banking | high | 88 |
| TECH-001 | Faux support Microsoft/Apple | tech_support | high | 82 |
| SEXT-001 | Chantage webcam/Bitcoin | sextortion | medium | 70 |
| DELIV-001 | Faux Amazon / e-commerce | delivery | high | 80 |
Détail PHISH-001 (exemple)
{
"id": "PHISH-001",
"type": "phishing",
"name": "Faux colis livraison",
"keywords": ["colis", "livraison", "tracking", "suivi", "expedition", "transporteur"],
"subject_regex": ["(?i)(colis|livraison).*(prêt|attente|retard)", "(?i)suivi.*commande"],
"sender_domains": ["thepiratebuy.com", "tracking-verify.com"],
"body_keywords": ["cliquez ici pour suivre", "votre colis vous attend"],
"score": 85,
"is_spam": true,
"severity": "high",
"description": "Imite les notifications de livraison DPD, Colissimo, UPS pour voler des identifiants"
}
Source 2 — Patterns Kaggle (spam_kaggle_patterns.json)
Extraits des datasets SMS Spam Collection, Enron Spam et Spam Mails Dataset.
| ID | Nom | Type | Sévérité | Score |
|---|---|---|---|---|
| KGL-SMS-001 | SMS Prize Scam | sms_spam | high | 90 |
| KGL-SMS-002 | SMS Urgent Action | sms_spam | high | 85 |
| KGL-ENRON-001 | Corporate Phishing | corporate_spam | medium | 60 |
| KGL-ENRON-002 | Investment Scam | financial_spam | high | 80 |
| KGL-GEN-001 | Weight Loss / Health | generic_spam | medium | 65 |
| KGL-GEN-002 | Adult Content Spam | generic_spam | medium | 70 |
Sources datasets :
- SMS Spam Collection — Kaggle (5 574 messages, CC BY 4.0)
- Enron Spam — Kaggle (33 716 emails)
- Spam Mails Dataset — Kaggle (CC BY 4.0)
Source 3 — Patterns UCI Spambase (spam_uci_patterns.json)
Basés sur les 57 attributs du dataset UCI Spambase (4 601 instances, précision baseline 92.8%).
| ID | Nom | Type | Sévérité | Score |
|---|---|---|---|---|
| UCI-WORD-001 | High-frequency spam words | word_frequency | medium | 55 |
| UCI-CHAR-001 | Special character patterns (!, $) | char_frequency | low | 45 |
| UCI-CAP-001 | Capital letter ratio élevé | capital_frequency | low | 35 |
| UCI-COMBO-001 | Multi-signal spam | combination | high | 78 |
Feature weights UCI (sélection) :
| Feature | Poids |
|---|---|
word_freq_free | 0.52 |
word_freq_remove | 0.28 |
word_freq_your | 0.27 |
char_freq_! | 0.30 |
char_freq_$ | 0.20 |
capital_run_avg | 0.15 |
Source : UCI ML Repository — Spambase (CC BY 4.0)
Source 4 — Patterns HuggingFace (spam_huggingface_patterns.json)
Issus de SetFit/enron_spam, dair-ai/emotion, talby/spamassassin et sms_spam.
| ID | Nom | Type | Sévérité | Score |
|---|---|---|---|---|
| HF-ENRON-001 | Enron-style corporate spam | corporate_spam | medium | 55 |
| HF-SA-001 | SpamAssassin — Nigerian scam | scam | critical | 95 |
| HF-SA-002 | SpamAssassin — HTML spam | generic_spam | medium | 72 |
| HF-EMOTION-001 | Fear/Urgency manipulation | phishing | medium | 68 |
| HF-EMOTION-002 | Joy/Excitement manipulation | scam | medium | 75 |
| HF-SMS-001 | SMS Premium rate scam | sms_spam | high | 82 |
Sources datasets :
- SetFit/enron_spam (Apache-2.0)
- dair-ai/emotion (MIT)
- talby/spamassassin (Apache-2.0)
- sms_spam (CC BY 4.0)
Règles header (Header Rules)
Ces règles s'appliquent aux résultats SPF/DKIM/DMARC indépendamment des patterns.
| ID | Check | Condition | Score ajouté |
|---|---|---|---|
| HDR-001 | SPF | fail | +25 |
| HDR-002 | DKIM | fail | +25 |
| HDR-003 | DMARC | fail | +20 |
| HDR-004 | rDNS mismatch | true | +15 |
| HDR-005 | IP blacklistée | true | +30 |
headerScore plafonné à 100.
Ajouter un nouveau pattern
Pour contribuer un nouveau pattern :
- Identifier le type et rédiger la structure JSON
- Tester avec
node scripts/extract-spam-patterns.cjs - Valider que le pattern ne génère pas de faux positifs sur des emails légitimes
- Créer une PR avec le pattern documenté
Voir CONTRIBUTING.md pour le processus complet.
Roadmap patterns
| Horizon | Amélioration |
|---|---|
| Q2 2026 | Schéma Zod pour validation automatique des patterns |
| Q3 2026 | Fine-tuning modèle ML sur corpus communautaire |
| Q3 2026 | API signalement → enrichissement automatique des patterns |
| Q4 2026 | NLP sur corps d'email (URLs, intent, entités) |
Voir FUTURE-RESEARCH.md.