| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package STIX::Common::Bundle; |
|
2
|
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
238950
|
use 5.010001; |
|
|
26
|
|
|
|
|
120
|
|
|
4
|
26
|
|
|
26
|
|
184
|
use strict; |
|
|
26
|
|
|
|
|
74
|
|
|
|
26
|
|
|
|
|
904
|
|
|
5
|
26
|
|
|
26
|
|
146
|
use warnings; |
|
|
26
|
|
|
|
|
59
|
|
|
|
26
|
|
|
|
|
1717
|
|
|
6
|
26
|
|
|
26
|
|
1033
|
use utf8; |
|
|
26
|
|
|
|
|
583
|
|
|
|
26
|
|
|
|
|
246
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
26
|
|
|
26
|
|
1848
|
use STIX::Common::List; |
|
|
26
|
|
|
|
|
59
|
|
|
|
26
|
|
|
|
|
1211
|
|
|
9
|
26
|
|
|
26
|
|
1330
|
use Types::Standard qw(StrMatch InstanceOf); |
|
|
26
|
|
|
|
|
270453
|
|
|
|
26
|
|
|
|
|
278
|
|
|
10
|
26
|
|
|
26
|
|
91391
|
use Types::TypeTiny qw(ArrayLike); |
|
|
26
|
|
|
|
|
75
|
|
|
|
26
|
|
|
|
|
213
|
|
|
11
|
26
|
|
|
26
|
|
21520
|
use UUID::Tiny qw(:std); |
|
|
26
|
|
|
|
|
62862
|
|
|
|
26
|
|
|
|
|
8049
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
26
|
|
|
26
|
|
1584
|
use Moo; |
|
|
26
|
|
|
|
|
19305
|
|
|
|
26
|
|
|
|
|
261
|
|
|
14
|
26
|
|
|
26
|
|
22039
|
use namespace::autoclean; |
|
|
26
|
|
|
|
|
61936
|
|
|
|
26
|
|
|
|
|
346
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'STIX::Object'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
26
|
|
|
|
|
4258
|
use constant SCHEMA => |
|
19
|
26
|
|
|
26
|
|
3053
|
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/common/bundle.json'; |
|
|
26
|
|
|
|
|
60
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
26
|
|
|
26
|
|
173
|
use constant PROPERTIES => qw(type id objects); |
|
|
26
|
|
|
|
|
58
|
|
|
|
26
|
|
|
|
|
1838
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
26
|
|
|
26
|
|
166
|
use constant STIX_OBJECT_TYPE => 'bundle'; |
|
|
26
|
|
|
|
|
105
|
|
|
|
26
|
|
|
|
|
8667
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has type => (is => 'ro', default => 'bundle'); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has objects => (is => 'rw', isa => ArrayLike [InstanceOf ['STIX::Object']], default => sub { STIX::Common::List->new }); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has id => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', |
|
31
|
|
|
|
|
|
|
isa => StrMatch [ |
|
32
|
|
|
|
|
|
|
qr{^[a-z][a-z0-9-]+[a-z0-9]--[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$} |
|
33
|
|
|
|
|
|
|
], |
|
34
|
|
|
|
|
|
|
lazy => 1, |
|
35
|
|
|
|
|
|
|
default => sub { shift->generate_id } |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf-8 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
STIX::Common::Bundle - STIX Bundle |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use STIX::Common::Bundle; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $bundle = STIX::Common::Bundle->new( |
|
51
|
|
|
|
|
|
|
objects => [ |
|
52
|
|
|
|
|
|
|
STIX::Vulnerability->new( ... ), |
|
53
|
|
|
|
|
|
|
STIX::Sighting->new( ... ), |
|
54
|
|
|
|
|
|
|
STIX::Common::Relationship->new( ... ) |
|
55
|
|
|
|
|
|
|
] |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# append new STIX object |
|
59
|
|
|
|
|
|
|
push @{ $bundle->objects }, STIX::Incident->new( ... ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# append new STIX object using STIX::Common::List->push |
|
62
|
|
|
|
|
|
|
$bundle->objects->push( STIX::Indicator->new( ... ) ); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
A Bundle is a collection of arbitrary STIX Objects and Marking Definitions |
|
68
|
|
|
|
|
|
|
grouped together in a single container. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 METHODS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L inherits all methods from L |
|
74
|
|
|
|
|
|
|
and implements the following new ones. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item STIX::Common::Bundle->new(%properties) |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Create a new instance of L. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item $bundle->id |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
An identifier for this bundle. The id field for the Bundle is designed to |
|
85
|
|
|
|
|
|
|
help tools that may need it for processing, but tools are not required to |
|
86
|
|
|
|
|
|
|
store or track it. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item $bundle->objects |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Specifies a set of one or more STIX Objects. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item $bundle->type |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The type of this object, which MUST be the literal C. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 HELPERS |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item $bundle->TO_JSON |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Helper for JSON encoders. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item $bundle->to_hash |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Return the object HASH. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item $bundle->to_string |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Encode the object in JSON. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item $bundle->validate |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Validate the object using JSON Schema (see L). |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SUPPORT |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
|
127
|
|
|
|
|
|
|
at L. |
|
128
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 Source Code |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
|
133
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
L |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
git clone https://github.com/giterlizzi/perl-STIX.git |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over 4 |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * Giuseppe Di Terlizzi |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=back |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This software is copyright (c) 2024 by Giuseppe Di Terlizzi. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
154
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |