File size: 1,196 Bytes
1b03224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b62d469
 
1b03224
 
 
 
b62d469
 
1b03224
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# behavioral_analyzer.py

import re

SEXTORTION_PATTERNS = [
    "i have access to all your devices",
    "i recorded you",
    "i installed a trojan",
    "i have your webcam",
    "masturbation",
    "adult websites",
    "send bitcoin",
    "btc",
    "wallet address",
    "48 hours",
    "countdown",
    "i will share the video",
    "i will expose",
]

def analyze_behavior(body: str):
    body_l = (body or "").lower()

    matched = [p for p in SEXTORTION_PATTERNS if p in body_l]

    if len(matched) >= 3:
        return {
            "dominant_attack": "sextortion",
            "confidence_score": 90,   # 🔥 authoritative
            "verdict": "🚨 Malicious",
            "findings": matched,
        }

    return {
        "dominant_attack": "None",
        "confidence_score": 0,
        "verdict": "Unknown",
        "findings": [],
    }

def behavioral_summary(result: dict) -> str:
    if result["dominant_attack"] == "sextortion":
        return (
            "Email exhibits sextortion behavior: claims of device compromise, "
            "recorded explicit content, cryptocurrency extortion, and urgency."
        )
    return "No strong behavioral threat detected."