TestingCapstone commited on
Commit
91d8166
·
1 Parent(s): 6351f7e

Initial upload of phishing-email-detector-capstone

Browse files
README.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: bert-large-uncased
4
+ tags:
5
+ - generated_from_trainer
6
+ - phishing
7
+ - BERT
8
+ - cybersecurity
9
+ - text-classification
10
+ metrics:
11
+ - accuracy
12
+ - precision
13
+ - recall
14
+ model-index:
15
+ - name: phishing-email-detector-capstone
16
+ results: []
17
+ widget:
18
+ - text: https://www.verif22.com
19
+ example_title: Phishing URL
20
+ - text: >
21
+ Dear colleague,
22
+ An important update about your email has exceeded your storage limit.
23
+ You will not be able to send or receive messages until you reactivate your account.
24
+ We will close all older versions of our Mailbox as of Friday, June 12, 2023.
25
+ To activate and complete the required information, click here (https://ec-ec.squarespace.com).
26
+ Your account must be reactivated today to regenerate new space.
27
+ — Management Team
28
+ example_title: Phishing Email
29
+ - text: >
30
+ You have access to FREE Video Streaming in your plan.
31
+ REGISTER with your email and password, then select the monthly subscription option.
32
+ https://bit.ly/3vNrU5r
33
+ example_title: Phishing SMS
34
+ - text: >
35
+ if(data.selectedIndex > 0){$('#hidCflag').val(data.selectedData.value);};
36
+ var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
37
+ var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "email");
38
+ example_title: Phishing Script
39
+ - text: Hi, this model is really accurate :)
40
+ example_title: Benign Message
41
+ language:
42
+ - en
43
+ pipeline_tag: text-classification
44
+ ---
45
+
46
+ # 🧠 Phishing Detection Model (BERT-Large-Uncased)
47
+
48
+ A transformer-based model fine-tuned to detect **phishing content** across multiple formats — including **emails, URLs, SMS messages, and scripts**.
49
+ Built on **BERT-Large-Uncased**, it leverages deep contextual understanding of language to classify text as *phishing* or *benign* with high accuracy.
50
+
51
+ ---
52
+
53
+ ## 📌 Model Details
54
+
55
+ **Base model:** `bert-large-uncased`
56
+ **Architecture:** 24 layers • 1024 hidden size • 16 attention heads • ~336M parameters
57
+ **License:** Apache 2.0
58
+ **Language:** English
59
+ **Pipeline tag:** `text-classification`
60
+
61
+ ---
62
+
63
+ ## 🧩 Model Description
64
+
65
+ This model was trained to identify phishing-related content by analyzing linguistic and structural patterns commonly found in malicious communications.
66
+ By leveraging BERT’s bidirectional transformer architecture, it effectively detects phishing attempts even when the message appears legitimate or well-written.
67
+
68
+ ### Key Features
69
+ - Detects **phishing attempts** in text, emails, URLs, and scripts
70
+ - Useful for **cybersecurity applications**, such as email gateways or web filtering systems
71
+ - Capable of identifying **varied phishing tactics** (impersonation, link manipulation, credential harvesting, etc.)
72
+
73
+ ---
74
+
75
+ ## 🎯 Intended Uses
76
+
77
+ **Recommended use cases:**
78
+ - Classify messages, emails, and URLs as *phishing* or *benign*
79
+ - Integrate into automated **security pipelines**, email filtering tools, or chat moderation systems
80
+ - Aid in **phishing research** or awareness programs
81
+
82
+ **Limitations:**
83
+ - May trigger **false positives** on legitimate content with financial or urgent language
84
+ - Optimized for **English text** only
85
+ - Should be part of a **multi-layered defense strategy**, not a standalone cybersecurity control
86
+
87
+ ---
88
+
89
+ ## 📊 Evaluation Results
90
+
91
+ | Metric | Score |
92
+ |--------|--------|
93
+ | **Loss** | 0.1953 |
94
+ | **Accuracy** | 0.9717 |
95
+ | **Precision** | 0.9658 |
96
+ | **Recall** | 0.9670 |
97
+ | **False Positive Rate** | 0.0249 |
98
+
99
+ ---
100
+
101
+ ## ⚙️ Training Details
102
+
103
+ ### Hyperparameters
104
+ | Parameter | Value |
105
+ |------------|--------|
106
+ | **Learning rate** | 2e-05 |
107
+ | **Train batch size** | 16 |
108
+ | **Eval batch size** | 16 |
109
+ | **Seed** | 42 |
110
+ | **Optimizer** | Adam (β₁=0.9, β₂=0.999, ε=1e-08) |
111
+ | **LR scheduler** | Linear |
112
+ | **Epochs** | 4 |
113
+
114
+ ### Training Results
115
+
116
+ | Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | False Positive Rate |
117
+ |:-------------:|:-----:|:-----:|:---------------:|:--------:|:---------:|:------:|:-------------------:|
118
+ | 0.1487 | 1.0 | 3866 | 0.1454 | 0.9596 | 0.9709 | 0.9320 | 0.0203 |
119
+ | 0.0805 | 2.0 | 7732 | 0.1389 | 0.9691 | 0.9663 | 0.9601 | 0.0243 |
120
+ | 0.0389 | 3.0 | 11598 | 0.1779 | 0.9683 | 0.9778 | 0.9461 | 0.0156 |
121
+ | 0.0091 | 4.0 | 15464 | 0.1953 | 0.9717 | 0.9658 | 0.9670 | 0.0249 |
122
+
123
+ ---
124
+
125
+ ## 🧠 Example Inference
126
+
127
+ Try the model in Python using the `transformers` library:
128
+
129
+ ```python
130
+ from transformers import pipeline
131
+
132
+ # Load the phishing detection model
133
+ classifier = pipeline("text-classification", model="your-username/phishing-email-detector-capstone")
134
+
135
+ # Example texts
136
+ examples = [
137
+ "Dear colleague, your email storage is full. Click here to verify your account: https://secure-update-login.com",
138
+ "Hi team, the meeting starts at 2 PM today.",
139
+ "You have won a free gift card! Claim now at http://bit.ly/3xYzabc"
140
+ ]
141
+
142
+ # Run inference
143
+ for text in examples:
144
+ result = classifier(text)[0]
145
+ print(f"Text: {text}\nPrediction: {result['label']} (score: {result['score']:.4f})\n")
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bert-large-uncased",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 1024,
12
+ "id2label": {
13
+ "0": "benign",
14
+ "1": "phishing"
15
+ },
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 4096,
18
+ "label2id": {
19
+ "benign": 0,
20
+ "phishing": 1
21
+ },
22
+ "layer_norm_eps": 1e-12,
23
+ "max_position_embeddings": 512,
24
+ "model_type": "bert",
25
+ "num_attention_heads": 16,
26
+ "num_hidden_layers": 24,
27
+ "pad_token_id": 0,
28
+ "position_embedding_type": "absolute",
29
+ "problem_type": "single_label_classification",
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.34.1",
32
+ "type_vocab_size": 2,
33
+ "use_cache": true,
34
+ "vocab_size": 30522
35
+ }
gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7fc8fd8ff9eb431b5876bff2e94d0ba31987fc2301942b65d1306eba9d18646
3
+ size 1340710638
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "mask_token": "[MASK]",
48
+ "model_max_length": 512,
49
+ "pad_token": "[PAD]",
50
+ "sep_token": "[SEP]",
51
+ "strip_accents": null,
52
+ "tokenize_chinese_chars": true,
53
+ "tokenizer_class": "BertTokenizer",
54
+ "unk_token": "[UNK]"
55
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d104fd966c5439370d740371ebeae1a9b747a93c604762957f98ecfeec61108
3
+ size 4536
vocab.txt ADDED
The diff for this file is too large to render. See raw diff