27 lines
670 B
Perl
27 lines
670 B
Perl
#!/usr/bin/perl
|
|
use strict;
|
|
use warnings;
|
|
use DBI;
|
|
|
|
use Data::Printer;
|
|
use File::Slurp;
|
|
|
|
# Connect to the database.
|
|
my $dbh = DBI->connect("DBI:MariaDB:database=kram;host=edna",
|
|
"steffen", "66WXRlvF0UUV",
|
|
{'RaiseError' => 1});
|
|
|
|
my @file = read_file('sys.log');
|
|
|
|
for my $l ( @file ) {
|
|
my ( $month, $day, $h, $m, $s, $kat, $src, $dst, $port ) = $l =~ /(.*?) (.*?) (..):(..):(..) 192.*banIP\/...-wan\/drop\/(.*?):.*SRC=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) DST=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*DPT=(\d+)/;
|
|
if ( $month ) {
|
|
p $month;
|
|
p $src;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
# $dbh->selectall_arrayref($statement);
|