Database/Sinfp3.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Database/Rir.pm ↑ Summary Database/Vfeed.pm »
1 #
2 # $Id$
3 #
4 # database::sinfp3 Brik
5 #
6 package Metabrik::Database::Sinfp3;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable network sinfp scanner signature) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 attributes => {
19 db => [ qw(sinfp3_db) ],
20 },
21 commands => {
22 active_signature_export => [ qw(sinfp3_db|OPTIONAL output|OPTIONAL) ],
23 passive_signature_export => [ qw(sinfp3_db|OPTIONAL output|OPTIONAL) ],
24 },
25 require_modules => {
26 'Net::SinFP3::Plugin::Signature' => [ ],
27 'Net::SinFP3::Global' => [ ],
28 'Net::SinFP3::Log::Console' => [ ],
29 'Net::SinFP3::Input::Null' => [ ],
30 'Net::SinFP3::Search::Null' => [ ],
31 'Net::SinFP3::Mode::Null' => [ ],
32 'Net::SinFP3::DB::SinFP3' => [ ],
33 'Net::SinFP3::Output::Export' => [ ],
34 'Net::SinFP3::Output::ExportP' => [ ],
35 'Net::SinFP3' => [ ],
36 },
37 };
38 }
39  
40 #
41 # sinfp3.pl -input-null -db-sinfp3 -db-file FILE -mode-null -search-null -output Export
42 #
43 sub active_signature_export {
44 my $self = shift;
45 my ($file) = @_;
46  
47 $file ||= $self->db;
48 $self->brik_help_run_undef_arg('active_signature_export', $file) or return;
49 $self->brik_help_run_file_not_found('active_signature_export', $file) or return;
50  
51 my $log = Net::SinFP3::Log::Console->new(
52 level => 0,
53 ) or return $self->log->error("active_signature_export: log failed");
54  
55 my $global = Net::SinFP3::Global->new(
56 log => $log,
57 ) or return $self->log->error("active_signature_export: global failed");
58  
59 my $input = Net::SinFP3::Input::Null->new(global => $global);
60 my $search = Net::SinFP3::Search::Null->new(global => $global);
61 my $mode = Net::SinFP3::Mode::Null->new(global => $global);
62  
63 my $db = Net::SinFP3::DB::SinFP3->new(
64 global => $global,
65 db => $file,
66 );
67  
68 my $output = Net::SinFP3::Output::Export->new(
69 global => $global,
70 );
71  
72 my $sinfp3 = Net::SinFP3->new(
73 global => $global,
74 input => [ $input ],
75 db => [ $db ],
76 mode => [ $mode ],
77 search => [ $search ],
78 output => [ $output ],
79 );
80  
81 my $res = $sinfp3->run;
82  
83 $log->post;
84  
85 return $res;
86 }
87  
88 #
89 # sinfp3.pl -input-null -db-sinfp3 -db-file FILE -mode-null -search-null -output ExportP
90 #
91 sub passive_signature_export {
92 my $self = shift;
93 my ($file) = @_;
94  
95 $file ||= $self->db;
96 $self->brik_help_run_undef_arg('passive_signature_export', $file) or return;
97 $self->brik_help_run_file_not_found('passive_signature_export', $file) or return;
98  
99 my $log = Net::SinFP3::Log::Console->new(
100 level => 0,
101 ) or return $self->log->error("passive_signature_export: log failed");
102  
103 my $global = Net::SinFP3::Global->new(
104 log => $log,
105 ) or return $self->log->error("passive_signature_export: global failed");
106  
107 my $input = Net::SinFP3::Input::Null->new(global => $global);
108 my $search = Net::SinFP3::Search::Null->new(global => $global);
109 my $mode = Net::SinFP3::Mode::Null->new(global => $global);
110  
111 my $db = Net::SinFP3::DB::SinFP3->new(
112 global => $global,
113 db => $file,
114 );
115  
116 my $output = Net::SinFP3::Output::ExportP->new(
117 global => $global,
118 );
119  
120 my $sinfp3 = Net::SinFP3->new(
121 global => $global,
122 input => [ $input ],
123 db => [ $db ],
124 mode => [ $mode ],
125 search => [ $search ],
126 output => [ $output ],
127 );
128  
129 my $res = $sinfp3->run;
130  
131 $log->post;
132  
133 return $res;
134 }
135  
136 1;
137  
138 __END__
« Database/Rir.pm ↑ Summary Database/Vfeed.pm »