Awareness Programs (also “Security Awareness Programs” or “Security Training Programs”) are continuous educational initiatives designed to create a security culture in the organization, educating personnel about threats, best practices, and their role in protecting information assets. These programs are fundamental for reducing human risk in cybersecurity and typically include training on phishing, password management, data protection, secure device usage, and threat recognition, being essential for empowering employees as the first line of defense against cyber threats and creating an organizational culture where security is a shared responsibility.

What are Awareness Programs?

Awareness programs are educational strategies that seek to transform human behavior to become an active line of defense against security threats, rather than an exploitable weak point.

Program Components

Program Design

  • Needs Analysis: Identification of knowledge gaps
  • Learning Objectives: Specific and measurable goals
  • Target Audiences: Segmentation by roles and levels
  • Educational Content: Adapted and relevant materials

Implementation

  • Delivery Methods: Multiple learning channels
  • Frequency: Regular and consistent scheduling
  • Interactivity: Interactive and participatory elements
  • Personalization: Content adapted to specific audiences

Evaluation and Improvement

  • Effectiveness Metrics: Measurement of program impact
  • Knowledge Assessment: Tests and evaluations
  • Personnel Feedback: Feedback and suggestions
  • Continuous Improvement: Updates based on results

Awareness Management System

Program Management

  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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import json

class AwarenessProgramManagement:
    def __init__(self):
        self.programs = {}
        self.audiences = {}
        self.content_modules = {}
        self.training_sessions = {}
        self.assessments = {}
        self.metrics = {}
    
    def create_awareness_program(self, program_id, program_config):
        """Create awareness program"""
        self.programs[program_id] = {
            'program_id': program_id,
            'name': program_config['name'],
            'description': program_config['description'],
            'objectives': program_config.get('objectives', []),
            'target_audiences': program_config.get('target_audiences', []),
            'duration_months': program_config.get('duration_months', 12),
            'frequency': program_config.get('frequency', 'monthly'),
            'delivery_methods': program_config.get('delivery_methods', ['online']),
            'success_metrics': program_config.get('success_metrics', []),
            'status': 'active',
            'created_date': datetime.now(),
            'last_updated': datetime.now()
        }
    
    def define_audience(self, audience_id, audience_config):
        """Define target audience"""
        self.audiences[audience_id] = {
            'audience_id': audience_id,
            'name': audience_config['name'],
            'description': audience_config['description'],
            'role_level': audience_config.get('role_level', 'general'),
            'department': audience_config.get('department', 'all'),
            'risk_level': audience_config.get('risk_level', 'medium'),
            'specific_needs': audience_config.get('specific_needs', []),
            'learning_preferences': audience_config.get('learning_preferences', []),
            'size': audience_config.get('size', 0),
            'current_knowledge_level': audience_config.get('current_knowledge_level', 'beginner')
        }
    
    def create_content_module(self, module_id, module_config):
        """Create content module"""
        self.content_modules[module_id] = {
            'module_id': module_id,
            'title': module_config['title'],
            'description': module_config['description'],
            'content_type': module_config['content_type'],
            'duration_minutes': module_config.get('duration_minutes', 30),
            'difficulty_level': module_config.get('difficulty_level', 'intermediate'),
            'target_audiences': module_config.get('target_audiences', []),
            'learning_objectives': module_config.get('learning_objectives', []),
            'content_elements': module_config.get('content_elements', []),
            'interactive_elements': module_config.get('interactive_elements', []),
            'assessment_questions': module_config.get('assessment_questions', []),
            'created_date': datetime.now(),
            'version': 1.0
        }
    
    def schedule_training_session(self, session_id, session_config):
        """Schedule training session"""
        self.training_sessions[session_id] = {
            'session_id': session_id,
            'program_id': session_config['program_id'],
            'module_id': session_config['module_id'],
            'audience_id': session_config['audience_id'],
            'scheduled_date': session_config['scheduled_date'],
            'duration_minutes': session_config.get('duration_minutes', 60),
            'delivery_method': session_config.get('delivery_method', 'online'),
            'instructor': session_config.get('instructor', 'system'),
            'max_participants': session_config.get('max_participants', 50),
            'status': 'scheduled',
            'participants': [],
            'completion_rate': 0.0,
            'feedback_score': 0.0
        }
    
    def register_participant(self, session_id, participant_data):
        """Register participant in session"""
        if session_id not in self.training_sessions:
            return False
        
        participant = {
            'participant_id': participant_data['participant_id'],
            'name': participant_data['name'],
            'email': participant_data['email'],
            'role': participant_data.get('role', 'employee'),
            'department': participant_data.get('department', 'unknown'),
            'registration_date': datetime.now(),
            'attendance_status': 'registered',
            'completion_status': 'pending',
            'completion_date': None,
            'score': None,
            'feedback': None
        }
        
        self.training_sessions[session_id]['participants'].append(participant)
        return True
    
    def conduct_assessment(self, session_id, assessment_data):
        """Conduct knowledge assessment"""
        if session_id not in self.training_sessions:
            return False
        
        assessment_id = f"ASSESS-{len(self.assessments) + 1}"
        
        assessment = {
            'assessment_id': assessment_id,
            'session_id': session_id,
            'participant_id': assessment_data['participant_id'],
            'questions': assessment_data['questions'],
            'answers': assessment_data['answers'],
            'score': assessment_data['score'],
            'max_score': assessment_data['max_score'],
            'percentage': (assessment_data['score'] / assessment_data['max_score'] * 100) if assessment_data['max_score'] > 0 else 0,
            'completion_time': assessment_data.get('completion_time', 0),
            'timestamp': datetime.now(),
            'passed': assessment_data['score'] >= (assessment_data['max_score'] * 0.7)  # 70% to pass
        }
        
        self.assessments[assessment_id] = assessment
        
        # Update participant status
        session = self.training_sessions[session_id]
        for participant in session['participants']:
            if participant['participant_id'] == assessment_data['participant_id']:
                participant['completion_status'] = 'completed' if assessment['passed'] else 'failed'
                participant['completion_date'] = datetime.now()
                participant['score'] = assessment['percentage']
                break
        
        # Update session completion rate
        completed_participants = len([p for p in session['participants'] if p['completion_status'] == 'completed'])
        total_participants = len(session['participants'])
        session['completion_rate'] = (completed_participants / total_participants * 100) if total_participants > 0 else 0
        
        return True
    
    def collect_feedback(self, session_id, feedback_data):
        """Collect participant feedback"""
        if session_id not in self.training_sessions:
            return False
        
        feedback = {
            'feedback_id': f"FEEDBACK-{len(self.training_sessions[session_id].get('feedback', [])) + 1}",
            'participant_id': feedback_data['participant_id'],
            'rating': feedback_data['rating'],  # 1-5 scale
            'content_quality': feedback_data.get('content_quality', 0),
            'instructor_effectiveness': feedback_data.get('instructor_effectiveness', 0),
            'delivery_method': feedback_data.get('delivery_method', 0),
            'relevance': feedback_data.get('relevance', 0),
            'comments': feedback_data.get('comments', ''),
            'suggestions': feedback_data.get('suggestions', ''),
            'timestamp': datetime.now()
        }
        
        if 'feedback' not in self.training_sessions[session_id]:
            self.training_sessions[session_id]['feedback'] = []
        
        self.training_sessions[session_id]['feedback'].append(feedback)
        
        # Update session feedback score
        session = self.training_sessions[session_id]
        feedback_scores = [f['rating'] for f in session.get('feedback', [])]
        if feedback_scores:
            session['feedback_score'] = sum(feedback_scores) / len(feedback_scores)
        
        return True
    
    def calculate_program_metrics(self, program_id):
        """Calculate program metrics"""
        if program_id not in self.programs:
            return None
        
        # Get program sessions
        program_sessions = [s for s in self.training_sessions.values() if s['program_id'] == program_id]
        
        if not program_sessions:
            return None
        
        # Calculate metrics
        total_sessions = len(program_sessions)
        total_participants = sum(len(s['participants']) for s in program_sessions)
        completed_participants = sum(len([p for p in s['participants'] if p['completion_status'] == 'completed']) for s in program_sessions)
        
        # Calculate rates
        completion_rate = (completed_participants / total_participants * 100) if total_participants > 0 else 0
        
        # Calculate average score
        all_scores = []
        for session in program_sessions:
            session_scores = [p['score'] for p in session['participants'] if p['score'] is not None]
            all_scores.extend(session_scores)
        
        average_score = sum(all_scores) / len(all_scores) if all_scores else 0
        
        # Calculate average feedback
        all_feedback_scores = [s['feedback_score'] for s in program_sessions if s['feedback_score'] > 0]
        average_feedback = sum(all_feedback_scores) / len(all_feedback_scores) if all_feedback_scores else 0
        
        # Calculate participation by audience
        audience_participation = {}
        for session in program_sessions:
            audience_id = session['audience_id']
            if audience_id not in audience_participation:
                audience_participation[audience_id] = 0
            audience_participation[audience_id] += len(session['participants'])
        
        metrics = {
            'program_id': program_id,
            'total_sessions': total_sessions,
            'total_participants': total_participants,
            'completed_participants': completed_participants,
            'completion_rate': completion_rate,
            'average_score': average_score,
            'average_feedback': average_feedback,
            'audience_participation': audience_participation,
            'effectiveness_score': self.calculate_effectiveness_score(completion_rate, average_score, average_feedback)
        }
        
        return metrics
    
    def calculate_effectiveness_score(self, completion_rate, average_score, average_feedback):
        """Calculate program effectiveness score"""
        # Weighting: 40% completion rate, 40% average score, 20% feedback
        effectiveness = (completion_rate * 0.4) + (average_score * 0.4) + (average_feedback * 20 * 0.2)
        return min(effectiveness, 100)  # Maximum 100
    
    def generate_program_report(self, program_id):
        """Generate program report"""
        if program_id not in self.programs:
            return None
        
        program = self.programs[program_id]
        metrics = self.calculate_program_metrics(program_id)
        
        if not metrics:
            return None
        
        # Get recent sessions
        program_sessions = [s for s in self.training_sessions.values() if s['program_id'] == program_id]
        recent_sessions = [s for s in program_sessions if s['scheduled_date'] >= datetime.now() - timedelta(days=30)]
        
        # Trend analysis
        trend_analysis = self.analyze_trends(program_sessions)
        
        # Recommendations
        recommendations = self.generate_recommendations(metrics, trend_analysis)
        
        report = {
            'program_id': program_id,
            'program_name': program['name'],
            'report_date': datetime.now(),
            'metrics': metrics,
            'recent_activity': {
                'sessions_last_30_days': len(recent_sessions),
                'participants_last_30_days': sum(len(s['participants']) for s in recent_sessions)
            },
            'trend_analysis': trend_analysis,
            'recommendations': recommendations,
            'status': 'active' if metrics['effectiveness_score'] >= 70 else 'needs_improvement'
        }
        
        return report
    
    def analyze_trends(self, sessions):
        """Analyze program trends"""
        if len(sessions) < 3:
            return {'trend': 'insufficient_data'}
        
        # Sort sessions by date
        sorted_sessions = sorted(sessions, key=lambda x: x['scheduled_date'])
        
        # Analyze participation trend
        participation_trend = []
        for session in sorted_sessions:
            participation_trend.append(len(session['participants']))
        
        # Calculate trend using simple linear regression
        x = np.arange(len(participation_trend))
        y = np.array(participation_trend)
        
        if len(x) > 1:
            slope = np.polyfit(x, y, 1)[0]
            if slope > 0.1:
                trend = 'increasing'
            elif slope < -0.1:
                trend = 'decreasing'
            else:
                trend = 'stable'
        else:
            trend = 'stable'
        
        # Analyze score trend
        score_trend = []
        for session in sorted_sessions:
            session_scores = [p['score'] for p in session['participants'] if p['score'] is not None]
            if session_scores:
                score_trend.append(sum(session_scores) / len(session_scores))
        
        score_trend_direction = 'stable'
        if len(score_trend) > 1:
            score_slope = np.polyfit(np.arange(len(score_trend)), score_trend, 1)[0]
            if score_slope > 0.1:
                score_trend_direction = 'improving'
            elif score_slope < -0.1:
                score_trend_direction = 'declining'
        
        return {
            'participation_trend': trend,
            'score_trend': score_trend_direction,
            'data_points': len(sessions)
        }
    
    def generate_recommendations(self, metrics, trend_analysis):
        """Generate recommendations based on metrics and trends"""
        recommendations = []
        
        # Recommendations based on metrics
        if metrics['completion_rate'] < 70:
            recommendations.append({
                'type': 'completion_rate',
                'priority': 'high',
                'description': f"Improve completion rate - current: {metrics['completion_rate']:.1f}%"
            })
        
        if metrics['average_score'] < 70:
            recommendations.append({
                'type': 'content_quality',
                'priority': 'high',
                'description': f"Improve content quality - average score: {metrics['average_score']:.1f}"
            })
        
        if metrics['average_feedback'] < 3.0:
            recommendations.append({
                'type': 'delivery_method',
                'priority': 'medium',
                'description': f"Improve delivery method - average feedback: {metrics['average_feedback']:.1f}/5"
            })
        
        # Recommendations based on trends
        if trend_analysis['participation_trend'] == 'decreasing':
            recommendations.append({
                'type': 'engagement',
                'priority': 'medium',
                'description': "Increase engagement - decreasing participation trend"
            })
        
        if trend_analysis['score_trend'] == 'declining':
            recommendations.append({
                'type': 'content_update',
                'priority': 'high',
                'description': "Update content - declining score trend"
            })
        
        return recommendations

# Example usage
awareness_mgmt = AwarenessProgramManagement()

# Create awareness program
awareness_mgmt.create_awareness_program('PROG-001', {
    'name': 'Security Awareness Program 2025',
    'description': 'Annual security awareness program',
    'objectives': [
        'Reduce phishing incidents by 50%',
        'Improve security knowledge by 30%',
        'Increase incident reporting by 40%'
    ],
    'target_audiences': ['all_employees', 'managers', 'it_staff'],
    'duration_months': 12,
    'frequency': 'monthly',
    'delivery_methods': ['online', 'in_person', 'simulation']
})

# Define audience
awareness_mgmt.define_audience('AUD-001', {
    'name': 'All Employees',
    'description': 'All organization employees',
    'role_level': 'general',
    'department': 'all',
    'risk_level': 'medium',
    'size': 500,
    'current_knowledge_level': 'beginner'
})

# Create content module
awareness_mgmt.create_content_module('MOD-001', {
    'title': 'Phishing Awareness',
    'description': 'Identification and prevention of phishing attacks',
    'content_type': 'interactive_module',
    'duration_minutes': 45,
    'difficulty_level': 'beginner',
    'target_audiences': ['AUD-001'],
    'learning_objectives': [
        'Identify phishing emails',
        'Report suspicious emails',
        'Apply security best practices'
    ],
    'content_elements': ['videos', 'quizzes', 'simulations'],
    'interactive_elements': ['phishing_simulation', 'knowledge_check']
})

# Schedule training session
awareness_mgmt.schedule_training_session('SESS-001', {
    'program_id': 'PROG-001',
    'module_id': 'MOD-001',
    'audience_id': 'AUD-001',
    'scheduled_date': datetime.now() + timedelta(days=7),
    'delivery_method': 'online',
    'max_participants': 50
})

# Register participants
awareness_mgmt.register_participant('SESS-001', {
    'participant_id': 'PART-001',
    'name': 'John Doe',
    'email': 'john.doe@company.com',
    'role': 'employee',
    'department': 'hr'
})

# Conduct assessment
awareness_mgmt.conduct_assessment('SESS-001', {
    'participant_id': 'PART-001',
    'questions': 10,
    'answers': 8,
    'score': 8,
    'max_score': 10,
    'completion_time': 25
})

# Generate report
report = awareness_mgmt.generate_program_report('PROG-001')
print(f"Program report: {report['program_name']}")
print(f"Effectiveness score: {report['metrics']['effectiveness_score']:.1f}")

Phishing Simulations

  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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
class PhishingSimulation:
    def __init__(self):
        self.simulations = {}
        self.campaigns = {}
        self.results = {}
        self.templates = {}
    
    def create_phishing_template(self, template_id, template_config):
        """Create phishing template"""
        self.templates[template_id] = {
            'template_id': template_id,
            'name': template_config['name'],
            'subject': template_config['subject'],
            'sender': template_config['sender'],
            'content': template_config['content'],
            'difficulty_level': template_config.get('difficulty_level', 'medium'),
            'phishing_indicators': template_config.get('phishing_indicators', []),
            'target_audience': template_config.get('target_audience', 'all'),
            'created_date': datetime.now()
        }
    
    def create_simulation_campaign(self, campaign_id, campaign_config):
        """Create simulation campaign"""
        self.campaigns[campaign_id] = {
            'campaign_id': campaign_id,
            'name': campaign_config['name'],
            'description': campaign_config['description'],
            'template_id': campaign_config['template_id'],
            'target_audience': campaign_config['target_audience'],
            'start_date': campaign_config['start_date'],
            'end_date': campaign_config['end_date'],
            'status': 'scheduled',
            'total_recipients': 0,
            'emails_sent': 0,
            'emails_opened': 0,
            'links_clicked': 0,
            'data_entered': 0,
            'reported_phishing': 0,
            'created_date': datetime.now()
        }
    
    def send_simulation_email(self, campaign_id, recipient_data):
        """Send simulation email"""
        if campaign_id not in self.campaigns:
            return False
        
        campaign = self.campaigns[campaign_id]
        template = self.templates[campaign['template_id']]
        
        simulation_id = f"SIM-{len(self.simulations) + 1}"
        
        simulation = {
            'simulation_id': simulation_id,
            'campaign_id': campaign_id,
            'recipient_id': recipient_data['recipient_id'],
            'recipient_email': recipient_data['email'],
            'recipient_name': recipient_data['name'],
            'template_id': campaign['template_id'],
            'sent_date': datetime.now(),
            'opened': False,
            'opened_date': None,
            'link_clicked': False,
            'link_clicked_date': None,
            'data_entered': False,
            'data_entered_date': None,
            'reported_phishing': False,
            'reported_date': None,
            'response_time_minutes': None
        }
        
        self.simulations[simulation_id] = simulation
        
        # Update campaign statistics
        campaign['emails_sent'] += 1
        
        return True
    
    def record_email_opened(self, simulation_id):
        """Record email opened"""
        if simulation_id not in self.simulations:
            return False
        
        simulation = self.simulations[simulation_id]
        simulation['opened'] = True
        simulation['opened_date'] = datetime.now()
        
        # Calculate response time
        if simulation['sent_date']:
            response_time = simulation['opened_date'] - simulation['sent_date']
            simulation['response_time_minutes'] = response_time.total_seconds() / 60
        
        # Update campaign statistics
        campaign_id = simulation['campaign_id']
        if campaign_id in self.campaigns:
            self.campaigns[campaign_id]['emails_opened'] += 1
        
        return True
    
    def record_link_clicked(self, simulation_id):
        """Record link clicked"""
        if simulation_id not in self.simulations:
            return False
        
        simulation = self.simulations[simulation_id]
        simulation['link_clicked'] = True
        simulation['link_clicked_date'] = datetime.now()
        
        # Update campaign statistics
        campaign_id = simulation['campaign_id']
        if campaign_id in self.campaigns:
            self.campaigns[campaign_id]['links_clicked'] += 1
        
        return True
    
    def record_data_entered(self, simulation_id):
        """Record data entered"""
        if simulation_id not in self.simulations:
            return False
        
        simulation = self.simulations[simulation_id]
        simulation['data_entered'] = True
        simulation['data_entered_date'] = datetime.now()
        
        # Update campaign statistics
        campaign_id = simulation['campaign_id']
        if campaign_id in self.campaigns:
            self.campaigns[campaign_id]['data_entered'] += 1
        
        return True
    
    def record_phishing_report(self, simulation_id):
        """Record phishing report"""
        if simulation_id not in self.simulations:
            return False
        
        simulation = self.simulations[simulation_id]
        simulation['reported_phishing'] = True
        simulation['reported_date'] = datetime.now()
        
        # Update campaign statistics
        campaign_id = simulation['campaign_id']
        if campaign_id in self.campaigns:
            self.campaigns[campaign_id]['reported_phishing'] += 1
        
        return True
    
    def calculate_campaign_metrics(self, campaign_id):
        """Calculate campaign metrics"""
        if campaign_id not in self.campaigns:
            return None
        
        campaign = self.campaigns[campaign_id]
        
        # Get campaign simulations
        campaign_simulations = [s for s in self.simulations.values() if s['campaign_id'] == campaign_id]
        
        if not campaign_simulations:
            return None
        
        # Calculate metrics
        total_simulations = len(campaign_simulations)
        opened_simulations = len([s for s in campaign_simulations if s['opened']])
        clicked_simulations = len([s for s in campaign_simulations if s['link_clicked']])
        data_entered_simulations = len([s for s in campaign_simulations if s['data_entered']])
        reported_simulations = len([s for s in campaign_simulations if s['reported_phishing']])
        
        # Calculate rates
        open_rate = (opened_simulations / total_simulations * 100) if total_simulations > 0 else 0
        click_rate = (clicked_simulations / total_simulations * 100) if total_simulations > 0 else 0
        data_entry_rate = (data_entered_simulations / total_simulations * 100) if total_simulations > 0 else 0
        report_rate = (reported_simulations / total_simulations * 100) if total_simulations > 0 else 0
        
        # Calculate average response time
        response_times = [s['response_time_minutes'] for s in campaign_simulations if s['response_time_minutes'] is not None]
        avg_response_time = sum(response_times) / len(response_times) if response_times else 0
        
        # Calculate vulnerability score
        vulnerability_score = (click_rate + data_entry_rate - report_rate) / 2
        
        metrics = {
            'campaign_id': campaign_id,
            'total_simulations': total_simulations,
            'open_rate': open_rate,
            'click_rate': click_rate,
            'data_entry_rate': data_entry_rate,
            'report_rate': report_rate,
            'avg_response_time': avg_response_time,
            'vulnerability_score': vulnerability_score,
            'risk_level': self.determine_risk_level(vulnerability_score)
        }
        
        return metrics
    
    def determine_risk_level(self, vulnerability_score):
        """Determine risk level based on vulnerability score"""
        if vulnerability_score >= 70:
            return 'critical'
        elif vulnerability_score >= 50:
            return 'high'
        elif vulnerability_score >= 30:
            return 'medium'
        else:
            return 'low'
    
    def generate_campaign_report(self, campaign_id):
        """Generate campaign report"""
        if campaign_id not in self.campaigns:
            return None
        
        campaign = self.campaigns[campaign_id]
        metrics = self.calculate_campaign_metrics(campaign_id)
        
        if not metrics:
            return None
        
        # Behavior analysis
        behavior_analysis = self.analyze_behavior_patterns(campaign_id)
        
        # Recommendations
        recommendations = self.generate_phishing_recommendations(metrics, behavior_analysis)
        
        report = {
            'campaign_id': campaign_id,
            'campaign_name': campaign['name'],
            'report_date': datetime.now(),
            'metrics': metrics,
            'behavior_analysis': behavior_analysis,
            'recommendations': recommendations,
            'status': campaign['status']
        }
        
        return report
    
    def analyze_behavior_patterns(self, campaign_id):
        """Analyze behavior patterns"""
        campaign_simulations = [s for s in self.simulations.values() if s['campaign_id'] == campaign_id]
        
        if not campaign_simulations:
            return {'analysis': 'no_data'}
        
        # Analysis by department
        dept_analysis = {}
        for sim in campaign_simulations:
            dept = sim.get('department', 'unknown')
            if dept not in dept_analysis:
                dept_analysis[dept] = {
                    'total': 0,
                    'clicked': 0,
                    'reported': 0
                }
            
            dept_analysis[dept]['total'] += 1
            if sim['link_clicked']:
                dept_analysis[dept]['clicked'] += 1
            if sim['reported_phishing']:
                dept_analysis[dept]['reported'] += 1
        
        # Calculate rates by department
        for dept, data in dept_analysis.items():
            data['click_rate'] = (data['clicked'] / data['total'] * 100) if data['total'] > 0 else 0
            data['report_rate'] = (data['reported'] / data['total'] * 100) if data['total'] > 0 else 0
        
        # Temporal analysis
        hourly_analysis = {}
        for sim in campaign_simulations:
            if sim['opened_date']:
                hour = sim['opened_date'].hour
                if hour not in hourly_analysis:
                    hourly_analysis[hour] = {'opened': 0, 'clicked': 0}
                
                hourly_analysis[hour]['opened'] += 1
                if sim['link_clicked']:
                    hourly_analysis[hour]['clicked'] += 1
        
        return {
            'department_analysis': dept_analysis,
            'hourly_analysis': hourly_analysis,
            'total_simulations': len(campaign_simulations)
        }
    
    def generate_phishing_recommendations(self, metrics, behavior_analysis):
        """Generate recommendations based on phishing metrics"""
        recommendations = []
        
        # Recommendations based on metrics
        if metrics['click_rate'] > 30:
            recommendations.append({
                'type': 'click_rate',
                'priority': 'high',
                'description': f"High click rate ({metrics['click_rate']:.1f}%) - increase training in phishing identification"
            })
        
        if metrics['data_entry_rate'] > 20:
            recommendations.append({
                'type': 'data_entry',
                'priority': 'critical',
                'description': f"High data entry rate ({metrics['data_entry_rate']:.1f}%) - critical compromise risk"
            })
        
        if metrics['report_rate'] < 10:
            recommendations.append({
                'type': 'reporting',
                'priority': 'high',
                'description': f"Low report rate ({metrics['report_rate']:.1f}%) - improve reporting channels"
            })
        
        # Recommendations based on behavior analysis
        if 'department_analysis' in behavior_analysis:
            for dept, data in behavior_analysis['department_analysis'].items():
                if data['click_rate'] > 40:
                    recommendations.append({
                        'type': 'department_training',
                        'priority': 'medium',
                        'description': f"Specific training for {dept} - high click rate ({data['click_rate']:.1f}%)"
                    })
        
        return recommendations

# Example usage
phishing_sim = PhishingSimulation()

# Create phishing template
phishing_sim.create_phishing_template('TEMP-001', {
    'name': 'Banking Phishing Template',
    'subject': 'Urgent: Verify Your Account',
    'sender': 'security@bank.com',
    'content': 'Please click here to verify your account...',
    'difficulty_level': 'medium',
    'phishing_indicators': ['urgent_language', 'suspicious_link', 'generic_greeting'],
    'target_audience': 'all'
})

# Create simulation campaign
phishing_sim.create_simulation_campaign('CAMP-001', {
    'name': 'Q1 Phishing Simulation',
    'description': 'Phishing simulation for Q1 2025',
    'template_id': 'TEMP-001',
    'target_audience': 'all_employees',
    'start_date': datetime.now(),
    'end_date': datetime.now() + timedelta(days=7)
})

# Send simulation email
phishing_sim.send_simulation_email('CAMP-001', {
    'recipient_id': 'EMP-001',
    'email': 'employee@company.com',
    'name': 'John Doe'
})

# Record events
phishing_sim.record_email_opened('SIM-1')
phishing_sim.record_link_clicked('SIM-1')
phishing_sim.record_phishing_report('SIM-1')

# Generate report
report = phishing_sim.generate_campaign_report('CAMP-001')
print(f"Campaign report: {report['campaign_name']}")
print(f"Click rate: {report['metrics']['click_rate']:.1f}%")
print(f"Risk level: {report['metrics']['risk_level']}")

Best Practices

Program Design

  • Relevance: Content relevant to daily work
  • Interactivity: Interactive and participatory elements
  • Personalization: Content adapted to specific audiences
  • Frequency: Regular and consistent scheduling

Implementation

  • Multiple Channels: Diversity in delivery methods
  • Gamification: Game elements to increase engagement
  • Feedback: Continuous personnel feedback
  • Metrics: Regular effectiveness measurement

Evaluation

  • Objective Metrics: Measurement of real behavior
  • Simulations: Practical knowledge tests
  • Qualitative Feedback: Personnel feedback
  • Continuous Improvement: Updates based on results

References