File Coverage

blib/lib/STIX/AttackPattern.pm
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod n/a
total 51 51 100.0


line stmt bran cond sub pod time code
1             package STIX::AttackPattern;
2              
3 24     24   428 use 5.010001;
  24         82  
4 24     24   131 use strict;
  24         82  
  24         828  
5 24     24   165 use warnings;
  24         51  
  24         1302  
6 24     24   146 use utf8;
  24         61  
  24         186  
7              
8 24     24   16458 use STIX::Common::List;
  24         92  
  24         1121  
9 24     24   14965 use Types::Standard qw(Str InstanceOf);
  24         3218319  
  24         282  
10 24     24   77432 use Types::TypeTiny qw(ArrayLike);
  24         60  
  24         231  
11              
12 24     24   98086 use Moo;
  24         175567  
  24         152  
13 24     24   50982 use namespace::autoclean;
  24         470601  
  24         147  
14              
15             extends 'STIX::Common::Properties';
16              
17 24         2766 use constant SCHEMA =>
18 24     24   2458 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/attack-pattern.json';
  24         53  
19              
20 24         1814 use constant PROPERTIES => (
21             qw(type spec_version id created modified),
22             qw(created_by_ref revoked labels confidence lang external_references object_marking_refs granular_markings extensions),
23             qw(name description aliases kill_chain_phases)
24 24     24   160 );
  24         47  
25              
26 24     24   135 use constant STIX_OBJECT => 'SDO';
  24         52  
  24         1203  
27 24     24   145 use constant STIX_OBJECT_TYPE => 'attack-pattern';
  24         47  
  24         5659  
28              
29             has name => (is => 'rw', isa => Str, required => 1);
30             has description => (is => 'rw', isa => Str);
31             has aliases => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
32              
33             has kill_chain_phases => (
34             is => 'rw',
35             isa => ArrayLike [InstanceOf ['STIX::Common::KillChainPhase']],
36             default => sub { STIX::Common::List->new }
37             );
38              
39             1;
40              
41              
42             =encoding utf-8
43              
44             =head1 NAME
45              
46             STIX::AttackPattern - STIX Domain Object (SDO) - Attack-pattern
47              
48             =head1 SYNOPSIS
49              
50             use STIX::AttackPattern;
51              
52             my $attack_pattern = STIX::AttackPattern->new();
53              
54              
55             =head1 DESCRIPTION
56              
57             Attack Patterns are a type of TTP that describe ways that adversaries
58             attempt to compromise targets.
59              
60              
61             =head2 METHODS
62              
63             L inherits all methods from L
64             and implements the following new ones.
65              
66             =over
67              
68             =item STIX::AttackPattern->new(%properties)
69              
70             Create a new instance of L.
71              
72             =item $attack_pattern->aliases
73              
74             Alternative names used to identify this Attack Pattern.
75              
76             =item $attack_pattern->description
77              
78             A description that provides more details and context about the Attack
79             Pattern, potentially including its purpose and its key characteristics.
80              
81             =item $attack_pattern->id
82              
83             =item $attack_pattern->kill_chain_phases
84              
85             The list of kill chain phases for which this attack pattern is used.
86              
87             =item $attack_pattern->name
88              
89             The name used to identify the Attack Pattern.
90              
91             =item $attack_pattern->type
92              
93             The type of this object, which MUST be the literal C.
94              
95             =back
96              
97              
98             =head2 HELPERS
99              
100             =over
101              
102             =item $attack_pattern->TO_JSON
103              
104             Encode the object in JSON.
105              
106             =item $attack_pattern->to_hash
107              
108             Return the object HASH.
109              
110             =item $attack_pattern->to_string
111              
112             Encode the object in JSON.
113              
114             =item $attack_pattern->validate
115              
116             Validate the object using JSON Schema (see L).
117              
118             =back
119              
120              
121             =head1 SUPPORT
122              
123             =head2 Bugs / Feature Requests
124              
125             Please report any bugs or feature requests through the issue tracker
126             at L.
127             You will be notified automatically of any progress on your issue.
128              
129             =head2 Source Code
130              
131             This is open source software. The code repository is available for
132             public review and contribution under the terms of the license.
133              
134             L
135              
136             git clone https://github.com/giterlizzi/perl-STIX.git
137              
138              
139             =head1 AUTHOR
140              
141             =over 4
142              
143             =item * Giuseppe Di Terlizzi
144              
145             =back
146              
147              
148             =head1 LICENSE AND COPYRIGHT
149              
150             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
151              
152             This is free software; you can redistribute it and/or modify it under
153             the same terms as the Perl 5 programming language system itself.
154              
155             =cut