File Coverage

blib/lib/STIX/Tool.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::Tool;
2              
3 24     24   2239 use 5.010001;
  24         117  
4 24     24   156 use strict;
  24         54  
  24         1097  
5 24     24   390 use warnings;
  24         49  
  24         1526  
6 24     24   152 use utf8;
  24         46  
  24         203  
7              
8 24     24   913 use STIX::Common::List;
  24         88  
  24         873  
9 24     24   148 use STIX::Common::OpenVocabulary;
  24         64  
  24         1131  
10 24     24   170 use Types::Standard qw(Str Enum InstanceOf);
  24         82  
  24         329  
11 24     24   90361 use Types::TypeTiny qw(ArrayLike);
  24         69  
  24         192  
12              
13 24     24   14175 use Moo;
  24         61  
  24         275  
14 24     24   11872 use namespace::autoclean;
  24         815  
  24         338  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2808 use constant SCHEMA =>
19 24     24   2974 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/tool.json';
  24         64  
20              
21 24         1874 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 tool_types aliases kill_chain_phases tool_version)
25 24     24   169 );
  24         48  
26              
27 24     24   186 use constant STIX_OBJECT => 'SDO';
  24         61  
  24         1253  
28 24     24   154 use constant STIX_OBJECT_TYPE => 'tool';
  24         54  
  24         6807  
29              
30             has name => (is => 'rw', isa => Str, required => 1);
31             has description => (is => 'rw', isa => Str);
32              
33             has tool_types => (
34             is => 'rw',
35             isa => ArrayLike [Enum [STIX::Common::OpenVocabulary->TOOL_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',
42             isa => ArrayLike [InstanceOf ['STIX::Common::KillChainPhase']],
43             default => sub { STIX::Common::List->new }
44             );
45             has tool_version => (is => 'rw', isa => Str);
46              
47             1;
48              
49             =encoding utf-8
50              
51             =head1 NAME
52              
53             STIX::Tool - STIX Domain Object (SDO) - Tool
54              
55             =head1 SYNOPSIS
56              
57             use STIX::Tool;
58              
59             my $tool = STIX::Tool->new();
60              
61              
62             =head1 DESCRIPTION
63              
64             Tools are legitimate software that can be used by threat actors to perform
65             attacks.
66              
67              
68             =head2 METHODS
69              
70             L inherits all methods from L
71             and implements the following new ones.
72              
73             =over
74              
75             =item STIX::Tool->new(%properties)
76              
77             Create a new instance of L.
78              
79             =item $tool->aliases
80              
81             Alternative names used to identify this Tool.
82              
83             =item $tool->description
84              
85             Provides more context and details about the Tool object.
86              
87             =item $tool->id
88              
89             =item $tool->kill_chain_phases
90              
91             The list of kill chain phases for which this Tool instance can be used.
92              
93             =item $tool->name
94              
95             The name used to identify the Tool.
96              
97             =item $tool->tool_types
98              
99             The kind(s) of tool(s) being described. (See C in
100             L)
101              
102             =item $tool->tool_version
103              
104             The version identifier associated with the tool.
105              
106             =item $tool->type
107              
108             The type of this object, which MUST be the literal C.
109              
110             =back
111              
112              
113             =head2 HELPERS
114              
115             =over
116              
117             =item $tool->TO_JSON
118              
119             Encode the object in JSON.
120              
121             =item $tool->to_hash
122              
123             Return the object HASH.
124              
125             =item $tool->to_string
126              
127             Encode the object in JSON.
128              
129             =item $tool->validate
130              
131             Validate the object using JSON Schema (see L).
132              
133             =back
134              
135              
136             =head1 SUPPORT
137              
138             =head2 Bugs / Feature Requests
139              
140             Please report any bugs or feature requests through the issue tracker
141             at L.
142             You will be notified automatically of any progress on your issue.
143              
144             =head2 Source Code
145              
146             This is open source software. The code repository is available for
147             public review and contribution under the terms of the license.
148              
149             L
150              
151             git clone https://github.com/giterlizzi/perl-STIX.git
152              
153              
154             =head1 AUTHOR
155              
156             =over 4
157              
158             =item * Giuseppe Di Terlizzi
159              
160             =back
161              
162              
163             =head1 LICENSE AND COPYRIGHT
164              
165             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
166              
167             This is free software; you can redistribute it and/or modify it under
168             the same terms as the Perl 5 programming language system itself.
169              
170             =cut