| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package STIX::Observable::File; |
|
2
|
|
|
|
|
|
|
|
|
3
|
24
|
|
|
24
|
|
560
|
use 5.010001; |
|
|
24
|
|
|
|
|
106
|
|
|
4
|
24
|
|
|
24
|
|
161
|
use strict; |
|
|
24
|
|
|
|
|
53
|
|
|
|
24
|
|
|
|
|
649
|
|
|
5
|
24
|
|
|
24
|
|
104
|
use warnings; |
|
|
24
|
|
|
|
|
50
|
|
|
|
24
|
|
|
|
|
1410
|
|
|
6
|
24
|
|
|
24
|
|
142
|
use utf8; |
|
|
24
|
|
|
|
|
52
|
|
|
|
24
|
|
|
|
|
186
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
24
|
|
|
24
|
|
1088
|
use Types::Standard qw(Str HashRef Int InstanceOf); |
|
|
24
|
|
|
|
|
50
|
|
|
|
24
|
|
|
|
|
310
|
|
|
9
|
24
|
|
|
24
|
|
88150
|
use Types::TypeTiny qw(ArrayLike); |
|
|
24
|
|
|
|
|
84
|
|
|
|
24
|
|
|
|
|
190
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
24
|
|
|
24
|
|
13551
|
use Moo; |
|
|
24
|
|
|
|
|
61
|
|
|
|
24
|
|
|
|
|
216
|
|
|
12
|
24
|
|
|
24
|
|
11562
|
use namespace::autoclean; |
|
|
24
|
|
|
|
|
64
|
|
|
|
24
|
|
|
|
|
281
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'STIX::Observable'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
24
|
|
|
|
|
2837
|
use constant SCHEMA => |
|
17
|
24
|
|
|
24
|
|
2909
|
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/file.json'; |
|
|
24
|
|
|
|
|
65
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
24
|
|
|
|
|
1842
|
use constant PROPERTIES => ( |
|
20
|
|
|
|
|
|
|
qw(type id), |
|
21
|
|
|
|
|
|
|
qw(spec_version object_marking_refs granular_markings defanged extensions), |
|
22
|
|
|
|
|
|
|
qw(hashes size name name_enc magic_number_hex mime_type ctime mtime atime parent_directory_ref contains_refs content_ref), |
|
23
|
24
|
|
|
24
|
|
160
|
); |
|
|
24
|
|
|
|
|
55
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
24
|
|
|
24
|
|
154
|
use constant STIX_OBJECT => 'SCO'; |
|
|
24
|
|
|
|
|
58
|
|
|
|
24
|
|
|
|
|
1303
|
|
|
26
|
24
|
|
|
24
|
|
132
|
use constant STIX_OBJECT_TYPE => 'file'; |
|
|
24
|
|
|
|
|
53
|
|
|
|
24
|
|
|
|
|
10845
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has hashes => (is => 'rw', isa => InstanceOf ['STIX::Common::Hashes']); |
|
29
|
|
|
|
|
|
|
has size => (is => 'rw', isa => Int); |
|
30
|
|
|
|
|
|
|
has name => (is => 'rw', isa => Str); |
|
31
|
|
|
|
|
|
|
has name_enc => (is => 'rw', isa => Str); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has magic_number_hex => ( |
|
34
|
|
|
|
|
|
|
is => 'rw', |
|
35
|
|
|
|
|
|
|
isa => InstanceOf ['STIX::Common::Hex'], |
|
36
|
|
|
|
|
|
|
coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Hex->new($_[0]) } |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has mime_type => (is => 'rw', isa => Str); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has ctime => ( |
|
42
|
|
|
|
|
|
|
is => 'rw', |
|
43
|
|
|
|
|
|
|
isa => InstanceOf ['STIX::Common::Timestamp'], |
|
44
|
|
|
|
|
|
|
coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) }, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has mtime => ( |
|
48
|
|
|
|
|
|
|
is => 'rw', |
|
49
|
|
|
|
|
|
|
isa => InstanceOf ['STIX::Common::Timestamp'], |
|
50
|
|
|
|
|
|
|
coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) }, |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has atime => ( |
|
54
|
|
|
|
|
|
|
is => 'rw', |
|
55
|
|
|
|
|
|
|
isa => InstanceOf ['STIX::Common::Timestamp'], |
|
56
|
|
|
|
|
|
|
coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) }, |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has parent_directory_ref => (is => 'rw', isa => InstanceOf ['STIX::Observable::Directory', 'STIX::Common::Identifier']); |
|
60
|
|
|
|
|
|
|
has contains_refs => |
|
61
|
|
|
|
|
|
|
(is => 'rw', isa => ArrayLike [InstanceOf ['STIX::Observable']], default => sub { STIX::Common::List->new }); |
|
62
|
|
|
|
|
|
|
has content_ref => (is => 'rw', isa => InstanceOf ['STIX::Observable::Artifact']); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding utf-8 |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
STIX::Observable::File - STIX Cyber-observable Object (SCO) - File |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
use STIX::Observable::File; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $file = STIX::Observable::File->new(); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The File Object represents the properties of a file. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 METHODS |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L inherits all methods from L |
|
87
|
|
|
|
|
|
|
and implements the following new ones. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item STIX::Observable::File->new(%properties) |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Create a new instance of L. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item $file->atime |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Specifies the date/time the file was last accessed. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item $file->contains_refs |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Specifies a list of references to other Observable Objects contained within |
|
102
|
|
|
|
|
|
|
the file. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item $file->content_ref |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Specifies the content of the file, represented as an Artifact Object. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item $file->ctime |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Specifies the date/time the file was created. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item $file->extensions |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
The File Object defines the following extensions. In addition to these, |
|
115
|
|
|
|
|
|
|
producers MAY create their own. Extensions: ntfs-ext, raster-image-ext, |
|
116
|
|
|
|
|
|
|
pdf-ext, archive-ext, windows-pebinary-ext |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item $file->hashes |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Specifies a dictionary of hashes for the file. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item $file->id |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item $file->magic_number_hex |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Specifies the hexadecimal constant ('magic number') associated with a |
|
127
|
|
|
|
|
|
|
specific file format that corresponds to the file, if applicable. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item $file->mime_type |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Specifies the MIME type name specified for the file, e.g., |
|
132
|
|
|
|
|
|
|
'application/msword'. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item $file->mtime |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Specifies the date/time the file was last written to/modified. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item $file->name |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Specifies the name of the file. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item $file->name_enc |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Specifies the observed encoding for the name of the file. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item $file->parent_directory_ref |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Specifies the parent directory of the file, as a reference to a Directory |
|
149
|
|
|
|
|
|
|
Object. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item $file->size |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Specifies the size of the file, in bytes, as a non-negative integer. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item $file->type |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The value of this property MUST be C. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 HELPERS |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=over |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item $file->TO_JSON |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Encode the object in JSON. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item $file->to_hash |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Return the object HASH. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item $file->to_string |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Encode the object in JSON. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item $file->validate |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Validate the object using JSON Schema (see L). |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=back |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 SUPPORT |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
|
190
|
|
|
|
|
|
|
at L. |
|
191
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 Source Code |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
|
196
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
git clone https://github.com/giterlizzi/perl-STIX.git |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 AUTHOR |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=over 4 |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item * Giuseppe Di Terlizzi |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=back |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This software is copyright (c) 2024 by Giuseppe Di Terlizzi. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
217
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |