| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package STIX::Common::ExtensionDefinition; |
|
2
|
|
|
|
|
|
|
|
|
3
|
24
|
|
|
24
|
|
554
|
use 5.010001; |
|
|
24
|
|
|
|
|
104
|
|
|
4
|
24
|
|
|
24
|
|
164
|
use strict; |
|
|
24
|
|
|
|
|
61
|
|
|
|
24
|
|
|
|
|
683
|
|
|
5
|
24
|
|
|
24
|
|
164
|
use warnings; |
|
|
24
|
|
|
|
|
83
|
|
|
|
24
|
|
|
|
|
1551
|
|
|
6
|
24
|
|
|
24
|
|
185
|
use utf8; |
|
|
24
|
|
|
|
|
111
|
|
|
|
24
|
|
|
|
|
281
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
24
|
|
|
24
|
|
1083
|
use STIX::Common::Enum; |
|
|
24
|
|
|
|
|
69
|
|
|
|
24
|
|
|
|
|
826
|
|
|
9
|
24
|
|
|
24
|
|
130
|
use STIX::Common::List; |
|
|
24
|
|
|
|
|
55
|
|
|
|
24
|
|
|
|
|
883
|
|
|
10
|
24
|
|
|
24
|
|
147
|
use Types::Standard qw(Str Enum); |
|
|
24
|
|
|
|
|
74
|
|
|
|
24
|
|
|
|
|
250
|
|
|
11
|
24
|
|
|
24
|
|
88425
|
use Types::TypeTiny qw(ArrayLike); |
|
|
24
|
|
|
|
|
73
|
|
|
|
24
|
|
|
|
|
220
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
24
|
|
|
24
|
|
15343
|
use Moo; |
|
|
24
|
|
|
|
|
62
|
|
|
|
24
|
|
|
|
|
212
|
|
|
14
|
24
|
|
|
24
|
|
11733
|
use namespace::autoclean; |
|
|
24
|
|
|
|
|
63
|
|
|
|
24
|
|
|
|
|
307
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'STIX::Common::Properties'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
24
|
|
|
|
|
2799
|
use constant SCHEMA => |
|
19
|
24
|
|
|
24
|
|
2837
|
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/common/extension-definition.json'; |
|
|
24
|
|
|
|
|
68
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
24
|
|
|
|
|
1882
|
use constant PROPERTIES => ( |
|
22
|
|
|
|
|
|
|
qw(type spec_version id created modified created_by_ref), |
|
23
|
|
|
|
|
|
|
qw(revoked labels external_references object_marking_refs granular_markings), |
|
24
|
|
|
|
|
|
|
qw(name description schema version extension_types extension_properties) |
|
25
|
24
|
|
|
24
|
|
168
|
); |
|
|
24
|
|
|
|
|
64
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
24
|
|
|
24
|
|
176
|
use constant STIX_OBJECT_TYPE => 'extension-definition'; |
|
|
24
|
|
|
|
|
61
|
|
|
|
24
|
|
|
|
|
6468
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has name => (is => 'rw', isa => Str, required => 1); |
|
30
|
|
|
|
|
|
|
has description => (is => 'rw', isa => Str); |
|
31
|
|
|
|
|
|
|
has schema => (is => 'rw', isa => Str, required => 1); |
|
32
|
|
|
|
|
|
|
has version => (is => 'rw', isa => Str, required => 1); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has extension_types => ( |
|
35
|
|
|
|
|
|
|
is => 'rw', |
|
36
|
|
|
|
|
|
|
isa => ArrayLike [Enum [STIX::Common::Enum->EXTENSION_TYPE()]], |
|
37
|
|
|
|
|
|
|
required => 1, |
|
38
|
|
|
|
|
|
|
default => sub { [] } |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has extension_properties => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new }); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=encoding utf-8 |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
STIX::Common::ExtensionDefinition - STIX Extension Definition |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use STIX::Common::ExtensionDefinition; |
|
54
|
|
|
|
|
|
|
use STIX::Indicator; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $extension_definition = STIX::Common::ExtensionDefinition->new( |
|
57
|
|
|
|
|
|
|
extension_types => ['property-extension'], |
|
58
|
|
|
|
|
|
|
name => 'Extension Foo 1', |
|
59
|
|
|
|
|
|
|
schema => 'https://www.example.com/schema-foo-1/v1/', |
|
60
|
|
|
|
|
|
|
version => '1.2.1', |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $indicator = STIX::Indicator->new( |
|
64
|
|
|
|
|
|
|
name => 'File hash for Poison Ivy variant', |
|
65
|
|
|
|
|
|
|
description => 'This file hash indicates that a sample of Poison Ivy is present.', |
|
66
|
|
|
|
|
|
|
labels => ['malicious-activity'], |
|
67
|
|
|
|
|
|
|
pattern => q{[file:hashes.'SHA-256' = 'ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c']}, |
|
68
|
|
|
|
|
|
|
pattern_type => 'stix', |
|
69
|
|
|
|
|
|
|
valid_from => '2014-02-20T09:00:00.000000Z', |
|
70
|
|
|
|
|
|
|
extensions => {$extension_definition->id => {extension_type => 'property-extension', rank => 5, toxicity => 8}} |
|
71
|
|
|
|
|
|
|
); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The STIX Extension Definition object allows producers of threat |
|
77
|
|
|
|
|
|
|
intelligence to extend existing STIX objects or to create entirely new STIX |
|
78
|
|
|
|
|
|
|
objects in a standardized way. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 METHODS |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L inherits all methods from L |
|
84
|
|
|
|
|
|
|
and implements the following new ones. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item STIX::Common::ExtensionDefinition->new(%properties) |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Create a new instance of L. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item $extension_definition->description |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
A detailed explanation of what data the extension conveys and how it is |
|
95
|
|
|
|
|
|
|
intended to be used. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item $extension_definition->extension_properties |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
The list of new property names that are added to an object by this |
|
100
|
|
|
|
|
|
|
extension |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item $extension_definition->extension_types |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Which extension types are contained within this extension. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item $extension_definition->id |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item $extension_definition->name |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
A name used for display purposes during execution, development, or |
|
111
|
|
|
|
|
|
|
debugging. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item $extension_definition->schema |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
The normative definition of the extension, either as a URL or as plain text |
|
116
|
|
|
|
|
|
|
explaining the definition. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item $extension_definition->type |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The type of this object, which MUST be the literal C. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item $extension_definition->version |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The version of this extension. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 HELPERS |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item $extension_definition->TO_JSON |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Helper for JSON encoders. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item $extension_definition->to_hash |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Return the object HASH. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item $extension_definition->to_string |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Encode the object in JSON. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item $extension_definition->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 |