File Coverage

blib/lib/Metabrik/Network/Sinfp3/Arpdiscover.pm
Criterion Covered Total %
statement 9 26 34.6
branch 0 4 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 1 2 50.0
total 13 40 32.5


line stmt bran cond sub pod time code
1             #
2             # $Id$
3             #
4             # network::sinfp3::arpdiscover Brik
5             #
6             package Metabrik::Network::Sinfp3::Arpdiscover;
7 1     1   763 use strict;
  1         2  
  1         31  
8 1     1   5 use warnings;
  1         3  
  1         29  
9              
10 1     1   4 use base qw(Metabrik);
  1         3  
  1         410  
11              
12             sub brik_properties {
13             return {
14 0     0 1   revision => '$Revision$',
15             tags => [ qw(unstable network sinfp scan arp arpscan ipv6) ],
16             author => 'GomoR ',
17             license => 'http://opensource.org/licenses/BSD-3-Clause',
18             attributes => {
19             subnet => [ qw(target_subnet) ],
20             use_ipv6 => [ qw(0|1) ],
21             },
22             attributes_default => {
23             use_ipv6 => 0,
24             },
25             commands => {
26             scan => [ qw(subnet) ],
27             },
28             require_modules => {
29             'Net::SinFP3' => [ ],
30             'Net::SinFP3::Log::Console' => [ ],
31             'Net::SinFP3::Global' => [ ],
32             'Net::SinFP3::Input::ArpDiscover' => [ ],
33             'Net::SinFP3::DB::Null' => [ ],
34             'Net::SinFP3::Mode::Null' => [ ],
35             'Net::SinFP3::Search::Null' => [ ],
36             'Net::SinFP3::Output::Null' => [ ],
37             },
38             };
39             }
40              
41             sub scan {
42 0     0 0   my $self = shift;
43 0           my ($subnet) = @_;
44              
45 0   0       $subnet ||= $self->subnet;
46 0 0         if (! defined($subnet)) {
47 0           return $self->log->error($self->brik_help_set('subnet'));
48             }
49              
50 0           my $log = Net::SinFP3::Log::Console->new(
51             level => $self->log->level,
52             );
53              
54 0 0         my $global = Net::SinFP3::Global->new(
55             log => $log,
56             subnet => $subnet,
57             ipv6 => $self->use_ipv6,
58             ) or return $self->log->error("scan: global failed");
59              
60 0           my $input = Net::SinFP3::Input::ArpDiscover->new(
61             global => $global,
62             );
63              
64 0           my $db = Net::SinFP3::DB::Null->new(
65             global => $global,
66             );
67              
68 0           my $mode = Net::SinFP3::Mode::Null->new(
69             global => $global,
70             );
71              
72 0           my $search = Net::SinFP3::Search::Null->new(
73             global => $global,
74             );
75              
76 0           my $output = Net::SinFP3::Output::Null->new(
77             global => $global,
78             );
79              
80 0           my $sinfp3 = Net::SinFP3->new(
81             global => $global,
82             input => [ $input ],
83             db => [ $db ],
84             mode => [ $mode ],
85             search => [ $search ],
86             output => [ $output ],
87             );
88              
89 0           my $ret = $sinfp3->run;
90              
91 0           $log->post;
92              
93 0           return $ret;
94             }
95              
96             1;
97              
98             __END__