File Coverage

blib/lib/STIX/Infrastructure.pm
Criterion Covered Total %
statement 41 41 100.0
branch n/a
condition n/a
subroutine 14 14 100.0
pod n/a
total 55 55 100.0


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