| 1 | package Log::Saftpresse::Plugin::LinuxNetfilter; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # ABSTRACT: plugin to parse network packets logged by linux/netfilter | ||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.5'; # VERSION | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | extends 'Log::Saftpresse::Plugin'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | with 'Log::Saftpresse::Plugin::Role::CounterUtils'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub process { | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | my ( $self, $stash ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
process: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 0 | my $program = $stash->{'program'}; | |||||||||||||||||||||||||||
| 15 | 0 | ▶ | if( ! defined $program || $program ne 'kernel' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $program or $program ne "kernel"
MC/DC0%0/2
not defined $program or $program ne "kernel"
not defined $program
$program ne "kernel"
Truth table0%0/3
not(A) or B
A= not defined $programB= $program ne "kernel"
| |||||||||||||||||||||||||||||
| 16 | 0 | return; | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | my ( $prefix, $msg ) = | ||||||||||||||||||||||||||||
| 20 | 0 | $stash->{'message'} =~ /^\[\d+\.\d+\] ([^:]+): (IN=\S* OUT=\S* .+) ?$/; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if( ! defined $prefix ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 0 | return; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | my %values = map { | ||||||||||||||||||||||||||||
| 27 | 0 | my ( $key, $value ) = split('=', $_, 2); | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | defined $value && $value ne '' ? ( lc($key) => $value ) : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and $value ne ""
MC/DC0%0/2
defined $value and $value ne ""
defined $value
$value ne ""
Truth table0%0/3
A and B
A= defined $valueB= $value ne ""
| |||||||||||||||||||||||||||||
| 29 | } split(' ', $msg); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | $stash->{'prefix'} = $prefix; | |||||||||||||||||||||||||||
| 32 | 0 | @$stash{ keys %values } = values %values; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | $self->count_fields_occur( $stash, 'prefix' ); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | return; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | 1; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =pod | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head1 NAME | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Log::Saftpresse::Plugin::LinuxNetfilter - plugin to parse network packets logged by linux/netfilter | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =head1 VERSION | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | version 1.5 | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | Markus Benning <ich@markusbenning.de> | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | The GNU General Public License, Version 2, June 1991 | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||