various fixes to make loading work properly found with addeding bf2b

This commit is contained in:
Zane C. B-H 2019-06-02 09:02:42 -05:00
parent 60ebb178d1
commit 0db3738bcf
6 changed files with 43 additions and 5 deletions

View File

@ -1,5 +1,12 @@
Revision history for Search-ESsearcher
0.1.0 2019-06-02/09:00
- Add bf2b, beats fail2ban support.
- Actually set the output template now.
- name validation no longer chokes on numbers.
- Now prints the proper help info instead of the
one for the default, syslog.
0.0.0 2019-06-02/04:40
- Initial release.

View File

@ -1,11 +1,14 @@
Changes
lib/Search/ESsearcher.pm
lib/Search/ESsearcher/Templates/syslog.pm
lib/Search/ESsearcher/Templates/bf2b.pm
Makefile.PL
MANIFEST This list of files
README
bin/essearcher
t/00-load.t
t/01-load.t
t/02-load.t
t/manifest.t
t/pod-coverage.t
t/pod.t

View File

@ -14,7 +14,7 @@ use Getopt::Long qw(:config pass_through);
use Data::Dumper;
sub version{
print "essearch: 0.0.0\n";
print "essearch: 0.0.1\n";
};
# disable color if asked
@ -90,6 +90,7 @@ if (defined( $module )){
my $ess = Search::ESsearcher->new();
# print the help if asked to
if ( $help ){
$ess->search_set( $search );
&version;
print '
-s <search> The search template to use.
@ -206,6 +207,7 @@ if ( defined( $check ) ){
}
# processes the results
$ess->output_set( $output );
$ess->load_output;
my @formatted=$ess->results_process( $results );
if (!defined($formatted[0])){

View File

@ -17,11 +17,11 @@ Search::ESsearcher - Provides a handy system for doing templated elasticsearch s
=head1 VERSION
Version 0.0.0
Version 0.1.0
=cut
our $VERSION = '0.0.0';
our $VERSION = '0.1.0';
=head1 SYNOPSIS
@ -190,7 +190,7 @@ sub fetch_help{
} else {
# do a quick check of making sure we have a valid name before trying a module...
# not all valid names are perl module name valid, but it will prevent arbitrary code execution
if ( $self->name_validate( $self->{options} ) ) {
if ( $self->name_validate( $self->{search} ) ) {
my $to_eval='use Search::ESsearcher::Templates::'.$self->{search}.
'; $data=Search::ESsearcher::Templates::'.$self->{search}.'->help;';
eval( $to_eval );
@ -585,7 +585,7 @@ sub name_validate{
return 1;
}
$name=~s/[A-Za-z\:\-\=\_+\ ]+//;
$name=~s/[A-Z0-9a-z\:\-\=\_+\ ]+//;
if ( $name !~ /^$/ ){
return undef;

View File

@ -0,0 +1,13 @@
#!perl -T
use 5.006;
use strict;
use warnings;
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'Search::ESsearcher::Templates::syslog' ) || print "Bail out!\n";
}
diag( "Testing Search::ESsearcher::Templates::syslog $Search::ESsearcher::Templates::syslog::VERSION, Perl $], $^X" );

View File

@ -0,0 +1,13 @@
#!perl -T
use 5.006;
use strict;
use warnings;
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'Search::ESsearcher::Templates::bf2b' ) || print "Bail out!\n";
}
diag( "Testing Search::ESsearcher::Templates::bf2b $Search::ESsearcher::Templates::bf2b::VERSION, Perl $], $^X" );