gophish-ruby 0.3.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abf879c22c4f9f1521c61af8ebc635956ba6f70b3d6292019707b34168c32c73
4
- data.tar.gz: 41e2452769f172e282a83f0e6a4d186e82f4544683f405745790f736532a03d2
3
+ metadata.gz: c44a4676be791cb9f3b20de06e1f2b0c07537d1baf2439fd6b8e0a176257f5d6
4
+ data.tar.gz: bc03e673ed3ce98ff701b013b45ff5bb6a3b241373669b4f8fbceafd763f55e2
5
5
  SHA512:
6
- metadata.gz: 3b1d75bff457c5f276fa014daffeff9834b9d44771a2dd2d41b12353d3060ff5b04fd5665aaf92a93417ababfaef3a26acc48edee5c4d165cde3c69b0749b47b
7
- data.tar.gz: 702c43a976ae0ab06dbaa49ad01e7631b0b2a5405a6d41a13384f8c3e2b58c339d04b143fc78f65940119d52c5851bb17ae7c464c2e8c783ba82f468dfae5a42
6
+ metadata.gz: 7065f2c3465bf572a5c9f918d597d37414e70143ce7130bcafacd60e164411e19cc8dce6fb3c52a4a52846ee81b12411ef20e52fca91b69fc59606755b3cfb70
7
+ data.tar.gz: '008bea10cdd42881b93dfa0e27179f29987dbb1624bee9c21d07c2d3a7ffb50472daefb84c8d76409f980be0ca5695a4ab475d36840ca648b581151ac1e89b46'
data/CHANGELOG.md CHANGED
@@ -7,7 +7,104 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.3.0] - 2025-01-15
10
+ ## [1.0.0] - 2025-09-01
11
+
12
+ ### Added
13
+
14
+ - **Campaign Management System** 🎯
15
+ - `Gophish::Campaign` class for creating, managing, and monitoring phishing campaigns
16
+ - Full CRUD operations for campaigns (create, read, update, delete)
17
+ - Campaign scheduling with `launch_date` and `send_by_date` attributes
18
+ - Comprehensive campaign result tracking and analysis
19
+ - Timeline monitoring for detailed campaign progression
20
+ - Campaign status management with `#in_progress?`, `#completed?`, `#launched?` methods
21
+ - Campaign completion functionality with `#complete!` method
22
+ - Class methods for efficient data retrieval: `.get_results()`, `.get_summary()`, `.complete()`
23
+ - Support for referencing existing templates, pages, groups, and SMTP profiles
24
+ - Automatic validation of all campaign components and dependencies
25
+
26
+ - **Campaign Result Analysis**
27
+ - `Campaign::Result` nested class for individual target interaction tracking
28
+ - Detailed result status methods: `#clicked?`, `#opened?`, `#sent?`, `#submitted_data?`, `#reported?`
29
+ - Geographic tracking with latitude/longitude coordinates
30
+ - IP address tracking for security analysis
31
+ - Comprehensive result validation and error handling
32
+
33
+ - **Campaign Timeline Tracking**
34
+ - `Campaign::Event` nested class for timeline event management
35
+ - Detailed event tracking with timestamps, messages, and JSON details
36
+ - Event analysis methods: `#has_details?`, `#parsed_details`
37
+ - Complete campaign progression monitoring
38
+
39
+ - **Enhanced Template Management**
40
+ - Added `envelope_sender` attribute to Template class for advanced email delivery control
41
+ - New `#has_envelope_sender?` method to check envelope sender configuration
42
+ - Improved email header management capabilities
43
+ - Enhanced template validation with envelope sender support
44
+
45
+ ### Changed
46
+
47
+ - Updated gem version to 1.0.0 (major release with full campaign management)
48
+ - Added `require_relative 'gophish/campaign'` to main library file
49
+ - Enhanced Template class with envelope sender functionality
50
+ - Improved documentation with comprehensive campaign examples
51
+ - Updated API documentation to include all campaign-related classes and methods
52
+
53
+ ### Technical Enhancements
54
+
55
+ - **Advanced Object Conversion System**
56
+ - Intelligent conversion between hash references and object instances
57
+ - Automatic handling of nested object relationships (templates, pages, groups, SMTP)
58
+ - Graceful error handling for unknown attributes during object creation
59
+ - Support for both string names and full object references
60
+
61
+ - **Comprehensive Validation Framework**
62
+ - Multi-level validation for campaign components
63
+ - Detailed error messages for campaign structure validation
64
+ - Group structure validation with index-specific error reporting
65
+ - Result and timeline data structure validation
66
+ - Enhanced error handling with descriptive failure messages
67
+
68
+ - **Robust API Integration**
69
+ - Campaign-specific API endpoints for results, summary, and completion
70
+ - Optimized payload building for campaign creation and updates
71
+ - Proper serialization of nested objects and references
72
+ - Enhanced error handling for API communication
73
+
74
+ ### Breaking Changes
75
+
76
+ - This is a major version release (1.0.0) indicating API stability
77
+ - No breaking changes from 0.4.0, fully backward compatible
78
+ - Campaign functionality is additive and does not affect existing code
79
+
80
+ ### Documentation Updates
81
+
82
+ - Complete campaign management examples in README.md
83
+ - Enhanced API reference documentation for all campaign-related classes
84
+ - Updated getting started guide with campaign examples
85
+ - Comprehensive validation and error handling examples
86
+ - Production-ready code examples with proper error handling
87
+
88
+ ## [0.4.0] - 2025-09-01
89
+
90
+ ### Added
91
+
92
+ - **SMTP Management System**
93
+ - `Gophish::Smtp` class for managing SMTP sending profiles in phishing campaigns
94
+ - Full CRUD operations for SMTP profiles (create, read, update, delete)
95
+ - Support for SMTP server configuration with host, from_address, and authentication
96
+ - Comprehensive validations requiring name, host, and valid from_address email format
97
+ - Authentication support with username and password credentials
98
+ - SSL certificate error handling with `ignore_cert_errors` option
99
+ - Custom header management with add/remove functionality
100
+ - Built-in methods for checking SMTP configuration: `#has_authentication?`, `#ignores_cert_errors?`, `#has_headers?`, `#header_count`
101
+
102
+ ### Changed
103
+
104
+ - Updated gem version to 0.4.0
105
+ - Added `require_relative 'gophish/smtp'` to main library file for SMTP class availability
106
+
107
+ ## [0.3.0] - 2025-09-01
11
108
 
12
109
  ### Added
13
110
 
@@ -121,4 +218,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
121
218
  - Code of conduct and contributing guidelines
122
219
  - Comprehensive test suite foundation with RSpec
123
220
 
124
- This initial release provides a solid foundation for interacting with the Gophish API, focusing on group management as the primary use case while establishing patterns for future resource implementations.
221
+ This initial release provides a solid foundation for interacting with the Gophish API, focusing on group management as the primary use case while establishing patterns for future resource implementations.
data/README.md CHANGED
@@ -10,11 +10,13 @@ A Ruby SDK for the [Gophish](https://getgophish.com/) phishing simulation platfo
10
10
  - **Full API Coverage**: Complete implementation of Gophish API endpoints
11
11
  - **ActiveModel Integration**: Familiar Rails-like attributes, validations, and callbacks
12
12
  - **Automatic Authentication**: Built-in API key authentication for all requests
13
+ - **Campaign Management**: Create, launch, monitor, and manage phishing campaigns with comprehensive result tracking
13
14
  - **CSV Import Support**: Easy bulk import of targets from CSV files
14
- - **Email Template Management**: Create, modify, and manage email templates with attachment support
15
+ - **Email Template Management**: Create, modify, and manage email templates with attachment support and envelope sender configuration
15
16
  - **Email Import**: Import existing emails and convert them to templates
16
17
  - **Site Import**: Import landing pages directly from existing websites
17
18
  - **Page Management**: Create, modify, and manage landing pages with credential capture
19
+ - **SMTP Configuration**: Create, modify, and manage SMTP sending profiles with authentication and header support
18
20
  - **SSL Configuration**: Configurable SSL verification for development environments
19
21
  - **Debug Support**: Built-in debugging capabilities for API interactions
20
22
  - **Change Tracking**: Automatic tracking of attribute changes with ActiveModel::Dirty
@@ -471,6 +473,359 @@ if page.captures_credentials?
471
473
  end
472
474
  ```
473
475
 
476
+ ### SMTP Management
477
+
478
+ SMTP sending profiles define the mail server configuration for sending phishing emails in your campaigns.
479
+
480
+ #### Creating an SMTP Profile
481
+
482
+ ```ruby
483
+ # Create a basic SMTP profile
484
+ smtp = Gophish::Smtp.new(
485
+ name: "Company Mail Server",
486
+ host: "smtp.company.com",
487
+ from_address: "security@company.com"
488
+ )
489
+
490
+ # Save the SMTP profile to Gophish
491
+ if smtp.save
492
+ puts "SMTP profile created successfully with ID: #{smtp.id}"
493
+ else
494
+ puts "Failed to create SMTP profile: #{smtp.errors.full_messages}"
495
+ end
496
+ ```
497
+
498
+ #### Creating an SMTP Profile with Authentication
499
+
500
+ ```ruby
501
+ # Create an SMTP profile with username/password authentication
502
+ smtp = Gophish::Smtp.new(
503
+ name: "Gmail SMTP",
504
+ host: "smtp.gmail.com",
505
+ from_address: "phishing@company.com",
506
+ username: "smtp_username",
507
+ password: "smtp_password",
508
+ ignore_cert_errors: false
509
+ )
510
+
511
+ if smtp.save
512
+ puts "SMTP profile created with authentication"
513
+ puts "Has authentication: #{smtp.has_authentication?}"
514
+ puts "Ignores cert errors: #{smtp.ignores_cert_errors?}"
515
+ end
516
+ ```
517
+
518
+ #### Managing Custom Headers
519
+
520
+ ```ruby
521
+ # Add custom headers to the SMTP profile
522
+ smtp = Gophish::Smtp.new(
523
+ name: "Custom Headers SMTP",
524
+ host: "mail.company.com",
525
+ from_address: "security@company.com"
526
+ )
527
+
528
+ # Add headers for email routing and identification
529
+ smtp.add_header("X-Mailer", "Company Security Tool")
530
+ smtp.add_header("X-Campaign-Type", "Phishing Simulation")
531
+ smtp.add_header("Return-Path", "bounces@company.com")
532
+
533
+ puts "Header count: #{smtp.header_count}"
534
+ puts "Has headers: #{smtp.has_headers?}"
535
+
536
+ # Remove a specific header
537
+ smtp.remove_header("X-Campaign-Type")
538
+ puts "Headers after removal: #{smtp.header_count}"
539
+ ```
540
+
541
+ #### Retrieving SMTP Profiles
542
+
543
+ ```ruby
544
+ # Get all SMTP profiles
545
+ smtp_profiles = Gophish::Smtp.all
546
+ puts "Found #{smtp_profiles.length} SMTP profiles"
547
+
548
+ # Find a specific SMTP profile by ID
549
+ smtp = Gophish::Smtp.find(1)
550
+ puts "SMTP Profile: #{smtp.name} (#{smtp.host})"
551
+ ```
552
+
553
+ #### Updating an SMTP Profile
554
+
555
+ ```ruby
556
+ # Update SMTP profile settings
557
+ smtp = Gophish::Smtp.find(1)
558
+ smtp.name = "Updated SMTP Server"
559
+ smtp.ignore_cert_errors = true
560
+
561
+ # Add new headers
562
+ smtp.add_header("X-Priority", "1")
563
+
564
+ if smtp.save
565
+ puts "SMTP profile updated successfully"
566
+ end
567
+ ```
568
+
569
+ #### Deleting an SMTP Profile
570
+
571
+ ```ruby
572
+ smtp = Gophish::Smtp.find(1)
573
+ if smtp.destroy
574
+ puts "SMTP profile deleted successfully"
575
+ end
576
+ ```
577
+
578
+ ### SMTP Validation and Error Handling
579
+
580
+ The SDK provides comprehensive validation for SMTP profiles:
581
+
582
+ ```ruby
583
+ # Invalid SMTP profile (missing required fields)
584
+ smtp = Gophish::Smtp.new(name: "", host: "", from_address: "")
585
+
586
+ unless smtp.valid?
587
+ puts "Validation errors:"
588
+ smtp.errors.full_messages.each { |msg| puts " - #{msg}" }
589
+ # => ["Name can't be blank", "Host can't be blank", "From address can't be blank"]
590
+ end
591
+
592
+ # Invalid email format
593
+ smtp = Gophish::Smtp.new(
594
+ name: "Test SMTP",
595
+ host: "smtp.test.com",
596
+ from_address: "invalid-email-format"
597
+ )
598
+
599
+ unless smtp.valid?
600
+ puts smtp.errors.full_messages
601
+ # => ["From address must be a valid email format (email@domain.com)"]
602
+ end
603
+
604
+ # Check SMTP configuration
605
+ if smtp.has_authentication?
606
+ puts "SMTP uses authentication"
607
+ end
608
+
609
+ if smtp.ignores_cert_errors?
610
+ puts "SMTP ignores certificate errors (not recommended for production)"
611
+ end
612
+ ```
613
+
614
+ ### Campaign Management
615
+
616
+ Campaigns are the core of Gophish phishing simulations, orchestrating the sending of phishing emails to target groups using templates, landing pages, and SMTP profiles.
617
+
618
+ #### Creating a Campaign
619
+
620
+ ```ruby
621
+ # Create a basic phishing campaign
622
+ campaign = Gophish::Campaign.new(
623
+ name: "Q1 Security Awareness Training",
624
+ template: { name: "Phishing Template" }, # Reference existing template
625
+ page: { name: "Login Page" }, # Reference existing landing page
626
+ groups: [{ name: "Marketing Team" }], # Reference existing groups
627
+ smtp: { name: "Company SMTP" }, # Reference existing SMTP profile
628
+ url: "https://phishing.company.com" # Base URL for campaign
629
+ )
630
+
631
+ # Save the campaign to Gophish
632
+ if campaign.save
633
+ puts "Campaign created successfully with ID: #{campaign.id}"
634
+ puts "Campaign status: #{campaign.status}"
635
+ else
636
+ puts "Failed to create campaign: #{campaign.errors.full_messages}"
637
+ end
638
+ ```
639
+
640
+ #### Creating a Campaign with Scheduling
641
+
642
+ ```ruby
643
+ # Create a campaign with launch and send-by dates
644
+ campaign = Gophish::Campaign.new(
645
+ name: "Scheduled Phishing Test",
646
+ template: { name: "Email Template" },
647
+ page: { name: "Landing Page" },
648
+ groups: [{ name: "HR Department" }],
649
+ smtp: { name: "SMTP Profile" },
650
+ url: "https://training.company.com",
651
+ launch_date: "2024-01-15T09:00:00Z", # When to start sending
652
+ send_by_date: "2024-01-15T17:00:00Z" # Deadline for sending all emails
653
+ )
654
+
655
+ if campaign.save
656
+ puts "Scheduled campaign created"
657
+ puts "Launched? #{campaign.launched?}"
658
+ puts "Has send by date? #{campaign.has_send_by_date?}"
659
+ end
660
+ ```
661
+
662
+ #### Monitoring Campaign Status
663
+
664
+ ```ruby
665
+ # Check campaign status and progress
666
+ campaign = Gophish::Campaign.find(1)
667
+
668
+ puts "Campaign: #{campaign.name}"
669
+ puts "Status: #{campaign.status}"
670
+ puts "In progress? #{campaign.in_progress?}"
671
+ puts "Completed? #{campaign.completed?}"
672
+
673
+ # Get campaign results
674
+ results = campaign.get_results
675
+ puts "Total results: #{results.length}"
676
+
677
+ # Get campaign summary
678
+ summary = campaign.get_summary
679
+ puts "Campaign summary: #{summary}"
680
+ ```
681
+
682
+ #### Managing Campaign Results
683
+
684
+ ```ruby
685
+ # Access detailed campaign results
686
+ campaign = Gophish::Campaign.find(1)
687
+
688
+ campaign.results.each do |result|
689
+ puts "Target: #{result.email}"
690
+ puts " Status: #{result.status}"
691
+ puts " Clicked: #{result.clicked?}"
692
+ puts " Opened: #{result.opened?}"
693
+ puts " Submitted data: #{result.submitted_data?}"
694
+ puts " Reported: #{result.reported?}"
695
+ puts " IP: #{result.ip}" if result.ip
696
+ puts ""
697
+ end
698
+
699
+ # Filter results by status
700
+ clicked_results = campaign.results.select(&:clicked?)
701
+ puts "#{clicked_results.length} users clicked the link"
702
+
703
+ reported_results = campaign.results.select(&:reported?)
704
+ puts "#{reported_results.length} users reported the email"
705
+ ```
706
+
707
+ #### Monitoring Campaign Timeline
708
+
709
+ ```ruby
710
+ # Access campaign timeline events
711
+ campaign = Gophish::Campaign.find(1)
712
+
713
+ campaign.timeline.each do |event|
714
+ puts "#{event.time}: #{event.message}"
715
+ puts " Email: #{event.email}"
716
+
717
+ # Check for additional details (JSON data)
718
+ if event.has_details?
719
+ details = event.parsed_details
720
+ puts " Details: #{details}"
721
+ end
722
+ puts ""
723
+ end
724
+ ```
725
+
726
+ #### Completing a Campaign
727
+
728
+ ```ruby
729
+ # Manually complete a running campaign
730
+ campaign = Gophish::Campaign.find(1)
731
+
732
+ if campaign.in_progress?
733
+ result = campaign.complete!
734
+
735
+ if result['success']
736
+ puts "Campaign completed successfully"
737
+ puts "Final status: #{campaign.status}"
738
+ else
739
+ puts "Failed to complete campaign: #{result['message']}"
740
+ end
741
+ else
742
+ puts "Campaign is not in progress"
743
+ end
744
+ ```
745
+
746
+ #### Retrieving Campaigns
747
+
748
+ ```ruby
749
+ # Get all campaigns
750
+ campaigns = Gophish::Campaign.all
751
+ puts "Found #{campaigns.length} campaigns"
752
+
753
+ campaigns.each do |campaign|
754
+ puts "#{campaign.name}: #{campaign.status}"
755
+ end
756
+
757
+ # Find a specific campaign by ID
758
+ campaign = Gophish::Campaign.find(1)
759
+ puts "Campaign: #{campaign.name}"
760
+ puts "Groups: #{campaign.groups.map(&:name).join(', ')}"
761
+ ```
762
+
763
+ #### Using Class Methods for Results
764
+
765
+ ```ruby
766
+ # Get results without loading full campaign
767
+ results = Gophish::Campaign.get_results(1)
768
+ puts "Campaign has #{results.length} results"
769
+
770
+ # Get summary without loading full campaign
771
+ summary = Gophish::Campaign.get_summary(1)
772
+ puts "Campaign summary stats: #{summary['stats']}"
773
+
774
+ # Complete campaign without loading it
775
+ Gophish::Campaign.complete(1)
776
+ ```
777
+
778
+ #### Campaign Validation and Error Handling
779
+
780
+ ```ruby
781
+ # Invalid campaign (missing required components)
782
+ campaign = Gophish::Campaign.new(name: "Incomplete Campaign")
783
+
784
+ unless campaign.valid?
785
+ puts "Validation errors:"
786
+ campaign.errors.full_messages.each { |msg| puts " - #{msg}" }
787
+ # => ["Template can't be blank", "Page can't be blank", "Groups can't be blank",
788
+ # "Smtp can't be blank", "Url can't be blank"]
789
+ end
790
+
791
+ # Campaign with invalid group structure
792
+ campaign = Gophish::Campaign.new(
793
+ name: "Test Campaign",
794
+ template: { name: "Template" },
795
+ page: { name: "Page" },
796
+ groups: [{}], # Invalid: group missing name
797
+ smtp: { name: "SMTP" },
798
+ url: "https://test.com"
799
+ )
800
+
801
+ unless campaign.valid?
802
+ puts campaign.errors.full_messages
803
+ # => ["Groups item at index 0 must have a name"]
804
+ end
805
+ ```
806
+
807
+ ### Template Enhancement - Envelope Sender
808
+
809
+ Templates now support envelope sender configuration for better email delivery control.
810
+
811
+ #### Using Envelope Sender
812
+
813
+ ```ruby
814
+ # Create a template with envelope sender
815
+ template = Gophish::Template.new(
816
+ name: "Corporate Phishing Test",
817
+ envelope_sender: "noreply@company.com", # Envelope sender address
818
+ subject: "IT Security Update Required",
819
+ html: "<h1>Please update your credentials</h1><p>Click <a href='{{.URL}}'>here</a></p>"
820
+ )
821
+
822
+ if template.save
823
+ puts "Template created with envelope sender"
824
+ puts "Has envelope sender: #{template.has_envelope_sender?}"
825
+ puts "Envelope sender: #{template.envelope_sender}"
826
+ end
827
+ ```
828
+
474
829
  ## API Documentation
475
830
 
476
831
  ### Core Classes
@@ -539,6 +894,7 @@ Represents a Gophish email template.
539
894
 
540
895
  - `id` (Integer) - Unique template identifier
541
896
  - `name` (String) - Template name (required)
897
+ - `envelope_sender` (String) - Envelope sender email address
542
898
  - `subject` (String) - Email subject line
543
899
  - `text` (String) - Plain text email content
544
900
  - `html` (String) - HTML email content
@@ -562,6 +918,7 @@ Each attachment in the `attachments` array should have:
562
918
  - `#remove_attachment(name)` - Remove an attachment by filename
563
919
  - `#has_attachments?` - Check if template has any attachments
564
920
  - `#attachment_count` - Get the number of attachments
921
+ - `#has_envelope_sender?` - Check if template has an envelope sender configured
565
922
 
566
923
  **Validations:**
567
924
 
@@ -598,6 +955,139 @@ Represents a Gophish landing page for phishing campaigns.
598
955
  - Page must have a name
599
956
  - Page must have HTML content
600
957
 
958
+ #### `Gophish::Smtp`
959
+
960
+ Represents a Gophish SMTP sending profile for email campaigns.
961
+
962
+ **Attributes:**
963
+
964
+ - `id` (Integer) - Unique SMTP profile identifier
965
+ - `name` (String) - SMTP profile name (required)
966
+ - `username` (String) - SMTP authentication username
967
+ - `password` (String) - SMTP authentication password
968
+ - `host` (String) - SMTP server hostname (required)
969
+ - `interface_type` (String) - Interface type (default: "SMTP")
970
+ - `from_address` (String) - From email address (required, must be valid email format)
971
+ - `ignore_cert_errors` (Boolean) - Whether to ignore SSL certificate errors (default: false)
972
+ - `modified_date` (String) - Last modification timestamp
973
+ - `headers` (Array) - Array of custom header hashes
974
+
975
+ **Header Structure:**
976
+ Each header in the `headers` array should have:
977
+
978
+ - `key` (String) - Header name (required)
979
+ - `value` (String) - Header value (required)
980
+
981
+ **Instance Methods:**
982
+
983
+ - `#add_header(key, value)` - Add a custom header to the SMTP profile
984
+ - `#remove_header(key)` - Remove a header by key name
985
+ - `#has_headers?` - Check if SMTP profile has any custom headers
986
+ - `#header_count` - Get the number of custom headers
987
+ - `#has_authentication?` - Check if SMTP profile uses authentication (username/password)
988
+ - `#ignores_cert_errors?` - Check if SMTP profile ignores SSL certificate errors
989
+
990
+ **Validations:**
991
+
992
+ - SMTP profile must have a name
993
+ - SMTP profile must have a host
994
+ - SMTP profile must have a from_address in valid email format
995
+ - All headers must have both key and value
996
+
997
+ #### `Gophish::Campaign`
998
+
999
+ Represents a Gophish phishing campaign that orchestrates email sending to target groups.
1000
+
1001
+ **Attributes:**
1002
+
1003
+ - `id` (Integer) - Unique campaign identifier
1004
+ - `name` (String) - Campaign name (required)
1005
+ - `created_date` (String) - Campaign creation timestamp
1006
+ - `launch_date` (String) - When the campaign should start sending emails
1007
+ - `send_by_date` (String) - Deadline for sending all campaign emails
1008
+ - `completed_date` (String) - When the campaign was completed
1009
+ - `template` - Reference to email template (required, can be hash or Template instance)
1010
+ - `page` - Reference to landing page (required, can be hash or Page instance)
1011
+ - `status` (String) - Current campaign status (e.g., "In progress", "Completed")
1012
+ - `results` (Array) - Array of Result instances showing target interactions
1013
+ - `groups` (Array) - Array of target groups (required, can be hashes or Group instances)
1014
+ - `timeline` (Array) - Array of Event instances showing campaign timeline
1015
+ - `smtp` - Reference to SMTP profile (required, can be hash or Smtp instance)
1016
+ - `url` (String) - Base URL for the campaign (required)
1017
+
1018
+ **Class Methods:**
1019
+
1020
+ - `.get_results(id)` - Get campaign results by campaign ID
1021
+ - `.get_summary(id)` - Get campaign summary statistics by ID
1022
+ - `.complete(id)` - Complete a campaign by ID
1023
+
1024
+ **Instance Methods:**
1025
+
1026
+ - `#get_results` - Get detailed campaign results
1027
+ - `#get_summary` - Get campaign summary statistics
1028
+ - `#complete!` - Complete the campaign and update status
1029
+ - `#in_progress?` - Check if campaign is currently running
1030
+ - `#completed?` - Check if campaign has been completed
1031
+ - `#launched?` - Check if campaign has a launch date set
1032
+ - `#has_send_by_date?` - Check if campaign has a send-by deadline
1033
+
1034
+ **Validations:**
1035
+
1036
+ - Campaign must have a name
1037
+ - Campaign must reference a template
1038
+ - Campaign must reference a page
1039
+ - Campaign must have at least one group
1040
+ - Campaign must reference an SMTP profile
1041
+ - Campaign must have a URL
1042
+ - All groups must have names
1043
+ - All results must have email addresses
1044
+ - All timeline events must have time and message
1045
+
1046
+ **Nested Classes:**
1047
+
1048
+ ##### `Gophish::Campaign::Result`
1049
+
1050
+ Represents individual target results within a campaign.
1051
+
1052
+ **Attributes:**
1053
+
1054
+ - `id` (String) - Result identifier
1055
+ - `first_name` (String) - Target's first name
1056
+ - `last_name` (String) - Target's last name
1057
+ - `position` (String) - Target's position
1058
+ - `email` (String) - Target's email address
1059
+ - `status` (String) - Current result status
1060
+ - `ip` (String) - IP address of target interactions
1061
+ - `latitude` (Float) - Geographic latitude
1062
+ - `longitude` (Float) - Geographic longitude
1063
+ - `send_date` (String) - When email was sent
1064
+ - `reported` (Boolean) - Whether target reported the email
1065
+ - `modified_date` (String) - Last modification timestamp
1066
+
1067
+ **Instance Methods:**
1068
+
1069
+ - `#reported?` - Check if target reported the phishing email
1070
+ - `#clicked?` - Check if target clicked the phishing link
1071
+ - `#opened?` - Check if target opened the email
1072
+ - `#sent?` - Check if email was sent to target
1073
+ - `#submitted_data?` - Check if target submitted data on landing page
1074
+
1075
+ ##### `Gophish::Campaign::Event`
1076
+
1077
+ Represents timeline events within a campaign.
1078
+
1079
+ **Attributes:**
1080
+
1081
+ - `email` (String) - Target email associated with event
1082
+ - `time` (String) - Event timestamp
1083
+ - `message` (String) - Event description
1084
+ - `details` (String) - Additional event details (JSON string)
1085
+
1086
+ **Instance Methods:**
1087
+
1088
+ - `#has_details?` - Check if event has additional details
1089
+ - `#parsed_details` - Parse details JSON into hash
1090
+
601
1091
  ## Development
602
1092
 
603
1093
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.