- $a = $_;
- # If ipv6 uses bridge, use PHYSIN otherwise use IN
- if (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
- elsif (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {};
- my $packet = $4;
- my $iface = '';
- # If ipv6 uses bridge, use PHYSIN otherwise use IN
- if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($packet =~ /IN=(\w+)/) { $iface = $1 }
- if ( $1 =~ /2./ ){ $iface="";}
- my $srcaddr = '';
- # Extract ipv4 and ipv6 addresses
- if (($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
- $srcaddr = $1
- };
-
- if($iface eq $country || $srcaddr ne '') {
- my $ccode='';
- if($iface ne $country) {
- $ccode = $gi->country_code_by_name($srcaddr);
- }
- if($iface eq $country || $ccode eq $country) {
- my $chain = '';
- my $in = '-'; my $out = '-';
- my $srcaddr = ''; my $dstaddr = '';
- my $protostr = '';
- my $srcport = ''; my $dstport = '';
-
- # If ipv6 uses bridge, the use PHYSIN otherwise use IN
- if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
- elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
- my $timestamp = $1; my $chain = $2; my $packet = $3;
- $timestamp =~ /(...) (..) (..:..:..)/;
- my $month = $1; my $day = $2; my $time = $3;
-
- # If ipv6 uses bridge, use PHYSIN and PHYSOUT, otherwise use IN and OUT
- if ($a =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($a =~ /IN=(\w+)/) { $iface = $1 }
- if ($a =~ /PHYSOUT=(\w+)/) { $out = $1 } elsif ($a =~ /OUT=(\w+)/) { $out = $1 }
- # Extract ipv4 and ipv6 addresses
- if (($a =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $srcaddr = $1; }
- if (($a =~ /DST\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /DST\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $dstaddr = $1; }
- if ($a =~ /PROTO\=(\w+)/) { $protostr = $1; }
- my $protostrlc = lc($protostr);
- if ($a =~ /SPT\=([\d\.]+)/){ $srcport = $1; }
- if ($a =~ /DPT\=([\d\.]+)/){ $dstport = $1; }
-
- if ($lines % 2) {
- print "<tr bgcolor='${Header::table1colour}'>\n"; }
- else {
- print "<tr bgcolor='${Header::table2colour}'>\n"; }
- print <<END
- <td align='center'>$time</td>
- <td align='center'>$chain</td>
- <td align='center'>$iface</td>
- <td align='center'>$protostr</td>
- <td align='center'>
- <table width='100%' cellpadding='0' cellspacing='0'><tr>
- <td align='center'><a href='/cgi-bin/ipinfo.cgi?ip=$srcaddr'>$srcaddr</a></td>
- </tr></table>
- </td>
- <td align='center'>$srcport</td>
- <td align='center'>
- <table width='100%' cellpadding='0' cellspacing='0'><tr>
- <td align='center'><a href='/cgi-bin/ipinfo.cgi?ip=$dstaddr'>$dstaddr</a></td>
- </tr></table>
- </td>
- <td align='center'>$dstport</td>
- </tr>
+ $a = $_;
+ # If ipv6 uses bridge, use PHYSIN otherwise use IN
+ if (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
+ elsif (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {};
+ my $packet = $4;
+ my $iface = '';
+ # If ipv6 uses bridge, use PHYSIN otherwise use IN
+ if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }
+ if ( $1 =~ /2./ ){ $iface=""; }
+ my $srcaddr = '';
+ # Extract ipv4 and ipv6 addresses
+ if (($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
+ $srcaddr = $1;
+ };
+
+ if($iface eq $country || $srcaddr ne '') {
+ my $ccode='';
+ if($iface ne $country) {
+ $ccode = $gi->country_code_by_name($srcaddr);
+ }
+ if($iface eq $country || $ccode eq uc($country)) {
+ my $chain = '';
+ my $in = '-'; my $out = '-';
+ my $srcaddr = ''; my $dstaddr = '';
+ my $protostr = '';
+ my $srcport = ''; my $dstport = '';
+
+ # If ipv6 uses bridge, the use PHYSIN otherwise use IN
+ if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
+ elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
+ my $timestamp = $1; my $chain = $2; my $packet = $3;
+ $timestamp =~ /(...) (..) (..:..:..)/;
+ my $month = $1; my $day = $2; my $time = $3;
+
+ # If ipv6 uses bridge, use PHYSIN and PHYSOUT, otherwise use IN and OUT
+ if ($a =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($a =~ /IN=(\w+)/) { $iface = $1; }
+ if ($a =~ /PHYSOUT=(\w+)/) { $out = $1; } elsif ($a =~ /OUT=(\w+)/) { $out = $1; }
+ # Extract ipv4 and ipv6 addresses
+ if (($a =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $srcaddr = $1; }
+ if (($a =~ /DST\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /DST\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $dstaddr = $1; }
+ if ($a =~ /PROTO\=(\w+)/) { $protostr = $1; }
+ my $protostrlc = lc($protostr);
+ if ($a =~ /SPT\=([\d\.]+)/){ $srcport = $1; }
+ if ($a =~ /DPT\=([\d\.]+)/){ $dstport = $1; }
+
+ if ($lines % 2) {
+ print "<tr bgcolor='${Header::table1colour}'>\n";
+ }
+ else {
+ print "<tr bgcolor='${Header::table2colour}'>\n";
+ }
+ print <<END
+ <td align='center'>$time</td>
+ <td align='center'>$chain</td>
+ <td align='center'>$iface</td>
+ <td align='center'>$protostr</td>
+ <td align='center'>
+ <table width='100%' cellpadding='0' cellspacing='0'><tr>
+ <td align='center'><a href='/cgi-bin/ipinfo.cgi?ip=$srcaddr'>$srcaddr</a></td>
+ </tr></table>
+ </td>
+ <td align='center'>$srcport</td>
+ <td align='center'>
+ <table width='100%' cellpadding='0' cellspacing='0'><tr>
+ <td align='center'><a href='/cgi-bin/ipinfo.cgi?ip=$dstaddr'>$dstaddr</a></td>
+ </tr></table>
+ </td>
+ <td align='center'>$dstport</td>
+ </tr>