File Coverage

blib/lib/STIX/Campaign.pm
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod n/a
total 51 51 100.0


line stmt bran cond sub pod time code
1             package STIX::Campaign;
2              
3 24     24   538 use 5.010001;
  24         105  
4 24     24   170 use strict;
  24         47  
  24         790  
5 24     24   134 use warnings;
  24         53  
  24         1934  
6 24     24   176 use utf8;
  24         47  
  24         246  
7              
8 24     24   1242 use STIX::Common::List;
  24         60  
  24         1145  
9 24     24   135 use Types::Standard qw(Str InstanceOf);
  24         89  
  24         302  
10 24     24   53580 use Types::TypeTiny qw(ArrayLike);
  24         60  
  24         199  
11              
12 24     24   15854 use Moo;
  24         63  
  24         203  
13 24     24   11545 use namespace::autoclean;
  24         62  
  24         292  
14              
15             extends 'STIX::Common::Properties';
16              
17 24         2860 use constant SCHEMA =>
18 24     24   3221 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/campaign.json';
  24         56  
19              
20 24         1981 use constant PROPERTIES => (
21             qw(type spec_version id created modified),
22             qw(created_by_ref revoked labels confidence lang external_references object_marking_refs granular_markings extensions),
23             qw(name description aliases first_seen last_seen objective)
24 24     24   171 );
  24         74  
25              
26 24     24   159 use constant STIX_OBJECT => 'SDO';
  24         57  
  24         1284  
27 24     24   132 use constant STIX_OBJECT_TYPE => 'campaign';
  24         55  
  24         11874  
28              
29             has name => (is => 'rw', isa => Str, required => 1);
30             has description => (is => 'rw', isa => Str);
31             has aliases => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
32              
33             has first_seen => (
34             is => 'rw',
35             isa => InstanceOf ['STIX::Common::Timestamp'],
36             coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
37             );
38              
39             has last_seen => (
40             is => 'rw',
41             isa => InstanceOf ['STIX::Common::Timestamp'],
42             coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
43             );
44              
45             has objective => (is => 'rw', isa => Str);
46              
47             1;
48              
49              
50             =encoding utf-8
51              
52             =head1 NAME
53              
54             STIX::Campaign - STIX Domain Object (SDO) - Campaign
55              
56             =head1 SYNOPSIS
57              
58             use STIX::Campaign;
59              
60             my $campaign = STIX::Campaign->new();
61              
62              
63             =head1 DESCRIPTION
64              
65             A Campaign is a grouping of adversary behavior that describes a set of
66             malicious activities or attacks that occur over a period of time against a
67             specific set of targets.
68              
69              
70             =head2 METHODS
71              
72             L inherits all methods from L
73             and implements the following new ones.
74              
75             =over
76              
77             =item STIX::Campaign->new(%properties)
78              
79             Create a new instance of L.
80              
81             =item $campaign->aliases
82              
83             Alternative names used to identify this campaign.
84              
85             =item $campaign->description
86              
87             A description that provides more details and context about the Campaign,
88             potentially including its purpose and its key characteristics.
89              
90             =item $campaign->first_seen
91              
92             The time that this Campaign was first seen.
93              
94             =item $campaign->id
95              
96             =item $campaign->last_seen
97              
98             The time that this Campaign was last seen.
99              
100             =item $campaign->name
101              
102             The name used to identify the Campaign.
103              
104             =item $campaign->objective
105              
106             This field defines the Campaign’s primary goal, objective, desired outcome,
107             or intended effect.
108              
109             =item $campaign->type
110              
111             The type of this object, which MUST be the literal C.
112              
113             =back
114              
115              
116             =head2 HELPERS
117              
118             =over
119              
120             =item $campaign->TO_JSON
121              
122             Encode the object in JSON.
123              
124             =item $campaign->to_hash
125              
126             Return the object HASH.
127              
128             =item $campaign->to_string
129              
130             Encode the object in JSON.
131              
132             =item $campaign->validate
133              
134             Validate the object using JSON Schema (see L).
135              
136             =back
137              
138              
139             =head1 SUPPORT
140              
141             =head2 Bugs / Feature Requests
142              
143             Please report any bugs or feature requests through the issue tracker
144             at L.
145             You will be notified automatically of any progress on your issue.
146              
147             =head2 Source Code
148              
149             This is open source software. The code repository is available for
150             public review and contribution under the terms of the license.
151              
152             L
153              
154             git clone https://github.com/giterlizzi/perl-STIX.git
155              
156              
157             =head1 AUTHOR
158              
159             =over 4
160              
161             =item * Giuseppe Di Terlizzi
162              
163             =back
164              
165              
166             =head1 LICENSE AND COPYRIGHT
167              
168             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
169              
170             This is free software; you can redistribute it and/or modify it under
171             the same terms as the Perl 5 programming language system itself.
172              
173             =cut