Skip to content
Snippets Groups Projects
Select Git revision
  • 4287d158b662299b3d6b972e552cb2d3e2df3796
  • master default protected
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • servers
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

webpack.config.js

Blame
  • IPblacklist.pm 1.20 KiB
    package IPblacklist;
    use strict;
    use warnings;
    use Data::Dumper;
    
    my %CONSTANTS =    (
                           outputfile  => "tmp/blacklist.csv",
                           threshold   => 200,
                           excludedip  => [],
                           eventtype   => [],
                           maxage      => "1D",
                        );
    
    my %FORMAT   =      (  maxage     => qr/\d+[hdmHDM]/, );
    
    
    sub run {
        my (undef, $modprefix, $cfg, $dbh, $db_engine) = @_;
        my $v = Constants::mergeConfigs($cfg, $modprefix, \%CONSTANTS, \%FORMAT);
    
        my $eventtype_query = DB::joinIN("type", \@{$v->{'eventtype'}});
        my $excluded_query  = DB::joinNotIN("source", \@{$v->{'excludedip'}});
    
        my $condition = substr($excluded_query . $eventtype_query, 0, -5);
        my @columns= ("source");
        my @params = ($condition, DB::getOldDataDB($db_engine, "NEWER", $v->{'maxage'}));
        my $query = DB::getQueryCondThreshold($db_engine, "events", \@columns, \@params, $v->{'threshold'});
    
        my @rows = Utils::fetchall_array_hashref($dbh, $query);
    
        sub record { my $r = shift; return "$r->{'source'},\n"; };
        
        my $ret = Utils::generateOutput($v->{'outputfile'}, \@rows, undef, \&record, undef, $v);
        return $ret;
    }
    1;