1package Iodef::Pb::Simple::Plugin::Guid;
2use base 'Iodef::Pb::Simple::Plugin';
3
4use strict;
5use warnings;
6
7use Iodef::Pb::Simple qw/is_uuid uuid_ns/;
8
9sub process {
10    my $self = shift;
11    my $data = shift;
12    my $iodef = shift;
13
14    return unless($data->{'guid'});
15
16    $data->{'guid'} = uuid_ns($data->{'guid'}) unless(is_uuid($data->{'guid'}));
17
18    my $ad = ExtensionType->new({
19        dtype       => ExtensionType::DtypeType::dtype_type_string(),
20        content     => $data->{'guid'},
21        formatid    => 'uuid',
22        meaning     => 'guid hash'
23    });
24
25    my $incident = @{$iodef->get_Incident()}[0];
26    push(@{$incident->{'AdditionalData'}},$ad);
27}
28
291;