| 1 | # | ||
| 2 | # $Id: Search.pm,v 69a3d7308875 2023/04/05 15:11:02 gomor $ | ||
| 3 | # | ||
| 4 | package OPP::Proc::Search; | ||
| 5 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use base qw(OPP::Proc); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | __PACKAGE__->cgBuildIndices; | ||
| 10 | |||
| 11 | 1 | ▶ | use Onyphe::Api; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | our $VERSION = '1.00'; | ||
| 14 | |||
| 15 | my $oa = Onyphe::Api->new->init or die("search: init failed"); | ||
| 16 | $oa->silent(1); | ||
| 17 | $oa->verbose(0); | ||
| 18 | |||
| 19 | # | ||
| 20 | # | search category:datascan ip:$ip | ||
| 21 | # | ||
| 22 | sub process { | ||
| 23 | 0 | ▶ | my $self = shift; |
|
Subroutine
process: not called CC=1 SCAR=6.9
| |||
| 24 | 0 | my ($input) = @_; | |
| 25 | |||
| 26 | 0 | my $options = $self->options; | |
| 27 | 0 | my $args = $options->{args}; | |
| 28 | |||
| 29 | # Update place holders with found input values: | ||
| 30 | 0 | my $searches = $self->placeholder($args, $input); | |
| 31 | |||
| 32 | my $cb = sub { | ||
| 33 | 0 | ▶ | my ($results) = @_; |
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||
| 34 | 0 | for (@$results) { | |
| 35 | 0 | $_ = $self->flatten($_); | |
| 36 | 0 | $self->output->add($_); | |
| 37 | } | ||
| 38 | 0 | }; | |
| 39 | |||
| 40 | 0 | $oa->search($searches->[0], 1, 1, { trackquery => 'true' }, $cb); # Use default callback | |
| 41 | |||
| 42 | 0 | return 1; | |
| 43 | } | ||
| 44 | |||
| 45 | 1; | ||
| 46 | |||
| 47 | __END__ | ||