18 $name = $addresses{$ip};
19 return "$name [$ip]" if defined $name;
20 ($a1, $a2, $a3, $a4) = split /\./, $ip;
21 $name = gethostbyaddr(inet_aton($ip), AF_INET);
24 $addresses{$ip} = $name;
35 ($a1, $a2, $a3, $a4) = split /\./, $a;
36 ($b1, $b2, $b3, $b4) = split /\./, $b;
37 ($a1 <=> $b1) || ($a2 <=> $b2) || ($a3 <=> $b3) || ($a4 <=> $b4);
44 $detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};
46 while (defined($line = <STDIN>))
50 if ($line =~ /Performing periodic check of blocked IPs list\./)
54 elsif ($line =~ /Bansshee startup\./)
58 elsif ($line =~ /Failed password attempt for user/)
62 elsif ($line =~ /Attempted connection with illegal user/)
66 elsif ($line =~ /Adding IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) to blocklist\./)
70 elsif ($line =~ /Removing IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) from blocklist\./)
74 elsif (($line =~ /Reading config file/) ||
75 ($line =~ /Daemonizing\./) ||
76 ($line =~ /Creating new BANSSHEE iptables chain\./) ||
77 ($line =~ /Appending JUMP rule \(redirects all SSH traffic to BANSSHEE chain\)\./) ||
78 ($line =~ /Tailing log:/) ||
79 ($line =~ /Removing JUMP rule from INPUT chain\./) ||
80 ($line =~ /Flushing BANSSHEE iptables chain\./) ||
81 ($line =~ /Deleting BANSSHEE iptables chain\./))
87 push @unmatchedEntries, "$line\n";
91 if (($startups > 0) && ($detail >= 5))
93 print "\nStart-ups: $startups time(s).\n";
96 if (($periodicChecks > 0) && ($detail >= 10))
98 print "\nPeriodic checks: $periodicChecks time(s).\n";
101 if ($failedPasswords > 0)
103 print "\nFailed password attempts: $failedPasswords time(s).\n";
106 if ($illegalUsers > 0)
108 print "\nIllegal user attempts: $illegalUsers time(s).\n";
113 print "\nIPs added to blocklist:\n";
114 foreach $ip (sort { SortIPAddresses } keys %additions)
116 $host = LookupIP($ip);
117 print " $host : $additions{$ip} time(s).\n";
123 print "\nIPs removed from blocklist:\n";
124 foreach $ip (sort { SortIPAddresses } keys %additions)
126 $host = LookupIP($ip);
127 print " $host : $additions{$ip} time(s).\n";
131 if ($#unmatchedEntries > 0)
133 print "\n**Unmatched Entries**\n";
134 print @unmatchedEntries;