| 1 | package Cikl::Models::Event; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Mouse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Mouse::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Cikl::DataTypes::LowerCaseStr; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Cikl::DataTypes::Integer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Cikl::DataTypes::PortList; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Cikl::Models::AddressRole; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Cikl::AddressBuilder qw/create_address/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | has 'group' => ( | |||||||||
| 14 | is => 'rw', | ||||||||||
| 15 | isa => 'Cikl::DataTypes::LowerCaseStr', | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 1 | has 'assessment' => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | isa => 'Cikl::DataTypes::LowerCaseStr', | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | coerce => 1 | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | has 'description' => ( | ||||||||||
| 27 | is => 'rw', | ||||||||||
| 28 | isa => 'Cikl::DataTypes::LowerCaseStr', | ||||||||||
| 29 | 1 | ▶ | default => sub { 'unknown' }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 1 | coerce => 1 | |||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 1 | has 'address' => ( | |||||||||
| 34 | is => 'rw', | ||||||||||
| 35 | does => 'Cikl::Models::AddressRole' | ||||||||||
| 36 | ); | ||||||||||
| 37 | |||||||||||
| 38 | 1 | has 'detecttime' => ( | |||||||||
| 39 | is => 'rw', | ||||||||||
| 40 | isa => "Cikl::DataTypes::Integer", | ||||||||||
| 41 | coerce => 1 | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | 1 | has 'reporttime' => ( | |||||||||
| 45 | is => 'rw', | ||||||||||
| 46 | isa => "Cikl::DataTypes::Integer", | ||||||||||
| 47 | coerce => 1 | ||||||||||
| 48 | ); | ||||||||||
| 49 | |||||||||||
| 50 | 1 | has 'alternativeid' => (is => 'rw'); | |||||||||
| 51 | 1 | has 'alternativeid_restriction' => (is => 'rw'); | |||||||||
| 52 | 1 | has 'confidence' => ( | |||||||||
| 53 | is => 'rw', | ||||||||||
| 54 | isa => 'Cikl::DataTypes::Integer', | ||||||||||
| 55 | coerce => 1 | ||||||||||
| 56 | ); | ||||||||||
| 57 | 1 | has 'hash' => (is => 'rw'); | |||||||||
| 58 | |||||||||||
| 59 | 1 | has 'malware_md5' => (is => 'rw'); | |||||||||
| 60 | 1 | has 'malware_sha1' => (is => 'rw'); | |||||||||
| 61 | 1 | has 'md5' => (is => 'rw'); | |||||||||
| 62 | 1 | has 'sha1' => (is => 'rw'); | |||||||||
| 63 | |||||||||||
| 64 | 1 | has 'portlist' => ( | |||||||||
| 65 | is => 'rw', | ||||||||||
| 66 | isa => 'Cikl::DataTypes::PortList' | ||||||||||
| 67 | ); | ||||||||||
| 68 | |||||||||||
| 69 | 1 | has 'protocol' => (is => 'rw'); | |||||||||
| 70 | 1 | has 'restriction' => (is => 'rw'); | |||||||||
| 71 | 1 | has 'severity' => (is => 'rw'); | |||||||||
| 72 | 1 | has 'source' => (is => 'rw'); | |||||||||
| 73 | |||||||||||
| 74 | 1 | has 'cc' => (is => 'rw'); | |||||||||
| 75 | 1 | has 'rir' => (is => 'rw'); | |||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | sub to_hash { | ||||||||
|
Subroutine
to_hash: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 78 | 0 | my $ret = { %{$_[0]} }; | |||||||||
| 79 | 0 | ▶ | if ($ret->{address}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | $ret->{address} = $ret->{address}->to_hash(); | |||||||||
| 81 | } | ||||||||||
| 82 | 0 | return $ret; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 0 | ▶ | sub from_hash { | ||||||||
|
Subroutine
from_hash: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 86 | 0 | my $class = shift; | |||||||||
| 87 | 0 | my $data = shift; | |||||||||
| 88 | 0 | my $address = $data->{address}; | |||||||||
| 89 | 0 | ▶ | if ($address) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | 0 | my $type = (keys %$address)[0]; | |||||||||
| 91 | 0 | ▶ | if ($type) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 0 | $address = create_address($type, $address->{$type}); | |||||||||
| 93 | 0 | $data->{address} = $address; | |||||||||
| 94 | } | ||||||||||
| 95 | } | ||||||||||
| 96 | 0 | return $class->new($data); | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 100 | |||||||||||
| 101 | 1 | 1; | |||||||||