|
|
dc8c34 |
From ed1536420dee0f5607beedac4d188249c40d2601 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Rich Megginson <rmeggins@redhat.com>
|
|
|
dc8c34 |
Date: Mon, 10 Jun 2013 20:04:20 -0600
|
|
|
dc8c34 |
Subject: [PATCH 133/225] Ticket #47387 - improve logconv.pl performance with
|
|
|
dc8c34 |
large access logs
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47387
|
|
|
dc8c34 |
Reviewed by: mreynolds (Thanks!)
|
|
|
dc8c34 |
Branch: master
|
|
|
dc8c34 |
Fix Description: The primary fix is to use tied hashes and arrays backed by
|
|
|
dc8c34 |
DB_File database files. Hashes use DB_HASH and arrays use DB_RECNO. These
|
|
|
dc8c34 |
fixes cut down the time by a factor of 10 or more, and considerably reduce
|
|
|
dc8c34 |
the size of the disk files. There is still room for optimization as given
|
|
|
dc8c34 |
by the Devel::NYTProf package, but this should at least give us acceptable
|
|
|
dc8c34 |
performance.
|
|
|
dc8c34 |
I also did some perl "linting" - running with use warnings and use strict -
|
|
|
dc8c34 |
which revealed a lot of code which was cleaned up.
|
|
|
dc8c34 |
Platforms tested: RHEL6 x86_64
|
|
|
dc8c34 |
Flag Day: no
|
|
|
dc8c34 |
Doc impact: no
|
|
|
dc8c34 |
(cherry picked from commit 8e35cc8b418bc46fbeb28f4378d24f9c2cab0353)
|
|
|
dc8c34 |
(cherry picked from commit 481f2e3aec2834f342c01919d91eb6cfd80f6ca1)
|
|
|
dc8c34 |
(cherry picked from commit b785fc2af16c1620d337f8507627d4408ba03d5a)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/admin/src/logconv.pl | 1648 ++++++++++++++++++---------------------------
|
|
|
dc8c34 |
1 file changed, 664 insertions(+), 984 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
index 8ae72da..b628d03 100755
|
|
|
dc8c34 |
--- a/ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
+++ b/ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
@@ -43,9 +43,14 @@
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# Check for usage
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
+use strict;
|
|
|
dc8c34 |
+use warnings;
|
|
|
dc8c34 |
+use warnings 'untie';
|
|
|
dc8c34 |
use Time::Local;
|
|
|
dc8c34 |
use IO::File;
|
|
|
dc8c34 |
use Getopt::Long;
|
|
|
dc8c34 |
+use DB_File;
|
|
|
dc8c34 |
+use sigtrap qw(die normal-signals);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Getopt::Long::Configure ("bundling");
|
|
|
dc8c34 |
Getopt::Long::Configure ("permute");
|
|
|
dc8c34 |
@@ -60,19 +65,43 @@ if ($#ARGV < 0){;
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
#######################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$file_count = 0;
|
|
|
dc8c34 |
-$arg_count = 0;
|
|
|
dc8c34 |
-$logversion = "7.0";
|
|
|
dc8c34 |
-$sizeCount = "20";
|
|
|
dc8c34 |
-$startFlag = 0;
|
|
|
dc8c34 |
-$startTime = 0;
|
|
|
dc8c34 |
-$endFlag = 0;
|
|
|
dc8c34 |
-$endTime = 0;
|
|
|
dc8c34 |
-$reportStats = "";
|
|
|
dc8c34 |
-$dataLocation = "/tmp";
|
|
|
dc8c34 |
-$startTLSoid = "1.3.6.1.4.1.1466.20037";
|
|
|
dc8c34 |
-$s_stats = new_stats_block( );
|
|
|
dc8c34 |
-$m_stats = new_stats_block( );
|
|
|
dc8c34 |
+my $file_count = 0;
|
|
|
dc8c34 |
+my $arg_count = 0;
|
|
|
dc8c34 |
+my $logversion = "7.0";
|
|
|
dc8c34 |
+my $sizeCount = "20";
|
|
|
dc8c34 |
+my $startFlag = 0;
|
|
|
dc8c34 |
+my $startTime = 0;
|
|
|
dc8c34 |
+my $endFlag = 0;
|
|
|
dc8c34 |
+my $endTime = 0;
|
|
|
dc8c34 |
+my $reportStats = "";
|
|
|
dc8c34 |
+my $dataLocation = "/tmp";
|
|
|
dc8c34 |
+my $startTLSoid = "1.3.6.1.4.1.1466.20037";
|
|
|
dc8c34 |
+my $s_stats = new_stats_block( );
|
|
|
dc8c34 |
+my $m_stats = new_stats_block( );
|
|
|
dc8c34 |
+my $verb = "no";
|
|
|
dc8c34 |
+my @excludeIP;
|
|
|
dc8c34 |
+my $xi = 0;
|
|
|
dc8c34 |
+my $bindReportDN;
|
|
|
dc8c34 |
+my $usage = "";
|
|
|
dc8c34 |
+my @latency;
|
|
|
dc8c34 |
+my @openConnection;
|
|
|
dc8c34 |
+my @errorCode;
|
|
|
dc8c34 |
+my @errtext;
|
|
|
dc8c34 |
+my @errornum;
|
|
|
dc8c34 |
+my @errornum2;
|
|
|
dc8c34 |
+my $ds6x = "false";
|
|
|
dc8c34 |
+my $connCodeCount = 0;
|
|
|
dc8c34 |
+my %connList;
|
|
|
dc8c34 |
+my %bindReport;
|
|
|
dc8c34 |
+my @vlvconn;
|
|
|
dc8c34 |
+my @vlvop;
|
|
|
dc8c34 |
+my @start_time_of_connection;
|
|
|
dc8c34 |
+my @end_time_of_connection;
|
|
|
dc8c34 |
+my @fds;
|
|
|
dc8c34 |
+my $fdds = 0;
|
|
|
dc8c34 |
+my $reportBinds = "no";
|
|
|
dc8c34 |
+my $rootDN = "";
|
|
|
dc8c34 |
+my $needCleanup = 0;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
GetOptions(
|
|
|
dc8c34 |
'd|rootDN=s' => \$rootDN,
|
|
|
dc8c34 |
@@ -129,6 +158,7 @@ if($rootDN eq ""){
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# get the logs
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
+my @files = ();
|
|
|
dc8c34 |
while($arg_count <= $#ARGV){
|
|
|
dc8c34 |
$files[$file_count] = $ARGV[$arg_count];
|
|
|
dc8c34 |
$file_count++;
|
|
|
dc8c34 |
@@ -155,127 +185,93 @@ if ($sizeCount eq "all"){$sizeCount = "100000";}
|
|
|
dc8c34 |
print "\nAccess Log Analyzer $logversion\n";
|
|
|
dc8c34 |
print "\nCommand: logconv.pl @ARGV\n\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$rootDNBindCount = 0;
|
|
|
dc8c34 |
-$anonymousBindCount = 0;
|
|
|
dc8c34 |
-$unindexedSrchCountNotesA = 0;
|
|
|
dc8c34 |
-$unindexedSrchCountNotesU = 0;
|
|
|
dc8c34 |
-$vlvNotesACount= 0;
|
|
|
dc8c34 |
-$vlvNotesUCount= 0;
|
|
|
dc8c34 |
-$srchCount = 0;
|
|
|
dc8c34 |
-$fdTaken = 0;
|
|
|
dc8c34 |
-$fdReturned = 0;
|
|
|
dc8c34 |
-$highestFdTaken = 0;
|
|
|
dc8c34 |
-$unbindCount = 0;
|
|
|
dc8c34 |
-$cmpCount = 0;
|
|
|
dc8c34 |
-$modCount = 0;
|
|
|
dc8c34 |
-$delCount = 0;
|
|
|
dc8c34 |
-$addCount = 0;
|
|
|
dc8c34 |
-$modrdnCount = 0;
|
|
|
dc8c34 |
-$abandonCount = 0;
|
|
|
dc8c34 |
-$extopCount = 0;
|
|
|
dc8c34 |
-$vlvCount = 0;
|
|
|
dc8c34 |
-$errorCount = 0;
|
|
|
dc8c34 |
-$proxiedAuthCount = 0;
|
|
|
dc8c34 |
-$serverRestartCount = 0;
|
|
|
dc8c34 |
-$resourceUnavailCount = 0;
|
|
|
dc8c34 |
-$brokenPipeCount = 0;
|
|
|
dc8c34 |
-$v2BindCount = 0;
|
|
|
dc8c34 |
-$v3BindCount = 0;
|
|
|
dc8c34 |
-$vlvSortCount = 0;
|
|
|
dc8c34 |
-$connResetByPeerCount = 0;
|
|
|
dc8c34 |
-$isVlvNotes = 0;
|
|
|
dc8c34 |
-$successCount = 0;
|
|
|
dc8c34 |
-$sslCount = 0;
|
|
|
dc8c34 |
-$sslClientBindCount = 0;
|
|
|
dc8c34 |
-$sslClientFailedCount = 0;
|
|
|
dc8c34 |
-$objectclassTopCount= 0;
|
|
|
dc8c34 |
-$pagedSearchCount = 0;
|
|
|
dc8c34 |
-$bindCount = 0;
|
|
|
dc8c34 |
-$filterCount = 0;
|
|
|
dc8c34 |
-$baseCount = 0;
|
|
|
dc8c34 |
-$scopeCount = 0;
|
|
|
dc8c34 |
-$allOps = 0;
|
|
|
dc8c34 |
-$allResults = 0;
|
|
|
dc8c34 |
-$badPwdCount = 0;
|
|
|
dc8c34 |
-$saslBindCount = 0;
|
|
|
dc8c34 |
-$internalOpCount = 0;
|
|
|
dc8c34 |
-$entryOpCount = 0;
|
|
|
dc8c34 |
-$referralCount = 0;
|
|
|
dc8c34 |
-$anyAttrs = 0;
|
|
|
dc8c34 |
-$persistentSrchCount = 0;
|
|
|
dc8c34 |
-$maxBerSizeCount = 0;
|
|
|
dc8c34 |
-$connectionCount = 0;
|
|
|
dc8c34 |
-$timerange = 0;
|
|
|
dc8c34 |
-$simConnection = 0;
|
|
|
dc8c34 |
-$maxsimConnection = 0;
|
|
|
dc8c34 |
-$firstFile = 1;
|
|
|
dc8c34 |
-$elapsedDays = 0;
|
|
|
dc8c34 |
-$logCount = 0;
|
|
|
dc8c34 |
-$startTLSCount = 0;
|
|
|
dc8c34 |
-$ldapiCount = 0;
|
|
|
dc8c34 |
-$autobindCount = 0;
|
|
|
dc8c34 |
-$limit = 25000; # number of lines processed to trigger output
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# hash files
|
|
|
dc8c34 |
-$ATTR = "$dataLocation/attr.logconv";
|
|
|
dc8c34 |
-$RC = "$dataLocation/rc.logconv";
|
|
|
dc8c34 |
-$SRC = "$dataLocation/src.logconv";
|
|
|
dc8c34 |
-$RSRC = "$dataLocation/rsrc.logconv";
|
|
|
dc8c34 |
-$EXCOUNT = "$dataLocation/excount.logconv";
|
|
|
dc8c34 |
-$CONN_HASH = "$dataLocation/conn_hash.logconv";
|
|
|
dc8c34 |
-$IP_HASH = "$dataLocation/ip_hash.logconv";
|
|
|
dc8c34 |
-$CONNCOUNT = "$dataLocation/conncount.logconv";
|
|
|
dc8c34 |
-$NENTRIES = "$dataLocation/nentries.logconv";
|
|
|
dc8c34 |
-$FILTER = "$dataLocation/filter.logconv";
|
|
|
dc8c34 |
-$BASE = "$dataLocation/base.logconv";
|
|
|
dc8c34 |
-$DS6XBADPWD = "$dataLocation/ds6xbadpwd.logconv";
|
|
|
dc8c34 |
-$SASLMECH = "$dataLocation/saslmech.logconv";
|
|
|
dc8c34 |
-$BINDLIST = "$dataLocation/bindlist.logconv";
|
|
|
dc8c34 |
-$ETIME = "$dataLocation/etime.logconv";
|
|
|
dc8c34 |
-$OID = "$dataLocation/oid.logconv";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# array files
|
|
|
dc8c34 |
-$SRCH_CONN = "$dataLocation/srchconn.logconv";
|
|
|
dc8c34 |
-$SRCH_OP = "$dataLocation/srchop.logconv";
|
|
|
dc8c34 |
-$DEL_CONN = "$dataLocation/delconn.logconv";
|
|
|
dc8c34 |
-$DEL_OP = "$dataLocation/delop.logconv";
|
|
|
dc8c34 |
-$MOD_CONN = "$dataLocation/modconn.logconv";
|
|
|
dc8c34 |
-$MOD_OP = "$dataLocation/modop.logconv";
|
|
|
dc8c34 |
-$ADD_CONN = "$dataLocation/addconn.logconv";
|
|
|
dc8c34 |
-$ADD_OP = "$dataLocation/addop.logconv";
|
|
|
dc8c34 |
-$MODRDN_CONN = "$dataLocation/modrdnconn.logconv";
|
|
|
dc8c34 |
-$MODRDN_OP = "$dataLocation/modrdnop.logconv";
|
|
|
dc8c34 |
-$CMP_CONN = "$dataLocation/cmpconn.logconv";
|
|
|
dc8c34 |
-$CMP_OP = "$dataLocation/cmpop.logconv";
|
|
|
dc8c34 |
-$TARGET_CONN = "$dataLocation/targetconn.logconv";
|
|
|
dc8c34 |
-$TARGET_OP = "$dataLocation/targetop.logconv";
|
|
|
dc8c34 |
-$MSGID = "$dataLocation/msgid.logconv";
|
|
|
dc8c34 |
-$BIND_CONN = "$dataLocation/bindconn.logconv";
|
|
|
dc8c34 |
-$BIND_OP = "$dataLocation/bindop.logconv";
|
|
|
dc8c34 |
-$UNBIND_CONN = "$dataLocation/unbindconn.logconv";
|
|
|
dc8c34 |
-$UNBIND_OP = "$dataLocation/unbindop.logconv";
|
|
|
dc8c34 |
-$EXT_CONN = "$dataLocation/extconn.logconv";
|
|
|
dc8c34 |
-$EXT_OP = "$dataLocation/extop.logconv";
|
|
|
dc8c34 |
-$NOTES_A_ETIME = "$dataLocation/notesAetime.logconv";
|
|
|
dc8c34 |
-$NOTES_A_CONN = "$dataLocation/notesAconn.logconv";
|
|
|
dc8c34 |
-$NOTES_A_OP = "$dataLocation/notesAop.logconv";
|
|
|
dc8c34 |
-$NOTES_A_TIME = "$dataLocation/notesAtime.logconv";
|
|
|
dc8c34 |
-$NOTES_A_NENTRIES = "$dataLocation/notesAnentries.logconv";
|
|
|
dc8c34 |
-$NOTES_U_ETIME = "$dataLocation/notesUetime.logconv";
|
|
|
dc8c34 |
-$NOTES_U_CONN = "$dataLocation/notesUconn.logconv";
|
|
|
dc8c34 |
-$NOTES_U_OP = "$dataLocation/notesUop.logconv";
|
|
|
dc8c34 |
-$NOTES_U_TIME = "$dataLocation/notesUtime.logconv";
|
|
|
dc8c34 |
-$NOTES_U_NENTRIES = "$dataLocation/notesUnentries.logconv";
|
|
|
dc8c34 |
-$BADPWDCONN = "$dataLocation/badpwdconn.logconv";
|
|
|
dc8c34 |
-$BADPWDOP = "$dataLocation/badpwdop.logconv";
|
|
|
dc8c34 |
-$BADPWDIP = "$dataLocation/badpwdip.logconv";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# info files
|
|
|
dc8c34 |
-$BINDINFO = "$dataLocation/bindinfo.logconv";
|
|
|
dc8c34 |
-$BASEINFO = "$dataLocation/baseinfo.logconv";
|
|
|
dc8c34 |
-$FILTERINFO = "$dataLocation/filterinfo.logconv";
|
|
|
dc8c34 |
-$SCOPEINFO = "$dataLocation/scopeinfo.logconv";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+my $rootDNBindCount = 0;
|
|
|
dc8c34 |
+my $anonymousBindCount = 0;
|
|
|
dc8c34 |
+my $unindexedSrchCountNotesA = 0;
|
|
|
dc8c34 |
+my $unindexedSrchCountNotesU = 0;
|
|
|
dc8c34 |
+my $vlvNotesACount= 0;
|
|
|
dc8c34 |
+my $vlvNotesUCount= 0;
|
|
|
dc8c34 |
+my $srchCount = 0;
|
|
|
dc8c34 |
+my $fdTaken = 0;
|
|
|
dc8c34 |
+my $fdReturned = 0;
|
|
|
dc8c34 |
+my $highestFdTaken = 0;
|
|
|
dc8c34 |
+my $unbindCount = 0;
|
|
|
dc8c34 |
+my $cmpCount = 0;
|
|
|
dc8c34 |
+my $modCount = 0;
|
|
|
dc8c34 |
+my $delCount = 0;
|
|
|
dc8c34 |
+my $addCount = 0;
|
|
|
dc8c34 |
+my $modrdnCount = 0;
|
|
|
dc8c34 |
+my $abandonCount = 0;
|
|
|
dc8c34 |
+my $extopCount = 0;
|
|
|
dc8c34 |
+my $vlvCount = 0;
|
|
|
dc8c34 |
+my $errorCount = 0;
|
|
|
dc8c34 |
+my $proxiedAuthCount = 0;
|
|
|
dc8c34 |
+my $serverRestartCount = 0;
|
|
|
dc8c34 |
+my $resourceUnavailCount = 0;
|
|
|
dc8c34 |
+my $brokenPipeCount = 0;
|
|
|
dc8c34 |
+my $v2BindCount = 0;
|
|
|
dc8c34 |
+my $v3BindCount = 0;
|
|
|
dc8c34 |
+my $vlvSortCount = 0;
|
|
|
dc8c34 |
+my $connResetByPeerCount = 0;
|
|
|
dc8c34 |
+my $isVlvNotes = 0;
|
|
|
dc8c34 |
+my $successCount = 0;
|
|
|
dc8c34 |
+my $sslCount = 0;
|
|
|
dc8c34 |
+my $sslClientBindCount = 0;
|
|
|
dc8c34 |
+my $sslClientFailedCount = 0;
|
|
|
dc8c34 |
+my $objectclassTopCount= 0;
|
|
|
dc8c34 |
+my $pagedSearchCount = 0;
|
|
|
dc8c34 |
+my $bindCount = 0;
|
|
|
dc8c34 |
+my $filterCount = 0;
|
|
|
dc8c34 |
+my $baseCount = 0;
|
|
|
dc8c34 |
+my $scopeCount = 0;
|
|
|
dc8c34 |
+my $allOps = 0;
|
|
|
dc8c34 |
+my $allResults = 0;
|
|
|
dc8c34 |
+my $badPwdCount = 0;
|
|
|
dc8c34 |
+my $saslBindCount = 0;
|
|
|
dc8c34 |
+my $internalOpCount = 0;
|
|
|
dc8c34 |
+my $entryOpCount = 0;
|
|
|
dc8c34 |
+my $referralCount = 0;
|
|
|
dc8c34 |
+my $anyAttrs = 0;
|
|
|
dc8c34 |
+my $persistentSrchCount = 0;
|
|
|
dc8c34 |
+my $maxBerSizeCount = 0;
|
|
|
dc8c34 |
+my $connectionCount = 0;
|
|
|
dc8c34 |
+my $timerange = 0;
|
|
|
dc8c34 |
+my $simConnection = 0;
|
|
|
dc8c34 |
+my $maxsimConnection = 0;
|
|
|
dc8c34 |
+my $firstFile = 1;
|
|
|
dc8c34 |
+my $elapsedDays = 0;
|
|
|
dc8c34 |
+my $logCount = 0;
|
|
|
dc8c34 |
+my $startTLSCount = 0;
|
|
|
dc8c34 |
+my $ldapiCount = 0;
|
|
|
dc8c34 |
+my $autobindCount = 0;
|
|
|
dc8c34 |
+my $limit = 25000; # number of lines processed to trigger output
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+my @removefiles = ();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+my @conncodes = qw(A1 B1 B4 T1 T2 B2 B3 R1 P1 P2 U1);
|
|
|
dc8c34 |
+my %conn = ();
|
|
|
dc8c34 |
+map {$conn{$_} = $_} @conncodes;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# hash db-backed hashes
|
|
|
dc8c34 |
+my @hashnames = qw(attr rc src rsrc excount conn_hash ip_hash conncount nentries
|
|
|
dc8c34 |
+ filter base ds6xbadpwd saslmech bindlist etime oid);
|
|
|
dc8c34 |
+# need per connection code ip address counts - so use a hash table
|
|
|
dc8c34 |
+# for each connection code - key is ip, val is count
|
|
|
dc8c34 |
+push @hashnames, @conncodes;
|
|
|
dc8c34 |
+my $hashes = openHashFiles($dataLocation, @hashnames);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# recno db-backed arrays/lists
|
|
|
dc8c34 |
+my @arraynames = qw(srchconn srchop delconn delop modconn modop addconn addop modrdnconn modrdnop
|
|
|
dc8c34 |
+ cmpconn cmpop targetconn targetop msgid bindconn bindop binddn unbindconn unbindop
|
|
|
dc8c34 |
+ extconn extop notesAetime notesAconn notesAop notesAtime notesAnentries
|
|
|
dc8c34 |
+ notesUetime notesUconn notesUop notesUtime notesUnentries badpwdconn
|
|
|
dc8c34 |
+ badpwdop badpwdip baseval baseconn baseop scopeval scopeconn scopeop
|
|
|
dc8c34 |
+ filterval filterconn filterop);
|
|
|
dc8c34 |
+my $arrays = openArrayFiles($dataLocation, @arraynames);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$needCleanup = 1;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+my @err;
|
|
|
dc8c34 |
$err[0] = "Successful Operations\n";
|
|
|
dc8c34 |
$err[1] = "Operations Error(s)\n";
|
|
|
dc8c34 |
$err[2] = "Protocal Errors\n";
|
|
|
dc8c34 |
@@ -338,19 +334,7 @@ $err[95] = "More Results To Return\n";
|
|
|
dc8c34 |
$err[96] = "Client Loop\n";
|
|
|
dc8c34 |
$err[97] = "Referral Limit Exceeded\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-$conn{"A1"} = "A1";
|
|
|
dc8c34 |
-$conn{"B1"} = "B1";
|
|
|
dc8c34 |
-$conn{"B4"} = "B4";
|
|
|
dc8c34 |
-$conn{"T1"} = "T1";
|
|
|
dc8c34 |
-$conn{"T2"} = "T2";
|
|
|
dc8c34 |
-$conn{"B2"} = "B2";
|
|
|
dc8c34 |
-$conn{"B3"} = "B3";
|
|
|
dc8c34 |
-$conn{"R1"} = "R1";
|
|
|
dc8c34 |
-$conn{"P1"} = "P1";
|
|
|
dc8c34 |
-$conn{"P2"} = "P2";
|
|
|
dc8c34 |
-$conn{"U1"} = "U1";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+my %connmsg;
|
|
|
dc8c34 |
$connmsg{"A1"} = "Client Aborted Connections";
|
|
|
dc8c34 |
$connmsg{"B1"} = "Bad Ber Tag Encountered";
|
|
|
dc8c34 |
$connmsg{"B4"} = "Server failed to flush data (response) back to Client";
|
|
|
dc8c34 |
@@ -363,7 +347,7 @@ $connmsg{"P1"} = "Plugin";
|
|
|
dc8c34 |
$connmsg{"P2"} = "Poll";
|
|
|
dc8c34 |
$connmsg{"U1"} = "Cleanly Closed Connections";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-%monthname = (
|
|
|
dc8c34 |
+my %monthname = (
|
|
|
dc8c34 |
"Jan" => 0,
|
|
|
dc8c34 |
"Feb" => 1,
|
|
|
dc8c34 |
"Mar" => 2,
|
|
|
dc8c34 |
@@ -379,7 +363,17 @@ $connmsg{"U1"} = "Cleanly Closed Connections";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-openDataFiles();
|
|
|
dc8c34 |
+my $linesProcessed;
|
|
|
dc8c34 |
+my $lineBlockCount;
|
|
|
dc8c34 |
+my $cursize = 0;
|
|
|
dc8c34 |
+sub statusreport {
|
|
|
dc8c34 |
+ if ($lineBlockCount > $limit) {
|
|
|
dc8c34 |
+ my $curpos = tell(LOG);
|
|
|
dc8c34 |
+ my $percent = $curpos/$cursize*100.0;
|
|
|
dc8c34 |
+ print sprintf "%10d Lines Processed %12d of %12d bytes (%.3f%%)\n",--$linesProcessed,$curpos,$cursize,$percent;
|
|
|
dc8c34 |
+ $lineBlockCount = 0;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
##########################################
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
@@ -394,6 +388,7 @@ print "Processing $file_count Access Log(s)...\n\n";
|
|
|
dc8c34 |
#print "Filename\t\t\t Total Lines\n";
|
|
|
dc8c34 |
#print "--------------------------------------------------\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my $skipFirstFile = 0;
|
|
|
dc8c34 |
if ($file_count > 1 && $files[0] =~ /\/access$/){
|
|
|
dc8c34 |
$files[$file_count] = $files[0];
|
|
|
dc8c34 |
$file_count++;
|
|
|
dc8c34 |
@@ -401,25 +396,30 @@ if ($file_count > 1 && $files[0] =~ /\/access$/){
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$logCount = $file_count;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-for ($count=0; $count < $file_count; $count++){
|
|
|
dc8c34 |
+my $logline;
|
|
|
dc8c34 |
+my $totalLineCount = 0;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+for (my $count=0; $count < $file_count; $count++){
|
|
|
dc8c34 |
# we moved access to the end of the list, so if its the first file skip it
|
|
|
dc8c34 |
if($file_count > 1 && $count == 0 && $skipFirstFile == 1){
|
|
|
dc8c34 |
next;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- $logsize = `wc -l $files[$count]`;
|
|
|
dc8c34 |
- $logsize =~ /([0-9]+)/;
|
|
|
dc8c34 |
$linesProcessed = 0; $lineBlockCount = 0;
|
|
|
dc8c34 |
$logCount--;
|
|
|
dc8c34 |
+ my $logCountStr;
|
|
|
dc8c34 |
if($logCount < 10 ){
|
|
|
dc8c34 |
# add a zero for formatting purposes
|
|
|
dc8c34 |
$logCountStr = "0" . $logCount;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
$logCountStr = $logCount;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- print sprintf "[%s] %-30s\tlines: %7s\n",$logCountStr, $files[$count], $1;
|
|
|
dc8c34 |
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$atime,$mtime,$ctime,$blksize,$blocks);
|
|
|
dc8c34 |
+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$cursize,
|
|
|
dc8c34 |
+ $atime,$mtime,$ctime,$blksize,$blocks) = stat($files[$count]);
|
|
|
dc8c34 |
+ print sprintf "[%s] %-30s\tsize (bytes): %12s\n",$logCountStr, $files[$count], $cursize;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
open(LOG,"$files[$count]") or do { openFailed($!, $files[$count]) };
|
|
|
dc8c34 |
- $firstline = "yes";
|
|
|
dc8c34 |
+ my $firstline = "yes";
|
|
|
dc8c34 |
while(<LOG>){
|
|
|
dc8c34 |
unless ($endFlag) {
|
|
|
dc8c34 |
if ($firstline eq "yes"){
|
|
|
dc8c34 |
@@ -442,7 +442,7 @@ for ($count=0; $count < $file_count; $count++){
|
|
|
dc8c34 |
print_stats_block( $s_stats );
|
|
|
dc8c34 |
print_stats_block( $m_stats );
|
|
|
dc8c34 |
$totalLineCount = $totalLineCount + $linesProcessed;
|
|
|
dc8c34 |
- if($linesProcessed => $limit){print sprintf " %10s Lines Processed\n\n",--$linesProcessed;}
|
|
|
dc8c34 |
+ statusreport();
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print "\n\nTotal Log Lines Analysed: " . ($totalLineCount - 1) . "\n";
|
|
|
dc8c34 |
@@ -457,9 +457,11 @@ $allOps = $srchCount + $modCount + $addCount + $cmpCount + $delCount + $modrdnCo
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# if we are using startTime & endTime then we need to clean it up for our processing
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my $start;
|
|
|
dc8c34 |
if($startTime){
|
|
|
dc8c34 |
if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
+my $end;
|
|
|
dc8c34 |
if($endTime){
|
|
|
dc8c34 |
if ($end =~ / *([0-9a-z:\/]+)/i){$end =$1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -468,8 +470,10 @@ if($endTime){
|
|
|
dc8c34 |
# Get the start time in seconds
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$logStart = $start;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+my $logStart = $start;
|
|
|
dc8c34 |
+my $logDate;
|
|
|
dc8c34 |
+my @dateComps;
|
|
|
dc8c34 |
+my ($timeMonth, $timeDay, $timeYear, $dateTotal);
|
|
|
dc8c34 |
if ($logStart =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
$logDate = $1;
|
|
|
dc8c34 |
@dateComps = split /\//, $logDate;
|
|
|
dc8c34 |
@@ -481,6 +485,9 @@ if ($logStart =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
$dateTotal = $timeMonth + $timeDay + $timeYear;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my $logTime;
|
|
|
dc8c34 |
+my @timeComps;
|
|
|
dc8c34 |
+my ($timeHour, $timeMinute, $timeSecond, $timeTotal);
|
|
|
dc8c34 |
if ($logStart =~ / *(:[0-9:]+)/i ){
|
|
|
dc8c34 |
$logTime = $1;
|
|
|
dc8c34 |
@timeComps = split /:/, $logTime;
|
|
|
dc8c34 |
@@ -491,14 +498,14 @@ if ($logStart =~ / *(:[0-9:]+)/i ){
|
|
|
dc8c34 |
$timeTotal = $timeHour + $timeMinute + $timeSecond;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$startTotal = $timeTotal + $dateTotal;
|
|
|
dc8c34 |
+my $startTotal = $timeTotal + $dateTotal;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# Get the end time in seconds
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$logEnd = $end;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+my $logEnd = $end;
|
|
|
dc8c34 |
+my ($endDay, $endMonth, $endYear, $endTotal);
|
|
|
dc8c34 |
if ($logEnd =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
$logDate = $1;
|
|
|
dc8c34 |
@dateComps = split /\//, $logDate;
|
|
|
dc8c34 |
@@ -506,10 +513,11 @@ if ($logEnd =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
$endDay = $dateComps[0] *3600 * 24;
|
|
|
dc8c34 |
$endMonth = 1 + $monthname{$dateComps[1]};
|
|
|
dc8c34 |
$endMonth = $endMonth * 3600 * 24 * 30;
|
|
|
dc8c34 |
- $endYear = $endTotal + $dateComps[2] *365 * 3600 * 24 ;
|
|
|
dc8c34 |
+ $endYear = $dateComps[2] *365 * 3600 * 24 ;
|
|
|
dc8c34 |
$dateTotal = $endDay + $endMonth + $endYear;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my ($endHour, $endMinute, $endSecond);
|
|
|
dc8c34 |
if ($logEnd =~ / *(:[0-9:]+)/i ){
|
|
|
dc8c34 |
$logTime = $1;
|
|
|
dc8c34 |
@timeComps = split /:/, $logTime;
|
|
|
dc8c34 |
@@ -525,8 +533,8 @@ $endTotal = $timeTotal + $dateTotal;
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# Tally the numbers
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
-$totalTimeInSecs = $endTotal - $startTotal;
|
|
|
dc8c34 |
-$remainingTimeInSecs = $totalTimeInSecs;
|
|
|
dc8c34 |
+my $totalTimeInSecs = $endTotal - $startTotal;
|
|
|
dc8c34 |
+my $remainingTimeInSecs = $totalTimeInSecs;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# Calculate the elapsed time
|
|
|
dc8c34 |
@@ -540,33 +548,21 @@ while(($remainingTimeInSecs - 86400) > 0){
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# hours
|
|
|
dc8c34 |
+my $elapsedHours = 0;
|
|
|
dc8c34 |
while(($remainingTimeInSecs - 3600) > 0){
|
|
|
dc8c34 |
$elapsedHours++;
|
|
|
dc8c34 |
$remainingTimeInSecs = $remainingTimeInSecs - 3600;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# minutes
|
|
|
dc8c34 |
+my $elapsedMinutes = 0;
|
|
|
dc8c34 |
while($remainingTimeInSecs - 60 > 0){
|
|
|
dc8c34 |
$elapsedMinutes++;
|
|
|
dc8c34 |
$remainingTimeInSecs = $remainingTimeInSecs - 60;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# seconds
|
|
|
dc8c34 |
-$elapsedSeconds = $remainingTimeInSecs;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# Initialize empty values
|
|
|
dc8c34 |
-if($elapsedHours eq ""){
|
|
|
dc8c34 |
- $elapsedHours = "0";
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-if($elapsedMinutes eq ""){
|
|
|
dc8c34 |
- $elapsedMinutes = "0";
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-if($elapsedSeconds eq ""){
|
|
|
dc8c34 |
- $elapsedSeconds = "0";
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-&closeDataFiles();
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+my $elapsedSeconds = $remainingTimeInSecs;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#####################################
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
@@ -605,20 +601,21 @@ print " - LDAPI Connections: $ldapiCount\n";
|
|
|
dc8c34 |
print "Peak Concurrent Connections: $maxsimConnection\n";
|
|
|
dc8c34 |
print "Total Operations: $allOps\n";
|
|
|
dc8c34 |
print "Total Results: $allResults\n";
|
|
|
dc8c34 |
+my ($perf, $tmp);
|
|
|
dc8c34 |
if ($allOps ne "0"){
|
|
|
dc8c34 |
- print sprintf "Overall Performance: %.1f%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
|
|
|
dc8c34 |
+ print sprintf "Overall Performance: %.1f%%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
else {
|
|
|
dc8c34 |
print "Overall Performance: No Operations to evaluate\n\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-$searchStat = sprintf "(%.2f/sec) (%.2f/min)\n",($srchCount / $totalTimeInSecs), $srchCount / ($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$modStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modCount / $totalTimeInSecs, $modCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$addStat = sprintf "(%.2f/sec) (%.2f/min)\n",$addCount/$totalTimeInSecs, $addCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$deleteStat = sprintf "(%.2f/sec) (%.2f/min)\n",$delCount/$totalTimeInSecs, $delCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$modrdnStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modrdnCount/$totalTimeInSecs, $modrdnCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$compareStat = sprintf "(%.2f/sec) (%.2f/min)\n",$cmpCount/$totalTimeInSecs, $cmpCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
-$bindCountStat = sprintf "(%.2f/sec) (%.2f/min)\n",$bindCount/$totalTimeInSecs, $bindCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $searchStat = sprintf "(%.2f/sec) (%.2f/min)\n",($srchCount / $totalTimeInSecs), $srchCount / ($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $modStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modCount / $totalTimeInSecs, $modCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $addStat = sprintf "(%.2f/sec) (%.2f/min)\n",$addCount/$totalTimeInSecs, $addCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $deleteStat = sprintf "(%.2f/sec) (%.2f/min)\n",$delCount/$totalTimeInSecs, $delCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $modrdnStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modrdnCount/$totalTimeInSecs, $modrdnCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $compareStat = sprintf "(%.2f/sec) (%.2f/min)\n",$cmpCount/$totalTimeInSecs, $cmpCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+my $bindCountStat = sprintf "(%.2f/sec) (%.2f/min)\n",$bindCount/$totalTimeInSecs, $bindCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
format STDOUT =
|
|
|
dc8c34 |
Searches: @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
@@ -658,148 +655,110 @@ print "Unindexed Searches: $unindexedSrchCountNotesA\n";
|
|
|
dc8c34 |
print "Unindexed Components: $unindexedSrchCountNotesU\n";
|
|
|
dc8c34 |
if ($verb eq "yes" || $usage =~ /u/){
|
|
|
dc8c34 |
if ($unindexedSrchCountNotesA > 0){
|
|
|
dc8c34 |
- %conn_hash = getHashFromFile($CONN_HASH);
|
|
|
dc8c34 |
- @notesConn = getArrayFromFile($NOTES_A_CONN);
|
|
|
dc8c34 |
- @notesOp = getArrayFromFile($NOTES_A_OP);
|
|
|
dc8c34 |
- @notesEtime = getArrayFromFile($NOTES_A_ETIME);
|
|
|
dc8c34 |
- @notesTime = getArrayFromFile($NOTES_A_TIME);
|
|
|
dc8c34 |
- @notesNentries = getArrayFromFile($NOTES_A_NENTRIES);
|
|
|
dc8c34 |
- getInfoArraysFromFile($BASEINFO);
|
|
|
dc8c34 |
- @base_val = @fileArray1;
|
|
|
dc8c34 |
- @base_conn = @fileArray2;
|
|
|
dc8c34 |
- @base_op = @fileArray3;
|
|
|
dc8c34 |
- getInfoArraysFromFile($SCOPEINFO);
|
|
|
dc8c34 |
- @scope_val = @fileArray1;
|
|
|
dc8c34 |
- @scope_conn = @fileArray2;
|
|
|
dc8c34 |
- @scope_op = @fileArray3;
|
|
|
dc8c34 |
- getInfoArraysFromFile($FILTERINFO);
|
|
|
dc8c34 |
- @filter_val = @fileArray1;
|
|
|
dc8c34 |
- @filter_conn = @fileArray2;
|
|
|
dc8c34 |
- @filter_op = @fileArray3;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- $notesCount = "1";
|
|
|
dc8c34 |
- for ($n = 0; $n <= $#notesEtime; $n++){
|
|
|
dc8c34 |
- @alreadyseenDN = ();
|
|
|
dc8c34 |
- if($conn_hash{$notesConn[$n]} eq ""){
|
|
|
dc8c34 |
+ my $conn_hash = $hashes->{conn_hash};
|
|
|
dc8c34 |
+ my $notesConn = $arrays->{notesAconn};
|
|
|
dc8c34 |
+ my $notesOp = $arrays->{notesAop};
|
|
|
dc8c34 |
+ my $notesEtime = $arrays->{notesAetime};
|
|
|
dc8c34 |
+ my $notesTime = $arrays->{notesAtime};
|
|
|
dc8c34 |
+ my $notesNentries = $arrays->{notesAnentries};
|
|
|
dc8c34 |
+ my $base_val = $arrays->{baseval};
|
|
|
dc8c34 |
+ my $base_conn = $arrays->{baseconn};
|
|
|
dc8c34 |
+ my $base_op = $arrays->{baseop};
|
|
|
dc8c34 |
+ my $scope_val = $arrays->{scopeval};
|
|
|
dc8c34 |
+ my $scope_conn = $arrays->{scopeconn};
|
|
|
dc8c34 |
+ my $scope_op = $arrays->{scopeop};
|
|
|
dc8c34 |
+ my $filter_val = $arrays->{filterval};
|
|
|
dc8c34 |
+ my $filter_conn = $arrays->{filterconn};
|
|
|
dc8c34 |
+ my $filter_op = $arrays->{filterop};
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ my $notesCount = "1";
|
|
|
dc8c34 |
+ my $unindexedIp;
|
|
|
dc8c34 |
+ for (my $n = 0; $n <= scalar(@{$notesEtime}); $n++){
|
|
|
dc8c34 |
+ if($conn_hash->{$notesConn->[$n]} eq ""){
|
|
|
dc8c34 |
$unindexedIp = "?";
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- $unindexedIp = $conn_hash{$notesConn[$n]};
|
|
|
dc8c34 |
+ $unindexedIp = $conn_hash->{$notesConn->[$n]};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n Unindexed Search #".$notesCount."\n"; $notesCount++;
|
|
|
dc8c34 |
- print " - Date/Time: $notesTime[$n]\n";
|
|
|
dc8c34 |
- print " - Connection Number: $notesConn[$n]\n";
|
|
|
dc8c34 |
- print " - Operation Number: $notesOp[$n]\n";
|
|
|
dc8c34 |
- print " - Etime: $notesEtime[$n]\n";
|
|
|
dc8c34 |
- print " - Nentries: $notesNentries[$n]\n";
|
|
|
dc8c34 |
+ print " - Date/Time: $notesTime->[$n]\n";
|
|
|
dc8c34 |
+ print " - Connection Number: $notesConn->[$n]\n";
|
|
|
dc8c34 |
+ print " - Operation Number: $notesOp->[$n]\n";
|
|
|
dc8c34 |
+ print " - Etime: $notesEtime->[$n]\n";
|
|
|
dc8c34 |
+ print " - Nentries: $notesNentries->[$n]\n";
|
|
|
dc8c34 |
print " - IP Address: $unindexedIp\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $baseCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $base_conn[$nnn] && $notesOp[$n] eq $base_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Base: $base_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $baseCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Base: $base_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $scopeCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $scope_conn[$nnn] && $notesOp[$n] eq $scope_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Scope: $scope_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $scopeCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Scope: $scope_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $filterCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $filter_conn[$nnn] && $notesOp[$n] eq $filter_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Filter: $filter_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $filterCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Filter: $filter_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %conn_hash;
|
|
|
dc8c34 |
- undef @notesConn;
|
|
|
dc8c34 |
- undef @notesOp;
|
|
|
dc8c34 |
- undef @notesEtime;
|
|
|
dc8c34 |
- undef @notesTime;
|
|
|
dc8c34 |
- undef @notesNentries;
|
|
|
dc8c34 |
- undef @notesIp;
|
|
|
dc8c34 |
- undef @filter_val;
|
|
|
dc8c34 |
- undef @filter_conn;
|
|
|
dc8c34 |
- undef @filter_op;
|
|
|
dc8c34 |
- undef @base_val;
|
|
|
dc8c34 |
- undef @base_conn;
|
|
|
dc8c34 |
- undef @base_op;
|
|
|
dc8c34 |
- undef @scope_val;
|
|
|
dc8c34 |
- undef @scope_conn;
|
|
|
dc8c34 |
- undef @scope_op;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($unindexedSrchCountNotesU > 0){
|
|
|
dc8c34 |
- %conn_hash = getHashFromFile($CONN_HASH);
|
|
|
dc8c34 |
- @notesConn = getArrayFromFile($NOTES_U_CONN);
|
|
|
dc8c34 |
- @notesOp = getArrayFromFile($NOTES_U_OP);
|
|
|
dc8c34 |
- @notesEtime = getArrayFromFile($NOTES_U_ETIME);
|
|
|
dc8c34 |
- @notesTime = getArrayFromFile($NOTES_U_TIME);
|
|
|
dc8c34 |
- @notesNentries = getArrayFromFile($NOTES_U_NENTRIES);
|
|
|
dc8c34 |
- getInfoArraysFromFile($BASEINFO);
|
|
|
dc8c34 |
- @base_val = @fileArray1;
|
|
|
dc8c34 |
- @base_conn = @fileArray2;
|
|
|
dc8c34 |
- @base_op = @fileArray3;
|
|
|
dc8c34 |
- getInfoArraysFromFile($SCOPEINFO);
|
|
|
dc8c34 |
- @scope_val = @fileArray1;
|
|
|
dc8c34 |
- @scope_conn = @fileArray2;
|
|
|
dc8c34 |
- @scope_op = @fileArray3;
|
|
|
dc8c34 |
- getInfoArraysFromFile($FILTERINFO);
|
|
|
dc8c34 |
- @filter_val = @fileArray1;
|
|
|
dc8c34 |
- @filter_conn = @fileArray2;
|
|
|
dc8c34 |
- @filter_op = @fileArray3;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- $notesCount = "1";
|
|
|
dc8c34 |
- for ($n = 0; $n <= $#notesEtime; $n++){
|
|
|
dc8c34 |
- @alreadyseenDN = ();
|
|
|
dc8c34 |
- if($conn_hash{$notesConn[$n]} eq ""){
|
|
|
dc8c34 |
+ my $conn_hash = $hashes->{conn_hash};
|
|
|
dc8c34 |
+ my $notesConn = $arrays->{notesUconn};
|
|
|
dc8c34 |
+ my $notesOp = $arrays->{notesUop};
|
|
|
dc8c34 |
+ my $notesEtime = $arrays->{notesUetime};
|
|
|
dc8c34 |
+ my $notesTime = $arrays->{notesUtime};
|
|
|
dc8c34 |
+ my $notesNentries = $arrays->{notesUnentries};
|
|
|
dc8c34 |
+ my $base_val = $arrays->{baseval};
|
|
|
dc8c34 |
+ my $base_conn = $arrays->{baseconn};
|
|
|
dc8c34 |
+ my $base_op = $arrays->{baseop};
|
|
|
dc8c34 |
+ my $scope_val = $arrays->{scopeval};
|
|
|
dc8c34 |
+ my $scope_conn = $arrays->{scopeconn};
|
|
|
dc8c34 |
+ my $scope_op = $arrays->{scopeop};
|
|
|
dc8c34 |
+ my $filter_val = $arrays->{filterval};
|
|
|
dc8c34 |
+ my $filter_conn = $arrays->{filterconn};
|
|
|
dc8c34 |
+ my $filter_op = $arrays->{filterop};
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ my $notesCount = "1";
|
|
|
dc8c34 |
+ my $unindexedIp;
|
|
|
dc8c34 |
+ for (my $n = 0; $n <= scalar(@{$notesEtime}); $n++){
|
|
|
dc8c34 |
+ if($conn_hash->{$notesConn->[$n]} eq ""){
|
|
|
dc8c34 |
$unindexedIp = "?";
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- $unindexedIp = $conn_hash{$notesConn[$n]};
|
|
|
dc8c34 |
+ $unindexedIp = $conn_hash->{$notesConn->[$n]};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n Unindexed Components #".$notesCount."\n"; $notesCount++;
|
|
|
dc8c34 |
- print " - Date/Time: $notesTime[$n]\n";
|
|
|
dc8c34 |
- print " - Connection Number: $notesConn[$n]\n";
|
|
|
dc8c34 |
- print " - Operation Number: $notesOp[$n]\n";
|
|
|
dc8c34 |
- print " - Etime: $notesEtime[$n]\n";
|
|
|
dc8c34 |
- print " - Nentries: $notesNentries[$n]\n";
|
|
|
dc8c34 |
+ print " - Date/Time: $notesTime->[$n]\n";
|
|
|
dc8c34 |
+ print " - Connection Number: $notesConn->[$n]\n";
|
|
|
dc8c34 |
+ print " - Operation Number: $notesOp->[$n]\n";
|
|
|
dc8c34 |
+ print " - Etime: $notesEtime->[$n]\n";
|
|
|
dc8c34 |
+ print " - Nentries: $notesNentries->[$n]\n";
|
|
|
dc8c34 |
print " - IP Address: $unindexedIp\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $baseCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $base_conn[$nnn] && $notesOp[$n] eq $base_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Base: $base_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $baseCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Base: $base_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $scopeCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $scope_conn[$nnn] && $notesOp[$n] eq $scope_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Scope: $scope_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $scopeCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Scope: $scope_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($nnn = 0; $nnn < $filterCount; $nnn++){
|
|
|
dc8c34 |
- if ($notesConn[$n] eq $filter_conn[$nnn] && $notesOp[$n] eq $filter_op[$nnn]){
|
|
|
dc8c34 |
- print " - Search Filter: $filter_val[$nnn]\n";
|
|
|
dc8c34 |
+ for (my $nnn = 0; $nnn < $filterCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Filter: $filter_val->[$nnn]\n";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %conn_hash;
|
|
|
dc8c34 |
- undef @notesConn;
|
|
|
dc8c34 |
- undef @notesOp;
|
|
|
dc8c34 |
- undef @notesEtime;
|
|
|
dc8c34 |
- undef @notesTime;
|
|
|
dc8c34 |
- undef @notesNentries;
|
|
|
dc8c34 |
- undef @notesIp;
|
|
|
dc8c34 |
- undef @filter_val;
|
|
|
dc8c34 |
- undef @filter_conn;
|
|
|
dc8c34 |
- undef @filter_op;
|
|
|
dc8c34 |
- undef @base_val;
|
|
|
dc8c34 |
- undef @base_conn;
|
|
|
dc8c34 |
- undef @base_op;
|
|
|
dc8c34 |
- undef @scope_val;
|
|
|
dc8c34 |
- undef @scope_conn;
|
|
|
dc8c34 |
- undef @scope_op;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
} # end of unindexed search report
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -809,10 +768,12 @@ print "FDs Returned: $fdReturned\n";
|
|
|
dc8c34 |
print "Highest FD Taken: $highestFdTaken\n\n";
|
|
|
dc8c34 |
print "Broken Pipes: $brokenPipeCount\n";
|
|
|
dc8c34 |
if ($brokenPipeCount > 0){
|
|
|
dc8c34 |
- foreach $key (sort { $rc{$b} <=> $rc{$a} } keys %rc) {
|
|
|
dc8c34 |
- if ($rc{$key} > 0){
|
|
|
dc8c34 |
+ my $rc = $hashes->{rc};
|
|
|
dc8c34 |
+ my @etext;
|
|
|
dc8c34 |
+ foreach my $key (sort { $rc->{$b} <=> $rc->{$a} } keys %{$rc}) {
|
|
|
dc8c34 |
+ if ($rc->{$key} > 0){
|
|
|
dc8c34 |
if ($conn{$key} eq ""){$conn{$key} = "**Unknown**";}
|
|
|
dc8c34 |
- push @etext, sprintf " - %-4s (%2s) %-40s\n",$rc{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
+ push @etext, sprintf " - %-4s (%2s) %-40s\n",$rc->{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -822,10 +783,12 @@ if ($brokenPipeCount > 0){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print "Connections Reset By Peer: $connResetByPeerCount\n";
|
|
|
dc8c34 |
if ($connResetByPeerCount > 0){
|
|
|
dc8c34 |
- foreach $key (sort { $src{$b} <=> $src{$a} } keys %src) {
|
|
|
dc8c34 |
- if ($src{$key} > 0){
|
|
|
dc8c34 |
+ my $src = $hashes->{src};
|
|
|
dc8c34 |
+ my @retext;
|
|
|
dc8c34 |
+ foreach my $key (sort { $src->{$b} <=> $src->{$a} } keys %{$src}) {
|
|
|
dc8c34 |
+ if ($src->{$key} > 0){
|
|
|
dc8c34 |
if ($conn{$key} eq ""){$conn{$key} = "**Unknown**";}
|
|
|
dc8c34 |
- push @retext, sprintf " - %-4s (%2s) %-40s\n",$src{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
+ push @retext, sprintf " - %-4s (%2s) %-40s\n",$src->{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -835,10 +798,12 @@ if ($connResetByPeerCount > 0){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print "Resource Unavailable: $resourceUnavailCount\n";
|
|
|
dc8c34 |
if ($resourceUnavailCount > 0){
|
|
|
dc8c34 |
- foreach $key (sort { $rsrc{$b} <=> $rsrc{$a} } keys %rsrc) {
|
|
|
dc8c34 |
- if ($rsrc{$key} > 0){
|
|
|
dc8c34 |
+ my $rsrc = $hashes->{rsrc};
|
|
|
dc8c34 |
+ my @rtext;
|
|
|
dc8c34 |
+ foreach my $key (sort { $rsrc->{$b} <=> $rsrc->{$a} } keys %{$rsrc}) {
|
|
|
dc8c34 |
+ if ($rsrc->{$key} > 0){
|
|
|
dc8c34 |
if ($conn{$key} eq ""){$conn{$key} = "**Resource Issue**";}
|
|
|
dc8c34 |
- push @rtext, sprintf " - %-4s (%2s) %-40s\n",$rsrc{$key},$conn{$key},$connmsg{$key};
|
|
|
dc8c34 |
+ push @rtext, sprintf " - %-4s (%2s) %-40s\n",$rsrc->{$key},$conn{$key},$connmsg{$key};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print @rtext;
|
|
|
dc8c34 |
@@ -854,14 +819,15 @@ print " - SSL Client Binds: $sslClientBindCount\n";
|
|
|
dc8c34 |
print " - Failed SSL Client Binds: $sslClientFailedCount\n";
|
|
|
dc8c34 |
print " - SASL Binds: $saslBindCount\n";
|
|
|
dc8c34 |
if ($saslBindCount > 0){
|
|
|
dc8c34 |
- foreach $saslb ( sort {$saslmech{$b} <=> $saslmech{$a} } (keys %saslmech) ){
|
|
|
dc8c34 |
- printf " %-4s %-12s\n",$saslmech{$saslb}, $saslb;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ my $saslmech = $hashes->{saslmech};
|
|
|
dc8c34 |
+ foreach my $saslb ( sort {$saslmech->{$b} <=> $saslmech->{$a} } (keys %{$saslmech}) ){
|
|
|
dc8c34 |
+ printf " %-4s %-12s\n",$saslmech->{$saslb}, $saslb;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print " - Directory Manager Binds: $rootDNBindCount\n";
|
|
|
dc8c34 |
print " - Anonymous Binds: $anonymousBindCount\n";
|
|
|
dc8c34 |
-$otherBindCount = $bindCount -($rootDNBindCount + $anonymousBindCount);
|
|
|
dc8c34 |
+my $otherBindCount = $bindCount -($rootDNBindCount + $anonymousBindCount);
|
|
|
dc8c34 |
print " - Other Binds: $otherBindCount\n\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
##########################################################################
|
|
|
dc8c34 |
@@ -879,8 +845,10 @@ if ($verb eq "yes" || $usage =~ /y/){
|
|
|
dc8c34 |
print " (in seconds)\t\t<=1\t2\t3\t4-5\t6-10\t11-15\t>15\n";
|
|
|
dc8c34 |
print " --------------------------------------------------------------------------\n";
|
|
|
dc8c34 |
print " (# of connections)\t";
|
|
|
dc8c34 |
- for ($i=0; $i <=$#latency; $i++) {
|
|
|
dc8c34 |
- print "$latency[$i]\t";
|
|
|
dc8c34 |
+ for (my $i=0; $i <=$#latency; $i++) {
|
|
|
dc8c34 |
+ if (defined($latency[$i])) {
|
|
|
dc8c34 |
+ print "$latency[$i]\t";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -891,9 +859,9 @@ if ($verb eq "yes" || $usage =~ /y/){
|
|
|
dc8c34 |
###################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($verb eq "yes" || $usage =~ /p/){
|
|
|
dc8c34 |
- if ($openConnection[0] ne ""){
|
|
|
dc8c34 |
+ if (@openConnection > 0){
|
|
|
dc8c34 |
print "\n\n----- Current Open Connection IDs ----- \n\n";
|
|
|
dc8c34 |
- for ($i=0; $i <= $#openConnection ; $i++) {
|
|
|
dc8c34 |
+ for (my $i=0; $i <= $#openConnection ; $i++) {
|
|
|
dc8c34 |
if ($openConnection[$i]) {
|
|
|
dc8c34 |
print "Conn Number: $i (" . getIPfromConn($i) . ")\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -910,17 +878,16 @@ if ($verb eq "yes" || $usage =~ /p/){
|
|
|
dc8c34 |
if ($usage =~ /e/i || $verb eq "yes"){
|
|
|
dc8c34 |
print "\n\n----- Errors -----\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- %er = sort( {$b <=> $a} %er);
|
|
|
dc8c34 |
- for ($i = 0; $i<98; $i++){
|
|
|
dc8c34 |
- if ($err[$i] ne "" && $errorCode[$i] >0) {
|
|
|
dc8c34 |
+ for (my $i = 0; $i<98; $i++){
|
|
|
dc8c34 |
+ if (defined($err[$i]) && $err[$i] ne "" && defined($errorCode[$i]) && $errorCode[$i] >0) {
|
|
|
dc8c34 |
push @errtext, sprintf "%-8s %12s %-25s","err=$i",$errorCode[$i],$err[$i];
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ($i = 0; $i < $#errtext; $i++){
|
|
|
dc8c34 |
- for ($ii = 0; $ii < $#errtext; $ii++){
|
|
|
dc8c34 |
- $yy="0";
|
|
|
dc8c34 |
- $zz="0";
|
|
|
dc8c34 |
+ for (my $i = 0; $i < $#errtext; $i++){
|
|
|
dc8c34 |
+ for (my $ii = 0; $ii < $#errtext; $ii++){
|
|
|
dc8c34 |
+ my $yy="0";
|
|
|
dc8c34 |
+ my $zz="0";
|
|
|
dc8c34 |
while ($errtext[$ii] =~ /(\w+)\s/g){
|
|
|
dc8c34 |
$errornum[$yy]="$1";
|
|
|
dc8c34 |
$yy++;
|
|
|
dc8c34 |
@@ -936,7 +903,7 @@ if ($usage =~ /e/i || $verb eq "yes"){
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($i = 0; $i <= $#errtext; $i++){
|
|
|
dc8c34 |
+ for (my $i = 0; $i <= $#errtext; $i++){
|
|
|
dc8c34 |
$errtext[$i] =~ s/\n//g;
|
|
|
dc8c34 |
print "\n" . $errtext[$i];
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -953,51 +920,44 @@ if ($verb eq "yes" || $usage =~ /f/ ){
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Failed Logins ------\n\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($ds6x eq "true"){
|
|
|
dc8c34 |
- %ds6xbadpwd = getCounterHashFromFile($DS6XBADPWD);
|
|
|
dc8c34 |
- $ds6loop = 0;
|
|
|
dc8c34 |
- foreach $ds6bp (sort { $ds6xbadpwd{$b} <=> $ds6xbadpwd{$a} } keys %ds6xbadpwd) {
|
|
|
dc8c34 |
- if ($eloop > $sizeCount){ last; }
|
|
|
dc8c34 |
- printf "%-4s %-40s\n", $ds6xbadpwd{$ds6bp}, $ds6bp;
|
|
|
dc8c34 |
+ my $ds6xbadpwd = $hashes->{ds6xbadpwd};
|
|
|
dc8c34 |
+ my $ds6loop = 0;
|
|
|
dc8c34 |
+ foreach my $ds6bp (sort { $ds6xbadpwd->{$b} <=> $ds6xbadpwd->{$a} } keys %{$ds6xbadpwd}) {
|
|
|
dc8c34 |
+ if ($ds6loop > $sizeCount){ last; }
|
|
|
dc8c34 |
+ printf "%-4s %-40s\n", $ds6xbadpwd->{$ds6bp}, $ds6bp;
|
|
|
dc8c34 |
$ds6loop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %ds6xbadpwd;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- getInfoArraysFromFile($BINDINFO);
|
|
|
dc8c34 |
- @bindVal = @fileArray1;
|
|
|
dc8c34 |
- @bindConn = @fileArray2;
|
|
|
dc8c34 |
- @bindOp = @fileArray3;
|
|
|
dc8c34 |
- @badPasswordConn = getArrayFromFile($BADPWDCONN);
|
|
|
dc8c34 |
- @badPasswordOp = getArrayFromFile($BADPWDOP);
|
|
|
dc8c34 |
- @badPasswordIp = getArrayFromFile($BADPWDIP);
|
|
|
dc8c34 |
- for ($ii =0 ; $ii < $badPwdCount; $ii++){
|
|
|
dc8c34 |
- for ($i = 0; $i < $bindCount; $i++){
|
|
|
dc8c34 |
- if ($badPasswordConn[$ii] eq $bindConn[$i] && $badPasswordOp[$ii] eq $bindOp[$i] ){
|
|
|
dc8c34 |
- $badPassword{ "$bindVal[$i]" } = $badPassword{ "$bindVal[$i]" } + 1;
|
|
|
dc8c34 |
+ my $bindVal = $arrays->{binddn};
|
|
|
dc8c34 |
+ my $bindConn = $arrays->{bindconn};
|
|
|
dc8c34 |
+ my $bindOp = $arrays->{bindop};
|
|
|
dc8c34 |
+ my $badPasswordConn = $arrays->{badpwdconn};
|
|
|
dc8c34 |
+ my $badPasswordOp = $arrays->{badpwdop};
|
|
|
dc8c34 |
+ my $badPasswordIp = $arrays->{badpwdip};
|
|
|
dc8c34 |
+ my %badPassword = ();
|
|
|
dc8c34 |
+ for (my $ii =0 ; $ii < $badPwdCount; $ii++){
|
|
|
dc8c34 |
+ for (my $i = 0; $i < $bindCount; $i++){
|
|
|
dc8c34 |
+ if ($badPasswordConn->[$ii] eq $bindConn->[$i] && $badPasswordOp->[$ii] eq $bindOp->[$i] ){
|
|
|
dc8c34 |
+ $badPassword{ $bindVal->[$i] }++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
# sort the new hash of $badPassword{}
|
|
|
dc8c34 |
- $bpTotal = 0;
|
|
|
dc8c34 |
- $bpCount = 0;
|
|
|
dc8c34 |
- foreach $badpw (sort {$badPassword{$b} <=> $badPassword{$a} } keys %badPassword){
|
|
|
dc8c34 |
+ my $bpTotal = 0;
|
|
|
dc8c34 |
+ my $bpCount = 0;
|
|
|
dc8c34 |
+ foreach my $badpw (sort {$badPassword{$b} <=> $badPassword{$a} } keys %badPassword){
|
|
|
dc8c34 |
if ($bpCount > $sizeCount){ last;}
|
|
|
dc8c34 |
$bpCount++;
|
|
|
dc8c34 |
$bpTotal = $bpTotal + $badPassword{"$badpw"};
|
|
|
dc8c34 |
printf "%-4s %-40s\n", $badPassword{"$badpw"}, $badpw;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\nFrom the IP address(s) :\n\n";
|
|
|
dc8c34 |
- for ($i=0; $i<$badPwdCount; $i++) {
|
|
|
dc8c34 |
- print "\t\t$badPasswordIp[$i]\n";
|
|
|
dc8c34 |
+ for (my $i=0; $i<$badPwdCount; $i++) {
|
|
|
dc8c34 |
+ print "\t\t$badPasswordIp->[$i]\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($bpTotal > $badPwdCount){
|
|
|
dc8c34 |
print "\n** Warning : Wrongly reported failed login attempts : ". ($bpTotal - $badPwdCount) . "\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef @bindVal;
|
|
|
dc8c34 |
- undef @bindConn;
|
|
|
dc8c34 |
- undef @bindOp;
|
|
|
dc8c34 |
- undef @badPasswordConn;
|
|
|
dc8c34 |
- undef @badPasswordOp;
|
|
|
dc8c34 |
- undef @badPasswordIp;
|
|
|
dc8c34 |
} # this ends the if $ds6x = true
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1012,15 +972,14 @@ if ($verb eq "yes" || $usage =~ /f/ ){
|
|
|
dc8c34 |
if ($connCodeCount > 0){
|
|
|
dc8c34 |
if ($usage =~ /c/i || $verb eq "yes"){
|
|
|
dc8c34 |
print "\n\n----- Total Connection Codes -----\n\n";
|
|
|
dc8c34 |
- %conncount = &getCounterHashFromFile($CONNCOUNT);
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- foreach $key (sort { $conncount{$b} <=> $conncount{$a} } keys %conncount) {
|
|
|
dc8c34 |
- if ($conncount{$key} > 0){
|
|
|
dc8c34 |
- push @conntext, sprintf "%-4s %6s %-40s\n",$key,$conncount{$key},$connmsg{ $key };
|
|
|
dc8c34 |
+ my $conncount = $hashes->{conncount};
|
|
|
dc8c34 |
+ my @conntext;
|
|
|
dc8c34 |
+ foreach my $key (sort { $conncount->{$b} <=> $conncount->{$a} } keys %{$conncount}) {
|
|
|
dc8c34 |
+ if ($conncount->{$key} > 0){
|
|
|
dc8c34 |
+ push @conntext, sprintf "%-4s %6s %-40s\n",$key,$conncount->{$key},$connmsg{ $key };
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print @conntext;
|
|
|
dc8c34 |
- undef %conncount;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -1031,35 +990,36 @@ if ($connCodeCount > 0){
|
|
|
dc8c34 |
########################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /i/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %ip_hash = getTwoDimHashFromFile($IP_HASH);
|
|
|
dc8c34 |
- %exCount = getCounterHashFromFile($EXCOUNT);
|
|
|
dc8c34 |
- @ipkeys = keys %ip_hash;
|
|
|
dc8c34 |
- @exxCount = keys %exCount;
|
|
|
dc8c34 |
- $ip_count = ($#ipkeys + 1)-($#exxCount + 1);
|
|
|
dc8c34 |
+ my $ip_hash = $hashes->{ip_hash};
|
|
|
dc8c34 |
+ my $exCount = $hashes->{excount};
|
|
|
dc8c34 |
+ my @ipkeys = keys %{$ip_hash};
|
|
|
dc8c34 |
+ my @exxCount = keys %${exCount};
|
|
|
dc8c34 |
+ my $ip_count = ($#ipkeys + 1)-($#exxCount + 1);
|
|
|
dc8c34 |
+ my $ccount = 0;
|
|
|
dc8c34 |
if ($ip_count > 0){
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Clients -----\n\n";
|
|
|
dc8c34 |
print "Number of Clients: $ip_count\n\n";
|
|
|
dc8c34 |
- foreach $key (sort { $ip_hash{$b}{"count"} <=> $ip_hash{$a}{"count"} } keys %ip_hash) {
|
|
|
dc8c34 |
- $exc = "no";
|
|
|
dc8c34 |
+ foreach my $key (sort { $ip_hash->{$b} <=> $ip_hash->{$a} } @ipkeys) {
|
|
|
dc8c34 |
+ my $exc = "no";
|
|
|
dc8c34 |
if ($ccount > $sizeCount){ last;}
|
|
|
dc8c34 |
$ccount++;
|
|
|
dc8c34 |
- for ($xxx =0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx =0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($excludeIP[$xxx] eq $key){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- if ($ip_hash{ $key }{"count"} eq ""){$ip_hash{ $key }{"count"} = "?";}
|
|
|
dc8c34 |
+ if ($ip_hash->{ $key } eq ""){$ip_hash->{ $key } = "?";}
|
|
|
dc8c34 |
printf "[%s] Client: %s\n",$ccount, $key;
|
|
|
dc8c34 |
- printf "%10s - Connections\n", $ip_hash{ $key }{"count"};
|
|
|
dc8c34 |
- foreach $code (sort { $ip_hash{ $key }{$b} <=> $ip_hash{ $key }{$a} } keys %{$ip_hash{ $key }}) {
|
|
|
dc8c34 |
+ printf "%10s - Connections\n", $ip_hash->{ $key };
|
|
|
dc8c34 |
+ my %counts;
|
|
|
dc8c34 |
+ map { $counts{$_} = $hashes->{$_}->{$key} if (defined($hashes->{$_}->{$key})) } @conncodes;
|
|
|
dc8c34 |
+ foreach my $code (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
|
|
|
dc8c34 |
if ($code eq 'count' ) { next; }
|
|
|
dc8c34 |
- printf "%10s - %s (%s)\n", $ip_hash{ $key }{ $code }, $code, $connmsg{ $code };
|
|
|
dc8c34 |
+ printf "%10s - %s (%s)\n", $counts{ $code }, $code, $connmsg{ $code };
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %exCount;
|
|
|
dc8c34 |
- undef %ip_hash;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
###################################
|
|
|
dc8c34 |
@@ -1069,21 +1029,22 @@ if ($usage =~ /i/i || $verb eq "yes"){
|
|
|
dc8c34 |
###################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /b/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %bindlist = getCounterHashFromFile($BINDLIST);
|
|
|
dc8c34 |
- @bindkeys = keys %bindlist;
|
|
|
dc8c34 |
- $bind_count = $#bindkeys + 1;
|
|
|
dc8c34 |
+ my $bindlist = $hashes->{bindlist};
|
|
|
dc8c34 |
+ my @bindkeys = keys %{$bindlist};
|
|
|
dc8c34 |
+ my $bind_count = $#bindkeys + 1;
|
|
|
dc8c34 |
if ($bind_count > 0){
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Bind DN's -----\n\n";
|
|
|
dc8c34 |
print "Number of Unique Bind DN's: $bind_count\n\n";
|
|
|
dc8c34 |
- $bindcount = 0;
|
|
|
dc8c34 |
- foreach $dn (sort { $bindlist{$b} <=> $bindlist{$a} } keys %bindlist) {
|
|
|
dc8c34 |
- if ($bindcount < $sizeCount){
|
|
|
dc8c34 |
- printf "%-8s %-40s\n", $bindlist{ $dn },$dn;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ my $bindcount = 0;
|
|
|
dc8c34 |
+ foreach my $dn (sort { $bindlist->{$b} <=> $bindlist->{$a} } @bindkeys) {
|
|
|
dc8c34 |
+ if ($bindcount < $sizeCount){
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $bindlist->{ $dn },$dn;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
$bindcount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %bindlist;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
@@ -1093,21 +1054,22 @@ if ($usage =~ /b/i || $verb eq "yes"){
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /a/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %base = getCounterHashFromFile($BASE);
|
|
|
dc8c34 |
- @basekeys = keys %base;
|
|
|
dc8c34 |
- $base_count = $#basekeys + 1;
|
|
|
dc8c34 |
+ my $base = $hashes->{base};
|
|
|
dc8c34 |
+ my @basekeys = keys %{$base};
|
|
|
dc8c34 |
+ my $base_count = $#basekeys + 1;
|
|
|
dc8c34 |
if ($base_count > 0){
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Search Bases -----\n\n";
|
|
|
dc8c34 |
print "Number of Unique Search Bases: $base_count\n\n";
|
|
|
dc8c34 |
- $basecount = 0;
|
|
|
dc8c34 |
- foreach $bas (sort { $base{$b} <=> $base{$a} } keys %base) {
|
|
|
dc8c34 |
+ my $basecount = 0;
|
|
|
dc8c34 |
+ foreach my $bas (sort { $base->{$b} <=> $base->{$a} } @basekeys) {
|
|
|
dc8c34 |
if ($basecount < $sizeCount){
|
|
|
dc8c34 |
- printf "%-8s %-40s\n", $base{ $bas },$bas;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $base->{ $bas },$bas;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
$basecount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %base;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
@@ -1117,21 +1079,22 @@ if ($usage =~ /a/i || $verb eq "yes"){
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /l/ || $verb eq "yes"){
|
|
|
dc8c34 |
- %filter = getCounterHashFromFile($FILTER);
|
|
|
dc8c34 |
- @filterkeys = keys %filter;
|
|
|
dc8c34 |
- $filter_count = $#filterkeys + 1;
|
|
|
dc8c34 |
+ my $filter = $hashes->{filter};
|
|
|
dc8c34 |
+ my @filterkeys = keys %{$filter};
|
|
|
dc8c34 |
+ my $filter_count = $#filterkeys + 1;
|
|
|
dc8c34 |
if ($filter_count > 0){
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Search Filters -----\n";
|
|
|
dc8c34 |
print "\nNumber of Unique Search Filters: $filter_count\n\n";
|
|
|
dc8c34 |
- $filtercount = 0;
|
|
|
dc8c34 |
- foreach $filt (sort { $filter{$b} <=> $filter{$a} } keys %filter){
|
|
|
dc8c34 |
+ my $filtercount = 0;
|
|
|
dc8c34 |
+ foreach my $filt (sort { $filter->{$b} <=> $filter->{$a} } @filterkeys){
|
|
|
dc8c34 |
if ($filtercount < $sizeCount){
|
|
|
dc8c34 |
- printf "%-8s %-40s\n", $filter{$filt}, $filt;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $filter->{$filt}, $filt;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
$filtercount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %filter;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
@@ -1140,20 +1103,23 @@ if ($usage =~ /l/ || $verb eq "yes"){
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
#########################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my $first;
|
|
|
dc8c34 |
if ($usage =~ /t/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %etime = getCounterHashFromFile($ETIME);
|
|
|
dc8c34 |
+ my $etime = $hashes->{etime};
|
|
|
dc8c34 |
+ my @ekeys = keys %{$etime};
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# print most often etimes
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Most Frequent etimes -----\n\n";
|
|
|
dc8c34 |
- $eloop = 0;
|
|
|
dc8c34 |
- foreach $et (sort { $etime{$b} <=> $etime{$a} } keys %etime) {
|
|
|
dc8c34 |
+ my $eloop = 0;
|
|
|
dc8c34 |
+ my $retime = 0;
|
|
|
dc8c34 |
+ foreach my $et (sort { $etime->{$b} <=> $etime->{$a} } @ekeys) {
|
|
|
dc8c34 |
if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
if ($retime ne "2"){
|
|
|
dc8c34 |
$first = $et;
|
|
|
dc8c34 |
$retime = "2";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- printf "%-8s %-12s\n", $etime{ $et }, "etime=$et";
|
|
|
dc8c34 |
+ printf "%-8s %-12s\n", $etime->{ $et }, "etime=$et";
|
|
|
dc8c34 |
$eloop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
@@ -1161,12 +1127,11 @@ if ($usage =~ /t/i || $verb eq "yes"){
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Longest etimes -----\n\n";
|
|
|
dc8c34 |
$eloop = 0;
|
|
|
dc8c34 |
- foreach $et (sort { $b <=> $a } (keys %etime)) {
|
|
|
dc8c34 |
+ foreach my $et (sort { $b <=> $a } @ekeys) {
|
|
|
dc8c34 |
if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
- printf "%-12s %-10s\n","etime=$et",$etime{ $et };
|
|
|
dc8c34 |
+ printf "%-12s %-10s\n","etime=$et",$etime->{ $et };
|
|
|
dc8c34 |
$eloop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %etime;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#######################################
|
|
|
dc8c34 |
@@ -1177,23 +1142,23 @@ if ($usage =~ /t/i || $verb eq "yes"){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /n/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %nentries = getCounterHashFromFile($NENTRIES);
|
|
|
dc8c34 |
+ my $nentries = $hashes->{nentries};
|
|
|
dc8c34 |
+ my @nkeys = keys %{$nentries};
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Largest nentries -----\n\n";
|
|
|
dc8c34 |
- $eloop = 0;
|
|
|
dc8c34 |
- foreach $nentry (sort { $b <=> $a } (keys %nentries)){
|
|
|
dc8c34 |
+ my $eloop = 0;
|
|
|
dc8c34 |
+ foreach my $nentry (sort { $b <=> $a } @nkeys){
|
|
|
dc8c34 |
if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
- printf "%-18s %12s\n","nentries=$nentry", $nentries{ $nentry };
|
|
|
dc8c34 |
+ printf "%-18s %12s\n","nentries=$nentry", $nentries->{ $nentry };
|
|
|
dc8c34 |
$eloop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Most returned nentries -----\n\n";
|
|
|
dc8c34 |
$eloop = 0;
|
|
|
dc8c34 |
- foreach $nentry (sort { $nentries{$b} <=> $nentries{$a} } (keys %nentries)){
|
|
|
dc8c34 |
+ foreach my $nentry (sort { $nentries->{$b} <=> $nentries->{$a} } @nkeys){
|
|
|
dc8c34 |
if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
- printf "%-12s %-14s\n", $nentries{ $nentry }, "nentries=$nentry";
|
|
|
dc8c34 |
+ printf "%-12s %-14s\n", $nentries->{ $nentry }, "nentries=$nentry";
|
|
|
dc8c34 |
$eloop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n";
|
|
|
dc8c34 |
- undef %nentries;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
##########################################
|
|
|
dc8c34 |
@@ -1204,9 +1169,10 @@ if ($usage =~ /n/i || $verb eq "yes"){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /x/i || $verb eq "yes"){
|
|
|
dc8c34 |
if ($extopCount > 0){
|
|
|
dc8c34 |
- %oid = getCounterHashFromFile($OID);
|
|
|
dc8c34 |
+ my $oid = $hashes->{oid};
|
|
|
dc8c34 |
print "\n\n----- Extended Operations -----\n\n";
|
|
|
dc8c34 |
- foreach $oids (sort { $oid{$b} <=> $oid{$a} } (keys %oid) ){
|
|
|
dc8c34 |
+ foreach my $oids (sort { $oid->{$b} <=> $oid->{$a} } (keys %{$oid}) ){
|
|
|
dc8c34 |
+ my $oidmessage;
|
|
|
dc8c34 |
if ($oids eq "2.16.840.1.113730.3.5.1"){ $oidmessage = "Transaction Request"} #depreciated?
|
|
|
dc8c34 |
elsif ($oids eq "2.16.840.1.113730.3.5.2"){ $oidmessage = "Transaction Response"} #depreciated?
|
|
|
dc8c34 |
elsif ($oids eq "2.16.840.1.113730.3.5.3"){ $oidmessage = "Start Replication Request (incremental update)"}
|
|
|
dc8c34 |
@@ -1236,9 +1202,8 @@ if ($usage =~ /x/i || $verb eq "yes"){
|
|
|
dc8c34 |
elsif ($oids eq "1.3.6.1.4.1.4203.1.11.1"){ $oidmessage = "Password Modify"}
|
|
|
dc8c34 |
elsif ($oids eq "2.16.840.1.113730.3.4.20"){ $oidmessage = "MTN Control Use One Backend"}
|
|
|
dc8c34 |
else {$oidmessage = "Other"}
|
|
|
dc8c34 |
- printf "%-6s %-23s %-60s\n", $oid{ $oids }, $oids, $oidmessage;
|
|
|
dc8c34 |
+ printf "%-6s %-23s %-60s\n", $oid->{ $oids }, $oids, $oidmessage;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %oid;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -1250,15 +1215,14 @@ if ($usage =~ /x/i || $verb eq "yes"){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /r/i || $verb eq "yes"){
|
|
|
dc8c34 |
if ($anyAttrs > 0){
|
|
|
dc8c34 |
- %attr = getCounterHashFromFile($ATTR);
|
|
|
dc8c34 |
+ my $attr = $hashes->{attr};
|
|
|
dc8c34 |
print "\n\n----- Top $sizeCount Most Requested Attributes -----\n\n";
|
|
|
dc8c34 |
- $eloop = 0;
|
|
|
dc8c34 |
- foreach $mostAttr (sort { $attr{$b} <=> $attr{$a} } (keys %attr) ){
|
|
|
dc8c34 |
+ my $eloop = 0;
|
|
|
dc8c34 |
+ foreach my $mostAttr (sort { $attr->{$b} <=> $attr->{$a} } (keys %{$attr}) ){
|
|
|
dc8c34 |
if ($eloop eq $sizeCount){ last; }
|
|
|
dc8c34 |
- printf "%-10s %-19s\n", $attr{$mostAttr}, $mostAttr;
|
|
|
dc8c34 |
+ printf "%-10s %-19s\n", $attr->{$mostAttr}, $mostAttr;
|
|
|
dc8c34 |
$eloop++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- undef %attr;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -1269,77 +1233,59 @@ if ($usage =~ /r/i || $verb eq "yes"){
|
|
|
dc8c34 |
#############################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /g/i || $verb eq "yes"){
|
|
|
dc8c34 |
- $abandonTotal = $srchCount + $delCount + $modCount + $addCount + $modrdnCount + $bindCount + $extopCount + $cmpCount;
|
|
|
dc8c34 |
+ my $abandonTotal = $srchCount + $delCount + $modCount + $addCount + $modrdnCount + $bindCount + $extopCount + $cmpCount;
|
|
|
dc8c34 |
if ($verb eq "yes" && $abandonCount > 0 && $abandonTotal > 0){
|
|
|
dc8c34 |
- %conn_hash = getHashFromFile($CONN_HASH);
|
|
|
dc8c34 |
- @srchConn = getArrayFromFile($SRCH_CONN);
|
|
|
dc8c34 |
- @srchOp = getArrayFromFile($SRCH_OP);
|
|
|
dc8c34 |
- @delConn = getArrayFromFile($DEL_CONN);
|
|
|
dc8c34 |
- @delOp = getArrayFromFile($DEL_OP);
|
|
|
dc8c34 |
- @targetConn = getArrayFromFile($TARGET_CONN);
|
|
|
dc8c34 |
- @targetOp = getArrayFromFile($TARGET_OP);
|
|
|
dc8c34 |
- @msgid = getArrayFromFile($MSGID);
|
|
|
dc8c34 |
- @addConn = getArrayFromFile($ADD_CONN);
|
|
|
dc8c34 |
- @addOp = getArrayFromFile($ADD_OP);
|
|
|
dc8c34 |
- @modConn = getArrayFromFile($MOD_CONN);
|
|
|
dc8c34 |
- @modOp = getArrayFromFile($MOD_OP);
|
|
|
dc8c34 |
- @cmpConn = getArrayFromFile($CMP_CONN);
|
|
|
dc8c34 |
- @cmpOp = getArrayFromFile($CMP_OP);
|
|
|
dc8c34 |
- @modrdnConn = getArrayFromFile($MODRDN_CONN);
|
|
|
dc8c34 |
- @modrdnOp = getArrayFromFile($MODRDN_OP);
|
|
|
dc8c34 |
- @bindConn = getArrayFromFile($BIND_CONN);
|
|
|
dc8c34 |
- @bindOp = getArrayFromFile($BIND_OP);
|
|
|
dc8c34 |
- @unbindConn = getArrayFromFile($UNBIND_CONN);
|
|
|
dc8c34 |
- @unbindOp = getArrayFromFile($UNBIND_OP);
|
|
|
dc8c34 |
- @extConn = getArrayFromFile($EXT_CONN);
|
|
|
dc8c34 |
- @extOp = getArrayFromFile($EXT_OP);
|
|
|
dc8c34 |
+ my $conn_hash = $hashes->{conn_hash};
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print "\n\n----- Abandon Request Stats -----\n\n";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ($g = 0; $g < $abandonCount; $g++){
|
|
|
dc8c34 |
- for ($sc = 0; $sc < $srchCount; $sc++){
|
|
|
dc8c34 |
- if ($srchConn[$sc] eq $targetConn[$g] && $srchOp[$sc] eq $targetOp[$g] ){
|
|
|
dc8c34 |
- print " - SRCH conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $g = 0; $g < $abandonCount; $g++){
|
|
|
dc8c34 |
+ my $conn = $arrays->{targetconn}->[$g];
|
|
|
dc8c34 |
+ my $op = $arrays->{targetop}->[$g];
|
|
|
dc8c34 |
+ my $msgid = $arrays->{msgid}->[$g];
|
|
|
dc8c34 |
+ for (my $sc = 0; $sc < $srchCount; $sc++){
|
|
|
dc8c34 |
+ if ($arrays->{srchconn}->[$sc] eq $conn && $arrays->{srchop}->[$sc] eq $op ){
|
|
|
dc8c34 |
+ print " - SRCH conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($dc = 0; $dc < $delCount; $dc++){
|
|
|
dc8c34 |
- if ($delConn[$dc] eq $targetConn[$g] && $delOp[$dc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - DEL conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $dc = 0; $dc < $delCount; $dc++){
|
|
|
dc8c34 |
+ if ($arrays->{delconn}->[$dc] eq $conn && $arrays->{delop}->[$dc] eq $op){
|
|
|
dc8c34 |
+ print " - DEL conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($adc = 0; $adc < $addCount; $adc++){
|
|
|
dc8c34 |
- if ($addConn[$adc] eq $targetConn[$g] && $addOp[$adc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - ADD conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $adc = 0; $adc < $addCount; $adc++){
|
|
|
dc8c34 |
+ if ($arrays->{addconn}->[$adc] eq $conn && $arrays->{addop}->[$adc] eq $op){
|
|
|
dc8c34 |
+ print " - ADD conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($mc = 0; $mc < $modCount; $mc++){
|
|
|
dc8c34 |
- if ($modConn[$mc] eq $targetConn[$g] && $modOp[$mc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - MOD conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $mc = 0; $mc < $modCount; $mc++){
|
|
|
dc8c34 |
+ if ($arrays->{modconn}->[$mc] eq $conn && $arrays->{modop}->[$mc] eq $op){
|
|
|
dc8c34 |
+ print " - MOD conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($cc = 0; $cc < $cmpCount; $cc++){
|
|
|
dc8c34 |
- if ($cmpConn[$mdc] eq $targetConn[$g] && $cmpOp[$mdc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - CMP conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $cc = 0; $cc < $cmpCount; $cc++){
|
|
|
dc8c34 |
+ if ($arrays->{cmpconn}->[$cc] eq $conn && $arrays->{cmpop}->[$cc] eq $op){
|
|
|
dc8c34 |
+ print " - CMP conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($mdc = 0; $mdc < $modrdnCount; $mdc++){
|
|
|
dc8c34 |
- if ($modrdnConn[$mdc] eq $targetConn[$g] && $modrdnOp[$mdc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - MODRDN conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $mdc = 0; $mdc < $modrdnCount; $mdc++){
|
|
|
dc8c34 |
+ if ($arrays->{modrdnconn}->[$mdc] eq $conn && $arrays->{modrdnop}->[$mdc] eq $op){
|
|
|
dc8c34 |
+ print " - MODRDN conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($bcb = 0; $bcb < $bindCount; $bcb++){
|
|
|
dc8c34 |
- if ($bindConn[$bcb] eq $targetConn[$g] && $bindOp[$bcb] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - BIND conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $bcb = 0; $bcb < $bindCount; $bcb++){
|
|
|
dc8c34 |
+ if ($arrays->{bindconn}->[$bcb] eq $conn && $arrays->{bindop}->[$bcb] eq $op){
|
|
|
dc8c34 |
+ print " - BIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($ubc = 0; $ubc < $unbindCount; $ubc++){
|
|
|
dc8c34 |
- if ($unbindConn[$ubc] eq $targetConn[$g] && $unbindOp[$ubc] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - UNBIND conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $ubc = 0; $ubc < $unbindCount; $ubc++){
|
|
|
dc8c34 |
+ if ($arrays->{unbindconn}->[$ubc] eq $conn && $arrays->{unbindop}->[$ubc] eq $op){
|
|
|
dc8c34 |
+ print " - UNBIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($ec = 0; $ec < $extopCount; $ec++){
|
|
|
dc8c34 |
- if ($extConn[$ec] eq $targetConn[$g] && $extOp[$ec] eq $targetOp[$g]){
|
|
|
dc8c34 |
- print " - EXT conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ for (my $ec = 0; $ec < $extopCount; $ec++){
|
|
|
dc8c34 |
+ if ($arrays->{extconn}->[$ec] eq $conn && $arrays->{extop}->[$ec] eq $op){
|
|
|
dc8c34 |
+ print " - EXT conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1354,9 +1300,9 @@ print "\n";
|
|
|
dc8c34 |
#######################################
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($usage =~ /j/i || $verb eq "yes"){
|
|
|
dc8c34 |
- %conncount = getCounterHashFromFile($CONNCOUNT);
|
|
|
dc8c34 |
+ my $conncount = $hashes->{conncount};
|
|
|
dc8c34 |
print "\n----- Recommendations -----\n";
|
|
|
dc8c34 |
- $recCount = "1";
|
|
|
dc8c34 |
+ my $recCount = "1";
|
|
|
dc8c34 |
if ($unindexedSrchCountNotesA > 0){
|
|
|
dc8c34 |
print "\n $recCount. You have unindexed searches, this can be caused from a search on an unindexed attribute, or your returned results exceeded the allidsthreshold. Unindexed searches are not recommended. To refuse unindexed searches, switch \'nsslapd-require-index\' to \'on\' under your database entry (e.g. cn=UserRoot,cn=ldbm database,cn=plugins,cn=config).\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
@@ -1365,11 +1311,11 @@ if ($usage =~ /j/i || $verb eq "yes"){
|
|
|
dc8c34 |
print "\n $recCount. You have unindexed components, this can be caused from a search on an unindexed attribute, or your returned results exceeded the allidsthreshold. Unindexed components are not recommended. To refuse unindexed searches, switch \'nsslapd-require-index\' to \'on\' under your database entry (e.g. cn=UserRoot,cn=ldbm database,cn=plugins,cn=config).\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($conncount{"T1"} > 0){
|
|
|
dc8c34 |
+ if (defined($conncount->{"T1"}) and $conncount->{"T1"} > 0){
|
|
|
dc8c34 |
print "\n $recCount. You have some connections that are are being closed by the idletimeout setting. You may want to increase the idletimeout if it is set low.\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($conncount{"T2"} > 0){
|
|
|
dc8c34 |
+ if (defined($conncount->{"T2"}) and $conncount->{"T2"} > 0){
|
|
|
dc8c34 |
print "\n $recCount. You have some coonections that are being closed by the ioblocktimeout setting. You may want to increase the ioblocktimeout.\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1391,7 +1337,7 @@ if ($usage =~ /j/i || $verb eq "yes"){
|
|
|
dc8c34 |
print "\n $recCount. You have more unsuccessful operations than successful operations. You should investigate this difference.\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($conncount{"U1"} < ($connCodeCount - $conncount{"U1"})){
|
|
|
dc8c34 |
+ if (defined($conncount->{"U1"}) and $conncount->{"U1"} < ($connCodeCount - $conncount->{"U1"})){
|
|
|
dc8c34 |
print "\n $recCount. You have more abnormal connection codes than cleanly closed connections. You may want to investigate this difference.\n";
|
|
|
dc8c34 |
$recCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1407,7 +1353,6 @@ if ($usage =~ /j/i || $verb eq "yes"){
|
|
|
dc8c34 |
print "\nNone.\n";
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
print "\n";
|
|
|
dc8c34 |
- undef %conncount;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
@@ -1499,11 +1444,9 @@ parseLineBind {
|
|
|
dc8c34 |
$linesProcessed++;
|
|
|
dc8c34 |
$lineBlockCount++;
|
|
|
dc8c34 |
local $_ = $logline;
|
|
|
dc8c34 |
+ my $ip;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if ($lineBlockCount >= $limit){
|
|
|
dc8c34 |
- print STDERR sprintf" %10s Lines Processed\n",$linesProcessed;
|
|
|
dc8c34 |
- $lineBlockCount="0";
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ statusreport();
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# skip blank lines
|
|
|
dc8c34 |
return if $_ =~ /^\s/;
|
|
|
dc8c34 |
@@ -1531,7 +1474,8 @@ parseLineBind {
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ) {
|
|
|
dc8c34 |
- for ($excl =0; $excl <= $#excludeIP; $excl++){
|
|
|
dc8c34 |
+ my $skip = "yes";
|
|
|
dc8c34 |
+ for (my $excl =0; $excl < $#excludeIP; $excl++){
|
|
|
dc8c34 |
if ($excludeIP[$excl] eq $1){
|
|
|
dc8c34 |
$skip = "yes";
|
|
|
dc8c34 |
last;
|
|
|
dc8c34 |
@@ -1547,6 +1491,7 @@ parseLineBind {
|
|
|
dc8c34 |
return;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
|
|
|
dc8c34 |
+ my $dn;
|
|
|
dc8c34 |
if ($1 eq ""){
|
|
|
dc8c34 |
$dn = "Anonymous";
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
@@ -1599,30 +1544,36 @@ parseLineBind {
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
processOpForBindReport
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $op = @_[0];
|
|
|
dc8c34 |
- $data = @_[1];
|
|
|
dc8c34 |
+ my $op = shift;
|
|
|
dc8c34 |
+ my $data = shift;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ($data =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
- foreach $dn (keys %bindReport){
|
|
|
dc8c34 |
+ foreach my $dn (keys %bindReport){
|
|
|
dc8c34 |
if ($bindReport{$dn}{"conn"} =~ / $1 /){
|
|
|
dc8c34 |
- $bindDN = $dn;
|
|
|
dc8c34 |
- $bindReport{$bindDN}{$op}++;
|
|
|
dc8c34 |
+ $bindReport{$dn}{$op}++;
|
|
|
dc8c34 |
return;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
+my ($last_tm, $lastzone, $last_min, $gmtime, $tzoff);
|
|
|
dc8c34 |
sub parseLineNormal
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
local $_ = $logline;
|
|
|
dc8c34 |
+ my $ip;
|
|
|
dc8c34 |
+ my $tmpp;
|
|
|
dc8c34 |
+ my $exc = "no";
|
|
|
dc8c34 |
+ my $connID;
|
|
|
dc8c34 |
+ my $con;
|
|
|
dc8c34 |
+ my $op;
|
|
|
dc8c34 |
+ $linesProcessed++;
|
|
|
dc8c34 |
+ $lineBlockCount++;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# lines starting blank are restart
|
|
|
dc8c34 |
return if $_ =~ /^\s/;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- $linesProcessed++;
|
|
|
dc8c34 |
- $lineBlockCount++;
|
|
|
dc8c34 |
- if ($lineBlockCount >= $limit){ print STDERR sprintf" %10s Lines Processed\n",$linesProcessed; $lineBlockCount="0";}
|
|
|
dc8c34 |
+ statusreport();
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# gather/process the timestamp
|
|
|
dc8c34 |
if($firstFile == 1 && $_ =~ /^\[/){
|
|
|
dc8c34 |
@@ -1648,30 +1599,30 @@ sub parseLineNormal
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
# Additional performance stats
|
|
|
dc8c34 |
- ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
- if ($reportStats && $time ne $last_tm)
|
|
|
dc8c34 |
+ my ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
+ if (($reportStats or ($verb eq "yes") || ($usage =~ /y/)) && (!defined($last_tm) or ($time ne $last_tm)))
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
$last_tm = $time;
|
|
|
dc8c34 |
$time =~ s/\[//;
|
|
|
dc8c34 |
$tzone =~ s/\].*//;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if($tzone ne $lastzone)
|
|
|
dc8c34 |
+ if(!defined($lastzone) or $tzone ne $lastzone)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
# tz offset change
|
|
|
dc8c34 |
$lastzone=$tzone;
|
|
|
dc8c34 |
- ($sign,$hr,$min) = $tzone =~ m/(.)(\d\d)(\d\d)/;
|
|
|
dc8c34 |
+ my ($sign,$hr,$min) = $tzone =~ m/(.)(\d\d)(\d\d)/;
|
|
|
dc8c34 |
$tzoff = $hr*3600 + $min*60;
|
|
|
dc8c34 |
$tzoff *= -1
|
|
|
dc8c34 |
if $sign eq '-';
|
|
|
dc8c34 |
# to be subtracted from converted values.
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
- ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
- $newmin = timegm(0, $min, $hr, $day, $monthname{$mon}, $yr) - $tzoff;
|
|
|
dc8c34 |
+ my ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
+ my ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
+ my $newmin = timegm(0, $min, $hr, $day, $monthname{$mon}, $yr) - $tzoff;
|
|
|
dc8c34 |
$gmtime = $newmin + $sec;
|
|
|
dc8c34 |
print_stats_block( $s_stats );
|
|
|
dc8c34 |
reset_stats_block( $s_stats, $gmtime, $time.' '.$tzone );
|
|
|
dc8c34 |
- if ($newmin != $last_min)
|
|
|
dc8c34 |
+ if (!defined($last_min) or $newmin != $last_min)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
print_stats_block( $m_stats );
|
|
|
dc8c34 |
$time =~ s/\d\d$/00/;
|
|
|
dc8c34 |
@@ -1689,58 +1640,57 @@ sub parseLineNormal
|
|
|
dc8c34 |
if($reportStats){ inc_stats('srch',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($_ =~ / attrs=\"(.*)\"/i){
|
|
|
dc8c34 |
$anyAttrs++;
|
|
|
dc8c34 |
- $attrs = $1 . " ";
|
|
|
dc8c34 |
- while ($attrs =~ /(\S+)\s/g){
|
|
|
dc8c34 |
- writeFile($ATTR, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ my $attr = $hashes->{attr};
|
|
|
dc8c34 |
+ map { $attr->{$_}++ } split /\s/, $1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
if (/ attrs=ALL/){
|
|
|
dc8c34 |
- writeFile($ATTR, "All Attributes");
|
|
|
dc8c34 |
+ my $attr = $hashes->{attr};
|
|
|
dc8c34 |
+ $attr->{"All Attributes"}++;
|
|
|
dc8c34 |
$anyAttrs++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($SRCH_CONN, $1);}
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($SRCH_OP, $1);}
|
|
|
dc8c34 |
+ if ($verb eq "yes"){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{srchconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{srchop}}, $1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ DEL/){
|
|
|
dc8c34 |
$delCount++;
|
|
|
dc8c34 |
if($reportStats){ inc_stats('del',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($DEL_CONN, $1);}
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($DEL_OP, $1);}
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{delconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{delop}}, $1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ MOD dn=/){
|
|
|
dc8c34 |
$modCount++;
|
|
|
dc8c34 |
if($reportStats){ inc_stats('mod',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($MOD_CONN, $1);}
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($MOD_OP, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{modconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{modop}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ ADD/){
|
|
|
dc8c34 |
$addCount++;
|
|
|
dc8c34 |
if($reportStats){ inc_stats('add',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($ADD_CONN, $1); }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($ADD_OP, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{addconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{addop}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ MODRDN/){
|
|
|
dc8c34 |
$modrdnCount++;
|
|
|
dc8c34 |
if($reportStats){ inc_stats('modrdn',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($MODRDN_CONN, $1); }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($MODRDN_OP, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{modrdnconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{modrdnop}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ CMP dn=/){
|
|
|
dc8c34 |
$cmpCount++;
|
|
|
dc8c34 |
if($reportStats){ inc_stats('cmp',$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($verb eq "yes" || $usage =~ /g/i){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($CMP_CONN, $1);}
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($CMP_OP, $1);}
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{cmpconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{cmpop}}, $1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ ABANDON /){
|
|
|
dc8c34 |
@@ -1748,9 +1698,9 @@ sub parseLineNormal
|
|
|
dc8c34 |
if($reportStats){ inc_stats('abandon',$s_stats,$m_stats); }
|
|
|
dc8c34 |
$allResults++;
|
|
|
dc8c34 |
if ($_ =~ /targetop= *([0-9a-zA-Z]+)/i ){
|
|
|
dc8c34 |
- writeFile($TARGET_OP, $1);
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($TARGET_CONN, $1); }
|
|
|
dc8c34 |
- if ($_ =~ /msgid= *([0-9]+)/i){ writeFile($MSGID, $1);}
|
|
|
dc8c34 |
+ push @{$arrays->{targetop}}, $1;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{targetconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /msgid= *([0-9]+)/i){ push @{$arrays->{msgid}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ VLV /){
|
|
|
dc8c34 |
@@ -1774,20 +1724,19 @@ sub parseLineNormal
|
|
|
dc8c34 |
if ($1 ne ""){
|
|
|
dc8c34 |
$tmpp = $1;
|
|
|
dc8c34 |
$tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
- writeFile($BINDLIST, $tmpp);
|
|
|
dc8c34 |
+ $hashes->{bindlist}->{$tmpp}++;
|
|
|
dc8c34 |
if($1 eq $rootDN){
|
|
|
dc8c34 |
$rootDNBindCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
$anonymousBindCount++;
|
|
|
dc8c34 |
- writeFile($BINDLIST, "Anonymous Binds");
|
|
|
dc8c34 |
+ $hashes->{bindlist}->{"Anonymous Binds"}++;
|
|
|
dc8c34 |
inc_stats('anonbind',$s_stats,$m_stats);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ connection from/){
|
|
|
dc8c34 |
- $exc = "no";
|
|
|
dc8c34 |
if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){
|
|
|
dc8c34 |
- for ($xxx =0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx =0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($excludeIP[$xxx] eq $1){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
@@ -1801,11 +1750,13 @@ sub parseLineNormal
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
($connID) = $_ =~ /conn=(\d*)\s/;
|
|
|
dc8c34 |
$openConnection[$connID]++;
|
|
|
dc8c34 |
- ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
- ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
- ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
- $day =~ s/\[//;
|
|
|
dc8c34 |
- $start_time_of_connection[$connID] = timegm($sec, $min, $hours, $day, $monthname{$mon}, $yr);
|
|
|
dc8c34 |
+ if ($reportStats or ($verb eq "yes") || ($usage =~ /y/)) {
|
|
|
dc8c34 |
+ my ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
+ my ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
+ my ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
+ $day =~ s/\[//;
|
|
|
dc8c34 |
+ $start_time_of_connection[$connID] = timegm($sec, $min, $hr, $day, $monthname{$mon}, $yr);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ SSL client bound as /){$sslClientBindCount++;}
|
|
|
dc8c34 |
if (m/ SSL failed to map client certificate to LDAP DN/){$sslClientFailedCount++;}
|
|
|
dc8c34 |
@@ -1816,16 +1767,22 @@ sub parseLineNormal
|
|
|
dc8c34 |
|
|
|
dc8c34 |
($connID) = $_ =~ /conn=(\d*)\s/;
|
|
|
dc8c34 |
$openConnection[$connID]--;
|
|
|
dc8c34 |
- $end_time_of_connection[$connID] = $gmtime;
|
|
|
dc8c34 |
- $diff = $end_time_of_connection[$connID] - $start_time_of_connection[$connID];
|
|
|
dc8c34 |
- $start_time_of_connection[$connID] = $end_time_of_connection[$connID] = 0;
|
|
|
dc8c34 |
- if ($diff <= 1) { $latency[0]++;}
|
|
|
dc8c34 |
- if ($diff == 2) { $latency[1]++;}
|
|
|
dc8c34 |
- if ($diff == 3) { $latency[2]++;}
|
|
|
dc8c34 |
- if ($diff >= 4 && $diff <=5 ) { $latency[3]++;}
|
|
|
dc8c34 |
- if ($diff >= 6 && $diff <=10 ) { $latency[4]++;}
|
|
|
dc8c34 |
- if ($diff >= 11 && $diff <=15 ) { $latency[5]++;}
|
|
|
dc8c34 |
- if ($diff >= 16) { $latency[6] ++;}
|
|
|
dc8c34 |
+ if ($reportStats or ($verb eq "yes") || ($usage =~ /y/)) {
|
|
|
dc8c34 |
+ # if we didn't see the start time of this connection
|
|
|
dc8c34 |
+ # i.e. due to truncation or log rotation
|
|
|
dc8c34 |
+ # then just set to 0
|
|
|
dc8c34 |
+ my $stoc = $start_time_of_connection[$connID] || 0;
|
|
|
dc8c34 |
+ $end_time_of_connection[$connID] = $gmtime || 0;
|
|
|
dc8c34 |
+ my $diff = $end_time_of_connection[$connID] - $stoc;
|
|
|
dc8c34 |
+ $start_time_of_connection[$connID] = $end_time_of_connection[$connID] = 0;
|
|
|
dc8c34 |
+ if ($diff <= 1) { $latency[0]++;}
|
|
|
dc8c34 |
+ if ($diff == 2) { $latency[1]++;}
|
|
|
dc8c34 |
+ if ($diff == 3) { $latency[2]++;}
|
|
|
dc8c34 |
+ if ($diff >= 4 && $diff <=5 ) { $latency[3]++;}
|
|
|
dc8c34 |
+ if ($diff >= 6 && $diff <=10 ) { $latency[4]++;}
|
|
|
dc8c34 |
+ if ($diff >= 11 && $diff <=15 ) { $latency[5]++;}
|
|
|
dc8c34 |
+ if ($diff >= 16) { $latency[6] ++;}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
|
|
|
dc8c34 |
if($reportStats){ inc_stats('bind',$s_stats,$m_stats); }
|
|
|
dc8c34 |
@@ -1834,25 +1791,26 @@ sub parseLineNormal
|
|
|
dc8c34 |
if($1 eq $rootDN){$rootDNBindCount++;}
|
|
|
dc8c34 |
$tmpp = $1;
|
|
|
dc8c34 |
$tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
- writeFile($BINDLIST, $tmpp);
|
|
|
dc8c34 |
- $bindVal = $tmpp;
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i) { $bindConn = $1; writeFile($BIND_CONN, $1);}
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i) { $bindOp = $1; writeFile($BIND_OP, $1);}
|
|
|
dc8c34 |
+ $hashes->{bindlist}->{$tmpp}++;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) { push @{$arrays->{bindconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) { push @{$arrays->{bindop}}, $1;}
|
|
|
dc8c34 |
if($usage =~ /f/ || $verb eq "yes"){
|
|
|
dc8c34 |
- # only need this for the failed bind report
|
|
|
dc8c34 |
- writeFile($BINDINFO, "$bindVal ,, $bindConn ,, $bindOp");
|
|
|
dc8c34 |
+ push @{$arrays->{binddn}}, $tmpp;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
$anonymousBindCount++;
|
|
|
dc8c34 |
- writeFile($BINDLIST, "Anonymous Binds");
|
|
|
dc8c34 |
+ $hashes->{bindlist}->{"Anonymous Binds"}++;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) { push @{$arrays->{bindconn}}, $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) { push @{$arrays->{bindop}}, $1;}
|
|
|
dc8c34 |
+ push @{$arrays->{binddn}}, "";
|
|
|
dc8c34 |
inc_stats('anonbind',$s_stats,$m_stats);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ UNBIND/){
|
|
|
dc8c34 |
$unbindCount++;
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($UNBIND_CONN, $1); }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($UNBIND_OP, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{unbindconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{unbindop}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ RESULT err=/ && m/ notes=P/){
|
|
|
dc8c34 |
@@ -1863,7 +1821,7 @@ sub parseLineNormal
|
|
|
dc8c34 |
$con = $1;
|
|
|
dc8c34 |
if ($_ =~ /op= *([0-9]+)/i){ $op = $1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($i=0; $i <= $vlvCount;$i++){
|
|
|
dc8c34 |
+ for (my $i=0; $i <= $vlvCount;$i++){
|
|
|
dc8c34 |
if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesACount++; $isVlvNotes="1";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if($isVlvNotes == 0){
|
|
|
dc8c34 |
@@ -1873,22 +1831,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
if($reportStats){ inc_stats('notesA',$s_stats,$m_stats); }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
- if ($isVlvNnotes == 0 ){
|
|
|
dc8c34 |
- if ($_ =~ /etime= *([0-9.]+)/i ){
|
|
|
dc8c34 |
- writeFile($NOTES_A_ETIME, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_A_CONN, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_A_OP, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ / *([0-9a-z:\/]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_A_TIME, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /nentries= *([0-9]+)/i ){
|
|
|
dc8c34 |
- writeFile($NOTES_A_NENTRIES, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ if ($isVlvNotes == 0 ){
|
|
|
dc8c34 |
+ if ($_ =~ /etime= *([0-9.]+)/i ){ push @{$arrays->{notesAetime}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{notesAconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{notesAop}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ / *([0-9a-z:\/]+)/i){ push @{$arrays->{notesAtime}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /nentries= *([0-9]+)/i ){ push @{$arrays->{notesAnentries}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$isVlvNotes = 0;
|
|
|
dc8c34 |
@@ -1898,7 +1846,7 @@ sub parseLineNormal
|
|
|
dc8c34 |
$con = $1;
|
|
|
dc8c34 |
if ($_ =~ /op= *([0-9]+)/i){ $op = $1;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- for ($i=0; $i <= $vlvCount;$i++){
|
|
|
dc8c34 |
+ for (my $i=0; $i <= $vlvCount;$i++){
|
|
|
dc8c34 |
if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesUCount++; $isVlvNotes="1";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if($isVlvNotes == 0){
|
|
|
dc8c34 |
@@ -1908,85 +1856,75 @@ sub parseLineNormal
|
|
|
dc8c34 |
if($reportStats){ inc_stats('notesU',$s_stats,$m_stats); }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
- if ($isVlvNnotes == 0 ){
|
|
|
dc8c34 |
- if ($_ =~ /etime= *([0-9.]+)/i ){
|
|
|
dc8c34 |
- writeFile($NOTES_U_ETIME, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_U_CONN, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_U_OP, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ / *([0-9a-z:\/]+)/i){
|
|
|
dc8c34 |
- writeFile($NOTES_U_TIME, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ($_ =~ /nentries= *([0-9]+)/i ){
|
|
|
dc8c34 |
- writeFile($NOTES_U_NENTRIES, $1);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ if ($isVlvNotes == 0 ){
|
|
|
dc8c34 |
+ if ($_ =~ /etime= *([0-9.]+)/i ){ push @{$arrays->{notesUetime}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{notesUconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{notesUop}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ / *([0-9a-z:\/]+)/i){ push @{$arrays->{notesUtime}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /nentries= *([0-9]+)/i ){ push @{$arrays->{notesUnentries}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$isVlvNotes = 0;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ closed error 32/){
|
|
|
dc8c34 |
$brokenPipeCount++;
|
|
|
dc8c34 |
- if (m/- T1/){ writeFile($RC,"T1"); }
|
|
|
dc8c34 |
- elsif (m/- T2/){ writeFile($RC,"T2"); }
|
|
|
dc8c34 |
- elsif (m/- A1/){ writeFile($RC,"A1"); }
|
|
|
dc8c34 |
- elsif (m/- B1/){ writeFile($RC,"B1"); }
|
|
|
dc8c34 |
- elsif (m/- B4/){ writeFile($RC,"B4"); }
|
|
|
dc8c34 |
- elsif (m/- B2/){ writeFile($RC,"B2"); }
|
|
|
dc8c34 |
- elsif (m/- B3/){ writeFile($RC,"B3"); }
|
|
|
dc8c34 |
- elsif (m/- R1/){ writeFile($RC,"R1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($RC,"P1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($RC,"P2"); }
|
|
|
dc8c34 |
- elsif (m/- U1/){ writeFile($RC,"U1"); }
|
|
|
dc8c34 |
- else { writeFile($RC,"other"); }
|
|
|
dc8c34 |
+ if (m/- T1/){ $hashes->{rc}->{"T1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ $hashes->{rc}->{"T2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ $hashes->{rc}->{"A1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ $hashes->{rc}->{"B1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ $hashes->{rc}->{"B4"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ $hashes->{rc}->{"B2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ $hashes->{rc}->{"B3"}++; }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ $hashes->{rc}->{"R1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{rc}->{"P1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{rc}->{"P2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ $hashes->{rc}->{"U1"}++; }
|
|
|
dc8c34 |
+ else { $hashes->{rc}->{"other"}++; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ closed error 131/ || m/ closed error -5961/){
|
|
|
dc8c34 |
$connResetByPeerCount++;
|
|
|
dc8c34 |
- if (m/- T1/){ writeFile($SRC,"T1"); }
|
|
|
dc8c34 |
- elsif (m/- T2/){ writeFile($SRC,"T2"); }
|
|
|
dc8c34 |
- elsif (m/- A1/){ writeFile($SRC,"A1"); }
|
|
|
dc8c34 |
- elsif (m/- B1/){ writeFile($SRC,"B1"); }
|
|
|
dc8c34 |
- elsif (m/- B4/){ writeFile($SRC,"B4"); }
|
|
|
dc8c34 |
- elsif (m/- B2/){ writeFile($SRC,"B2"); }
|
|
|
dc8c34 |
- elsif (m/- B3/){ writeFile($SRC,"B3"); }
|
|
|
dc8c34 |
- elsif (m/- R1/){ writeFile($SRC,"R1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($SRC,"P1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($SRC,"P2"); }
|
|
|
dc8c34 |
- elsif (m/- U1/){ writeFile($SRC,"U1"); }
|
|
|
dc8c34 |
- else { writeFile($SRC,"other"); }
|
|
|
dc8c34 |
+ if (m/- T1/){ $hashes->{src}->{"T1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ $hashes->{src}->{"T2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ $hashes->{src}->{"A1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ $hashes->{src}->{"B1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ $hashes->{src}->{"B4"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ $hashes->{src}->{"B2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ $hashes->{src}->{"B3"}++; }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ $hashes->{src}->{"R1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{src}->{"P1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{src}->{"P2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ $hashes->{src}->{"U1"}++; }
|
|
|
dc8c34 |
+ else { $hashes->{src}->{"other"}++; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ closed error 11/){
|
|
|
dc8c34 |
$resourceUnavailCount++;
|
|
|
dc8c34 |
- if (m/- T1/){ writeFile($RSRC,"T1"); }
|
|
|
dc8c34 |
- elsif (m/- T2/){ writeFile($RSRC,"T2"); }
|
|
|
dc8c34 |
- elsif (m/- A1/){ writeFile($RSRC,"A1"); }
|
|
|
dc8c34 |
- elsif (m/- B1/){ writeFile($RSRC,"B1"); }
|
|
|
dc8c34 |
- elsif (m/- B4/){ writeFile($RSRC,"B4"); }
|
|
|
dc8c34 |
- elsif (m/- B2/){ writeFile($RSRC,"B2"); }
|
|
|
dc8c34 |
- elsif (m/- B3/){ writeFile($RSRC,"B3"); }
|
|
|
dc8c34 |
- elsif (m/- R1/){ writeFile($RSRC,"R1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($RSRC,"P1"); }
|
|
|
dc8c34 |
- elsif (m/- P1/){ writeFile($RSRC,"P2"); }
|
|
|
dc8c34 |
- elsif (m/- U1/){ writeFile($RSRC,"U1"); }
|
|
|
dc8c34 |
- else { writeFile($RSRC,"other"); }
|
|
|
dc8c34 |
+ if (m/- T1/){ $hashes->{rsrc}->{"T1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ $hashes->{rsrc}->{"T2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ $hashes->{rsrc}->{"A1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ $hashes->{rsrc}->{"B1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ $hashes->{rsrc}->{"B4"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ $hashes->{rsrc}->{"B2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ $hashes->{rsrc}->{"B3"}++; }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ $hashes->{rsrc}->{"R1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{rsrc}->{"P1"}++; }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ $hashes->{rsrc}->{"P2"}++; }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ $hashes->{rsrc}->{"U1"}++; }
|
|
|
dc8c34 |
+ else { $hashes->{rsrc}->{"other"}++; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($usage =~ /g/ || $usage =~ /c/ || $usage =~ /i/ || $verb eq "yes"){
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
if ($_ =~ /connection from *([0-9A-fa-f\.\:]+)/i ) {
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($1 eq $excludeIP[$xxx]){
|
|
|
dc8c34 |
$exc = "yes";
|
|
|
dc8c34 |
- writeFile($EXCOUNT,$1);
|
|
|
dc8c34 |
+ $hashes->{excount}->{$1}++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$ip = $1;
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip count");
|
|
|
dc8c34 |
+ $hashes->{ip_hash}->{$ip}++;
|
|
|
dc8c34 |
if ($_ =~ /conn= *([0-9]+)/i ){
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($CONN_HASH, "$1 $ip");
|
|
|
dc8c34 |
+ $hashes->{conn_hash}->{$1} = $ip;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1995,12 +1933,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip A1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "A1");
|
|
|
dc8c34 |
+ $hashes->{A1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"A1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2010,12 +1948,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip B1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "B1");
|
|
|
dc8c34 |
+ $hashes->{B1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"B1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2025,12 +1963,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip B4");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "B4");
|
|
|
dc8c34 |
+ $hashes->{B4}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"B4"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2040,12 +1978,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip T1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "T1");
|
|
|
dc8c34 |
+ $hashes->{T1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"T1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2055,12 +1993,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip T2");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "T2");
|
|
|
dc8c34 |
+ $hashes->{T2}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"T2"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2071,12 +2009,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
$maxBerSizeCount++;
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip B2");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "B2");
|
|
|
dc8c34 |
+ $hashes->{B2}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"B2"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2086,12 +2024,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip B3");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "B3");
|
|
|
dc8c34 |
+ $hashes->{B3}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"B3"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2101,12 +2039,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip R1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "R1");
|
|
|
dc8c34 |
+ $hashes->{R1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"R1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2116,12 +2054,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip P1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "P1");
|
|
|
dc8c34 |
+ $hashes->{P1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"P1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2131,12 +2069,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip P2");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "P2");
|
|
|
dc8c34 |
+ $hashes->{P2}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"P2"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2146,12 +2084,12 @@ sub parseLineNormal
|
|
|
dc8c34 |
$exc = "no";
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
- for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
|
|
|
dc8c34 |
if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($exc ne "yes"){
|
|
|
dc8c34 |
- writeFile($IP_HASH, "$ip U1");
|
|
|
dc8c34 |
- writeFile($CONNCOUNT, "U1");
|
|
|
dc8c34 |
+ $hashes->{U1}->{$ip}++;
|
|
|
dc8c34 |
+ $hashes->{conncount}->{"U1"}++;
|
|
|
dc8c34 |
$connCodeCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2162,59 +2100,60 @@ sub parseLineNormal
|
|
|
dc8c34 |
if ($1 ne "0"){ $errorCount++;}
|
|
|
dc8c34 |
else { $successCount++;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1); inc_stats_val('etime',$1,$s_stats,$m_stats); }
|
|
|
dc8c34 |
+ if ($_ =~ /etime= *([0-9.]+)/ ) { $hashes->{etime}->{$1}++; inc_stats_val('etime',$1,$s_stats,$m_stats); }
|
|
|
dc8c34 |
if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
|
|
|
dc8c34 |
- if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ / nentries= *([0-9]+)/i ){ $hashes->{nentries}->{$1}++; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/objectclass=\*/i || m/objectclass=top/i ){
|
|
|
dc8c34 |
if (m/ scope=2 /){ $objectclassTopCount++;}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (m/ EXT oid=/){
|
|
|
dc8c34 |
$extopCount++;
|
|
|
dc8c34 |
- if ($_ =~ /oid=\" *([0-9\.]+)/i ){ writeFile($OID,$1); }
|
|
|
dc8c34 |
+ if ($_ =~ /oid=\" *([0-9\.]+)/i ){ $hashes->{oid}->{$1}++; }
|
|
|
dc8c34 |
if ($1 && $1 eq $startTLSoid){$startTLSCount++;}
|
|
|
dc8c34 |
if ($verb eq "yes"){
|
|
|
dc8c34 |
- if ($_ =~ /conn= *([0-9]+)/i){ writeFile($EXT_CONN, $1); }
|
|
|
dc8c34 |
- if ($_ =~ /op= *([0-9]+)/i){ writeFile($EXT_OP, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ push @{$arrays->{extconn}}, $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ push @{$arrays->{extop}}, $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ($usage =~ /l/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ if (($usage =~ /l/ || $verb eq "yes") and / SRCH /){
|
|
|
dc8c34 |
+ my ($filterConn, $filterOp);
|
|
|
dc8c34 |
if (/ SRCH / && / attrs=/ && $_ =~ /filter=\"(.*)\" /i ){
|
|
|
dc8c34 |
$tmpp = $1;
|
|
|
dc8c34 |
$tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
$tmpp =~ s/\\22/\"/g;
|
|
|
dc8c34 |
- writeFile($FILTER, $tmpp);
|
|
|
dc8c34 |
- $filterVal = $tmpp;
|
|
|
dc8c34 |
+ $hashes->{filter}->{$tmpp}++;
|
|
|
dc8c34 |
if ($_ =~ /conn= *([0-9]+)/i) { $filterConn = $1; }
|
|
|
dc8c34 |
if ($_ =~ /op= *([0-9]+)/i) { $filterOp = $1; }
|
|
|
dc8c34 |
} elsif (/ SRCH / && $_ =~ /filter=\"(.*)\"/i){
|
|
|
dc8c34 |
$tmpp = $1;
|
|
|
dc8c34 |
$tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
$tmpp =~ s/\\22/\"/g;
|
|
|
dc8c34 |
- writeFile($FILTER, $tmpp);
|
|
|
dc8c34 |
- $filterVal = $tmpp;
|
|
|
dc8c34 |
+ $hashes->{filter}->{$tmpp}++;
|
|
|
dc8c34 |
if ($_ =~ /conn= *([0-9]+)/i) { $filterConn = $1; }
|
|
|
dc8c34 |
if ($_ =~ /op= *([0-9]+)/i) { $filterOp = $1; }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$filterCount++;
|
|
|
dc8c34 |
if($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
- # we noly need this for the unindexed search report
|
|
|
dc8c34 |
- writeFile($FILTERINFO, "$filterVal ,, $filterConn ,, $filterOp");
|
|
|
dc8c34 |
+ # we only need this for the unindexed search report
|
|
|
dc8c34 |
+ push @{$arrays->{filterval}}, $tmpp;
|
|
|
dc8c34 |
+ push @{$arrays->{filterconn}}, $filterConn;
|
|
|
dc8c34 |
+ push @{$arrays->{filterop}}, $filterOp;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($usage =~ /a/ || $verb eq "yes"){
|
|
|
dc8c34 |
if (/ SRCH / && $_ =~ /base=\"(.*)\" scope/i ){
|
|
|
dc8c34 |
+ my ($baseConn, $baseOp, $scopeVal, $scopeConn, $scopeOp);
|
|
|
dc8c34 |
if ($1 eq ""){
|
|
|
dc8c34 |
$tmpp = "Root DSE";
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
$tmpp = $1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
- writeFile($BASE, $tmpp);
|
|
|
dc8c34 |
+ $hashes->{base}->{$tmpp}++;
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
# grab the search bases & scope for potential unindexed searches
|
|
|
dc8c34 |
#
|
|
|
dc8c34 |
- $baseVal = $tmpp;
|
|
|
dc8c34 |
if ($_ =~ /scope= *([0-9]+)/i) {
|
|
|
dc8c34 |
$scopeVal = $1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2227,9 +2166,13 @@ sub parseLineNormal
|
|
|
dc8c34 |
$scopeOp = $1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
- # we noly need this for the unindexed search report
|
|
|
dc8c34 |
- writeFile($BASEINFO, "$baseVal ,, $baseConn ,, $baseOp");
|
|
|
dc8c34 |
- writeFile($SCOPEINFO, "$scopeVal ,, $scopeConn ,, $scopeOp");
|
|
|
dc8c34 |
+ # we only need this for the unindexed search report
|
|
|
dc8c34 |
+ push @{$arrays->{baseval}}, $tmpp;
|
|
|
dc8c34 |
+ push @{$arrays->{baseconn}}, $baseConn;
|
|
|
dc8c34 |
+ push @{$arrays->{baseop}}, $baseOp;
|
|
|
dc8c34 |
+ push @{$arrays->{scopeval}}, $scopeVal;
|
|
|
dc8c34 |
+ push @{$arrays->{scopeconn}}, $scopeConn;
|
|
|
dc8c34 |
+ push @{$arrays->{scopeop}}, $scopeOp;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$baseCount++;
|
|
|
dc8c34 |
$scopeCount++;
|
|
|
dc8c34 |
@@ -2243,26 +2186,26 @@ sub parseLineNormal
|
|
|
dc8c34 |
if ($usage =~ /f/ || $verb eq "yes"){
|
|
|
dc8c34 |
if (/ err=49 tag=/ && / dn=\"/){
|
|
|
dc8c34 |
if ($_ =~ /dn=\"(.*)\"/i ){
|
|
|
dc8c34 |
- writeFile($DS6XBADPWD, $1);
|
|
|
dc8c34 |
+ $hashes->{ds6xbadpwd}->{$1}++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
$ds6x = "true";
|
|
|
dc8c34 |
$badPwdCount++;
|
|
|
dc8c34 |
} elsif (/ err=49 tag=/ ){
|
|
|
dc8c34 |
if ($_ =~ /conn= *([0-9]+)/i ){
|
|
|
dc8c34 |
- writeFile($BADPWDCONN, $1);
|
|
|
dc8c34 |
+ push @{$arrays->{badpwdconn}}, $1;
|
|
|
dc8c34 |
$ip = getIPfromConn($1);
|
|
|
dc8c34 |
$badPwdCount++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ($_ =~ /op= *([0-9]+)/i ){
|
|
|
dc8c34 |
- writeFile($BADPWDOP, $1);
|
|
|
dc8c34 |
+ push @{$arrays->{badpwdop}}, $1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- writeFile($BADPWDIP, $ip);
|
|
|
dc8c34 |
+ push @{$arrays->{badpwdip}}, $ip;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (/ BIND / && /method=sasl/i){
|
|
|
dc8c34 |
$saslBindCount++;
|
|
|
dc8c34 |
- if ($_ =~ /mech=(.*)/i ){
|
|
|
dc8c34 |
- writeFile($SASLMECH, $1);
|
|
|
dc8c34 |
+ if ($_ =~ /mech=(.*)/i ){
|
|
|
dc8c34 |
+ $hashes->{saslmech}->{$1}++;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (/ conn=Internal op=-1 / && !/ RESULT err=/){ $internalOpCount++; }
|
|
|
dc8c34 |
@@ -2414,7 +2357,7 @@ displayBindReport
|
|
|
dc8c34 |
|
|
|
dc8c34 |
print "\nBind Report\n";
|
|
|
dc8c34 |
print "====================================================================\n\n";
|
|
|
dc8c34 |
- foreach $bindDN (sort { $bindReport{$a} <=> $bindReport{$b} } keys %bindReport) {
|
|
|
dc8c34 |
+ foreach my $bindDN (sort { $bindReport{$a} <=> $bindReport{$b} } keys %bindReport) {
|
|
|
dc8c34 |
print("Bind DN: $bindDN\n");
|
|
|
dc8c34 |
print("--------------------------------------------------------------------\n");
|
|
|
dc8c34 |
print(" Client Addresses:\n\n");
|
|
|
dc8c34 |
@@ -2430,11 +2373,11 @@ displayBindReport
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
printClients
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- @bindConns = &cleanConns(split(' ', @_[0]));
|
|
|
dc8c34 |
- $IPcount = "1";
|
|
|
dc8c34 |
+ my @bindConns = &cleanConns(split(' ', $_[0]));
|
|
|
dc8c34 |
+ my $IPcount = "1";
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- foreach $ip ( keys %connList ){ # Loop over all the IP addresses
|
|
|
dc8c34 |
- foreach $bc (@bindConns){ # Loop over each bind conn number and compare it
|
|
|
dc8c34 |
+ foreach my $ip ( keys %connList ){ # Loop over all the IP addresses
|
|
|
dc8c34 |
+ foreach my $bc (@bindConns){ # Loop over each bind conn number and compare it
|
|
|
dc8c34 |
if($connList{$ip} =~ / $bc /){
|
|
|
dc8c34 |
print(" [$IPcount] $ip\n");
|
|
|
dc8c34 |
$IPcount++;
|
|
|
dc8c34 |
@@ -2447,22 +2390,22 @@ printClients
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
cleanConns
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- @dirtyConns = @_;
|
|
|
dc8c34 |
- $#cleanConns = -1;
|
|
|
dc8c34 |
- $c = 0;
|
|
|
dc8c34 |
+ my @dirtyConns = @_;
|
|
|
dc8c34 |
+ my @retConns = ();
|
|
|
dc8c34 |
+ my $c = 0;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ($i = 0; $i <=$#dirtyConns; $i++){
|
|
|
dc8c34 |
+ for (my $i = 0; $i <=$#dirtyConns; $i++){
|
|
|
dc8c34 |
if($dirtyConns[$i] ne ""){
|
|
|
dc8c34 |
- $cleanConns[$c++] = $dirtyConns[$i];
|
|
|
dc8c34 |
+ $retConns[$c++] = $dirtyConns[$i];
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- return @cleanConns;
|
|
|
dc8c34 |
+ return @retConns;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
printOpStats
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $dn = @_[0];
|
|
|
dc8c34 |
+ my $dn = $_[0];
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if( $bindReport{$dn}{"failedBind"} == 0 ){
|
|
|
dc8c34 |
print(" Binds: " . $bindReport{$dn}{"binds"} . "\n");
|
|
|
dc8c34 |
@@ -2487,333 +2430,70 @@ printOpStats
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
openFailed
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $open_error = @_[0];
|
|
|
dc8c34 |
- $file_name = @_[1];
|
|
|
dc8c34 |
- closeDataFiles();
|
|
|
dc8c34 |
+ my $open_error = $_[0];
|
|
|
dc8c34 |
+ my $file_name = $_[1];
|
|
|
dc8c34 |
removeDataFiles();
|
|
|
dc8c34 |
die ("Can not open $file_name error ($open_error)");
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
-openDataFiles
|
|
|
dc8c34 |
+openHashFiles
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- # hash files
|
|
|
dc8c34 |
- open ($ATTR, ">$ATTR") or do { openFailed($!, $ATTR) };
|
|
|
dc8c34 |
- open ($RC, ">$RC") or do { openFailed($!, $RC) };
|
|
|
dc8c34 |
- open ($SRC, ">$SRC") or do { openFailed($!, $SRC) };
|
|
|
dc8c34 |
- open ($RSRC, ">$RSRC") or do { openFailed($!, $RSRC) };
|
|
|
dc8c34 |
- open ($EXCOUNT, ">$EXCOUNT") or do { openFailed($!, $EXCOUNT) };
|
|
|
dc8c34 |
- open ($CONN_HASH, ">$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
- open ($IP_HASH, ">$IP_HASH") or do { openFailed($!, $IP_HASH) };
|
|
|
dc8c34 |
- open ($CONNCOUNT, ">$CONNCOUNT") or do { openFailed($!, $CONNCOUNT) };
|
|
|
dc8c34 |
- open ($NENTRIES, ">$NENTRIES") or do { openFailed($!, $NENTRIES) };
|
|
|
dc8c34 |
- open ($FILTER, ">$FILTER") or do { openFailed($!, $FILTER) };
|
|
|
dc8c34 |
- open ($BASE, ">$BASE") or do { openFailed($!, $BASE) };
|
|
|
dc8c34 |
- open ($DS6XBADPWD, ">$DS6XBADPWD") or do { openFailed($!, $DS6XBADPWD) };
|
|
|
dc8c34 |
- open ($SASLMECH, ">$SASLMECH") or do { openFailed($!, $SASLMECH) };
|
|
|
dc8c34 |
- open ($BINDLIST, ">$BINDLIST") or do { openFailed($!, $BINDLIST) };
|
|
|
dc8c34 |
- open ($ETIME, ">$ETIME") or do { openFailed($!, $ETIME) };
|
|
|
dc8c34 |
- open ($OID, ">$OID") or do { openFailed($!, $OID) };
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # array files
|
|
|
dc8c34 |
- open($SRCH_CONN,">$SRCH_CONN") or do { openFailed($!, $SRCH_CONN) };
|
|
|
dc8c34 |
- open($SRCH_OP, ">$SRCH_OP") or do { openFailed($!, $SRCH_OP) };
|
|
|
dc8c34 |
- open($DEL_CONN, ">$DEL_CONN") or do { openFailed($!, $DEL_CONN) };
|
|
|
dc8c34 |
- open($DEL_OP, ">$DEL_OP") or do { openFailed($!, $DEL_OP) };
|
|
|
dc8c34 |
- open($MOD_CONN, ">$MOD_CONN") or do { openFailed($!, $MOD_CONN) };
|
|
|
dc8c34 |
- open($MOD_OP, ">$MOD_OP") or do { openFailed($!, $MOD_OP) };
|
|
|
dc8c34 |
- open($ADD_CONN, ">$ADD_CONN") or do { openFailed($!, $ADD_CONN) };
|
|
|
dc8c34 |
- open($ADD_OP, ">$ADD_OP") or do { openFailed($!, $ADD_OP) };
|
|
|
dc8c34 |
- open($MODRDN_CONN, ">$MODRDN_CONN") or do { openFailed($!, $MODRDN_CONN) };
|
|
|
dc8c34 |
- open($MODRDN_OP, ">$MODRDN_OP") or do { openFailed($!, $MODRDN_OP) };
|
|
|
dc8c34 |
- open($CMP_CONN, ">$CMP_CONN") or do { openFailed($!, $CMP_CONN) };
|
|
|
dc8c34 |
- open($CMP_OP,">$CMP_OP") or do { openFailed($!, $CMP_OP) };
|
|
|
dc8c34 |
- open($TARGET_CONN, ">$TARGET_CONN") or do { openFailed($!, $TARGET_CONN) };
|
|
|
dc8c34 |
- open($TARGET_OP, ">$TARGET_OP") or do { openFailed($!, $TARGET_OP) };
|
|
|
dc8c34 |
- open($MSGID, ">$MSGID") or do { openFailed($!, $MSGID) };
|
|
|
dc8c34 |
- open($BIND_CONN, ">$BIND_CONN") or do { openFailed($!, $BIND_CONN) };
|
|
|
dc8c34 |
- open($BIND_OP, ">$BIND_OP") or do { openFailed($!, $BIND_OP) };
|
|
|
dc8c34 |
- open($UNBIND_CONN, ">$UNBIND_CONN") or do { openFailed($!, $UNBIND_CONN) };
|
|
|
dc8c34 |
- open($UNBIND_OP, ">$UNBIND_OP") or do { openFailed($!, $UNBIND_OP) };
|
|
|
dc8c34 |
- open($EXT_CONN, ">$EXT_CONN") or do { openFailed($!, $EXT_CONN) };
|
|
|
dc8c34 |
- open($EXT_OP, ">$EXT_OP") or do { openFailed($!, $EXT_OP) };
|
|
|
dc8c34 |
- open($NOTES_A_ETIME, ">$NOTES_A_ETIME") or do { openFailed($!, $NOTES_A_ETIME) };
|
|
|
dc8c34 |
- open($NOTES_A_CONN, ">$NOTES_A_CONN") or do { openFailed($!, $NOTES_A_CONN) };
|
|
|
dc8c34 |
- open($NOTES_A_OP, ">$NOTES_A_OP") or do { openFailed($!, $NOTES_A_OP) };
|
|
|
dc8c34 |
- open($NOTES_A_TIME, ">$NOTES_A_TIME") or do { openFailed($!, $NOTES_A_TIME) };
|
|
|
dc8c34 |
- open($NOTES_A_NENTRIES, ">$NOTES_A_NENTRIES") or do { openFailed($!, $NOTES_A_NENTRIES) };
|
|
|
dc8c34 |
- open($NOTES_U_ETIME, ">$NOTES_U_ETIME") or do { openFailed($!, $NOTES_U_ETIME) };
|
|
|
dc8c34 |
- open($NOTES_U_CONN, ">$NOTES_U_CONN") or do { openFailed($!, $NOTES_U_CONN) };
|
|
|
dc8c34 |
- open($NOTES_U_OP, ">$NOTES_U_OP") or do { openFailed($!, $NOTES_U_OP) };
|
|
|
dc8c34 |
- open($NOTES_U_TIME, ">$NOTES_U_TIME") or do { openFailed($!, $NOTES_U_TIME) };
|
|
|
dc8c34 |
- open($NOTES_U_NENTRIES, ">$NOTES_U_NENTRIES") or do { openFailed($!, $NOTES_U_NENTRIES) };
|
|
|
dc8c34 |
- open($BADPWDCONN, ">$BADPWDCONN") or do { openFailed($!, $BADPWDCONN) };
|
|
|
dc8c34 |
- open($BADPWDOP, ">$BADPWDOP") or do { openFailed($!, $BADPWDOP) };
|
|
|
dc8c34 |
- open($BADPWDIP, ">$BADPWDIP") or do { openFailed($!, $NADPWDIP) };
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # info files
|
|
|
dc8c34 |
- open($BINDINFO, ">$BINDINFO") or do { openFailed($!, $BINDINFO) };
|
|
|
dc8c34 |
- open($BASEINFO, ">$BASEINFO") or do { openFailed($!, $BASEINFO) };
|
|
|
dc8c34 |
- open($SCOPEINFO, ">$SCOPEINFO") or do { openFailed($!, $SCOPEINFO) };
|
|
|
dc8c34 |
- open($FILTERINFO, ">$FILTERINFO") or do { openFailed($!, $FILTERINFO) };
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-closeDataFiles
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- close $ATTR;
|
|
|
dc8c34 |
- close $RC;
|
|
|
dc8c34 |
- close $SRC;
|
|
|
dc8c34 |
- close $RSRC;
|
|
|
dc8c34 |
- close $EXCOUNT;
|
|
|
dc8c34 |
- close $CONN_HASH;
|
|
|
dc8c34 |
- close $IP_HASH;
|
|
|
dc8c34 |
- close $CONNCOUNT;
|
|
|
dc8c34 |
- close $NENTRIES;
|
|
|
dc8c34 |
- close $FILTER;
|
|
|
dc8c34 |
- close $BASE;
|
|
|
dc8c34 |
- close $DS6XBADPWD;
|
|
|
dc8c34 |
- close $SASLMECH;
|
|
|
dc8c34 |
- close $BINDLIST;
|
|
|
dc8c34 |
- close $ETIME;
|
|
|
dc8c34 |
- close $OID;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # array files
|
|
|
dc8c34 |
- close $SRCH_CONN;
|
|
|
dc8c34 |
- close $SRCH_OP;
|
|
|
dc8c34 |
- close $DEL_CONN;
|
|
|
dc8c34 |
- close $DEL_OP;
|
|
|
dc8c34 |
- close $MOD_CONN;
|
|
|
dc8c34 |
- close $MOD_OP;
|
|
|
dc8c34 |
- close $ADD_CONN;
|
|
|
dc8c34 |
- close $ADD_OP;
|
|
|
dc8c34 |
- close $MODRDN_CONN;
|
|
|
dc8c34 |
- close $MODRDN_OP;
|
|
|
dc8c34 |
- close $CMP_CONN;
|
|
|
dc8c34 |
- close $CMP_OP;
|
|
|
dc8c34 |
- close $TARGET_CONN;
|
|
|
dc8c34 |
- close $TARGET_OP;
|
|
|
dc8c34 |
- close $MSGID;
|
|
|
dc8c34 |
- close $BIND_CONN;
|
|
|
dc8c34 |
- close $BIND_OP;
|
|
|
dc8c34 |
- close $UNBIND_CONN;
|
|
|
dc8c34 |
- close $UNBIND_OP;
|
|
|
dc8c34 |
- close $EXT_CONN;
|
|
|
dc8c34 |
- close $EXT_OP;
|
|
|
dc8c34 |
- close $NOTES_A_ETIME;
|
|
|
dc8c34 |
- close $NOTES_A_CONN;
|
|
|
dc8c34 |
- close $NOTES_A_OP;
|
|
|
dc8c34 |
- close $NOTES_A_TIME;
|
|
|
dc8c34 |
- close $NOTES_A_NENTRIES;
|
|
|
dc8c34 |
- close $NOTES_U_ETIME;
|
|
|
dc8c34 |
- close $NOTES_U_CONN;
|
|
|
dc8c34 |
- close $NOTES_U_OP;
|
|
|
dc8c34 |
- close $NOTES_U_TIME;
|
|
|
dc8c34 |
- close $NOTES_U_NENTRIES;
|
|
|
dc8c34 |
- close $BADPWDCONN;
|
|
|
dc8c34 |
- close $BADPWDOP;
|
|
|
dc8c34 |
- close $BADPWDIP;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # info files
|
|
|
dc8c34 |
- close $BINDINFO;
|
|
|
dc8c34 |
- close $BASEINFO;
|
|
|
dc8c34 |
- close $SCOPEINFO;
|
|
|
dc8c34 |
- close $FILTERINFO;
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-removeDataFiles
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- unlink $ATTR;
|
|
|
dc8c34 |
- unlink $RC;
|
|
|
dc8c34 |
- unlink $SRC;
|
|
|
dc8c34 |
- unlink $RSRC;
|
|
|
dc8c34 |
- unlink $EXCOUNT;
|
|
|
dc8c34 |
- unlink $CONN_HASH;
|
|
|
dc8c34 |
- unlink $IP_HASH;
|
|
|
dc8c34 |
- unlink $CONNCOUNT;
|
|
|
dc8c34 |
- unlink $NENTRIES;
|
|
|
dc8c34 |
- unlink $FILTER;
|
|
|
dc8c34 |
- unlink $BASE;
|
|
|
dc8c34 |
- unlink $DS6XBADPWD;
|
|
|
dc8c34 |
- unlink $SASLMECH;
|
|
|
dc8c34 |
- unlink $BINDLIST;
|
|
|
dc8c34 |
- unlink $ETIME;
|
|
|
dc8c34 |
- unlink $OID;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # array files
|
|
|
dc8c34 |
- unlink $SRCH_CONN;
|
|
|
dc8c34 |
- unlink $SRCH_OP;
|
|
|
dc8c34 |
- unlink $DEL_CONN;
|
|
|
dc8c34 |
- unlink $DEL_OP;
|
|
|
dc8c34 |
- unlink $MOD_CONN;
|
|
|
dc8c34 |
- unlink $MOD_OP;
|
|
|
dc8c34 |
- unlink $ADD_CONN;
|
|
|
dc8c34 |
- unlink $ADD_OP;
|
|
|
dc8c34 |
- unlink $MODRDN_CONN;
|
|
|
dc8c34 |
- unlink $MODRDN_OP;
|
|
|
dc8c34 |
- unlink $CMP_CONN;
|
|
|
dc8c34 |
- unlink $CMP_OP;
|
|
|
dc8c34 |
- unlink $TARGET_CONN;
|
|
|
dc8c34 |
- unlink $TARGET_OP;
|
|
|
dc8c34 |
- unlink $MSGID;
|
|
|
dc8c34 |
- unlink $BIND_CONN;
|
|
|
dc8c34 |
- unlink $BIND_OP;
|
|
|
dc8c34 |
- unlink $UNBIND_CONN;
|
|
|
dc8c34 |
- unlink $UNBIND_OP;
|
|
|
dc8c34 |
- unlink $EXT_CONN;
|
|
|
dc8c34 |
- unlink $EXT_OP;
|
|
|
dc8c34 |
- unlink $NOTES_A_ETIME;
|
|
|
dc8c34 |
- unlink $NOTES_A_CONN;
|
|
|
dc8c34 |
- unlink $NOTES_A_OP;
|
|
|
dc8c34 |
- unlink $NOTES_A_TIME;
|
|
|
dc8c34 |
- unlink $NOTES_A_NENTRIES;
|
|
|
dc8c34 |
- unlink $NOTES_U_ETIME;
|
|
|
dc8c34 |
- unlink $NOTES_U_CONN;
|
|
|
dc8c34 |
- unlink $NOTES_U_OP;
|
|
|
dc8c34 |
- unlink $NOTES_U_TIME;
|
|
|
dc8c34 |
- unlink $NOTES_U_NENTRIES;
|
|
|
dc8c34 |
- unlink $BADPWDCONN;
|
|
|
dc8c34 |
- unlink $BADPWDOP;
|
|
|
dc8c34 |
- unlink $BADPWDIP;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- # info files
|
|
|
dc8c34 |
- unlink $BINDINFO;
|
|
|
dc8c34 |
- unlink $BASEINFO;
|
|
|
dc8c34 |
- unlink $SCOPEINFO;
|
|
|
dc8c34 |
- unlink $FILTERINFO;
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-getIPfromConn
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- $connip = @_[0];
|
|
|
dc8c34 |
- $retval = "";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- close $CONN_HASH; # we can not read the file is its already open
|
|
|
dc8c34 |
- open(CONN,"$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
- while (<CONN>){
|
|
|
dc8c34 |
- if($_ =~ /$connip (.*)/){
|
|
|
dc8c34 |
- $retval = $1;
|
|
|
dc8c34 |
- last;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ my $dir = shift;
|
|
|
dc8c34 |
+ my %hashes = ();
|
|
|
dc8c34 |
+ for my $hn (@_) {
|
|
|
dc8c34 |
+ my %h = (); # using my in inner loop will create brand new hash every time through for tie
|
|
|
dc8c34 |
+ my $fn = "$dir/$hn.logconv.db";
|
|
|
dc8c34 |
+ push @removefiles, $fn;
|
|
|
dc8c34 |
+ tie %h, "DB_File", $fn, O_CREAT|O_RDWR, 0600, $DB_HASH or do { openFailed($!, $fn) };
|
|
|
dc8c34 |
+ $hashes{$hn} = \%h;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- close CONN;
|
|
|
dc8c34 |
- #reopen file for writing(append)
|
|
|
dc8c34 |
- open($CONN_HASH,">>$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- return $retval;
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-writeFile
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- $text = @_[1] . "\n";
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- print $file $text;
|
|
|
dc8c34 |
+ return \%hashes;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-# This hash file stores one value per line
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
-getCounterHashFromFile
|
|
|
dc8c34 |
+openArrayFiles
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- my %hash = ();
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
- while(<FILE>){
|
|
|
dc8c34 |
- chomp;
|
|
|
dc8c34 |
- $hash{$_}++;
|
|
|
dc8c34 |
+ my $dir = shift;
|
|
|
dc8c34 |
+ my %arrays = ();
|
|
|
dc8c34 |
+ for my $an (@_) {
|
|
|
dc8c34 |
+ my @ary = (); # using my in inner loop will create brand new array every time through for tie
|
|
|
dc8c34 |
+ my $fn = "$dir/$an.logconv.db";
|
|
|
dc8c34 |
+ push @removefiles, $fn;
|
|
|
dc8c34 |
+ tie @ary, "DB_File", $fn, O_CREAT|O_RDWR, 0600, $DB_RECNO or do { openFailed($!, $fn) };
|
|
|
dc8c34 |
+ $arrays{$an} = \@ary;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- close FILE;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- return %hash;
|
|
|
dc8c34 |
+ return \%arrays;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-# this hash file stores two values per line (2 dimension hash)
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
-getTwoDimHashFromFile
|
|
|
dc8c34 |
+removeDataFiles
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- my %hash = ();
|
|
|
dc8c34 |
+ if (!$needCleanup) { return ; }
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
- while(<FILE>){
|
|
|
dc8c34 |
- @parts = split (' ', $_);
|
|
|
dc8c34 |
- chomp(@parts);
|
|
|
dc8c34 |
- $hash{$parts[0]}{$parts[1]}++;
|
|
|
dc8c34 |
+ for my $h (keys %{$hashes}) {
|
|
|
dc8c34 |
+ untie %{$hashes->{$h}};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- close FILE;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- return %hash;
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# this hash file stores two values per line (1 dimension hash)
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-getHashFromFile
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- my %hash = ();
|
|
|
dc8c34 |
- @parts = ();
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- open(FILE,"$file") or do { openFailed($!, $file ) };
|
|
|
dc8c34 |
- while(<FILE>){
|
|
|
dc8c34 |
- @parts = split (' ',$_);
|
|
|
dc8c34 |
- chomp(@parts);
|
|
|
dc8c34 |
- $hash{$parts[0]} = $parts[1];
|
|
|
dc8c34 |
+ for my $a (keys %{$arrays}) {
|
|
|
dc8c34 |
+ untie @{$arrays->{$a}};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- close FILE;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- return %hash;
|
|
|
dc8c34 |
-}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-# Return array of values from the file
|
|
|
dc8c34 |
-sub
|
|
|
dc8c34 |
-getArrayFromFile
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- my @arry;
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- $array_count = 0;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
- while(<FILE>){
|
|
|
dc8c34 |
- chomp;
|
|
|
dc8c34 |
- $arry[$array_count] = $_;
|
|
|
dc8c34 |
- $array_count++;
|
|
|
dc8c34 |
+ for my $file (@removefiles) {
|
|
|
dc8c34 |
+ unlink $file;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- close FILE;
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- return @arry;
|
|
|
dc8c34 |
+ $needCleanup = 0;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-# build the three array
|
|
|
dc8c34 |
+END { print "Cleaning up temp files . . .\n"; removeDataFiles(); print "Done\n"; }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
sub
|
|
|
dc8c34 |
-getInfoArraysFromFile
|
|
|
dc8c34 |
+getIPfromConn
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
- $file = @_[0];
|
|
|
dc8c34 |
- $array_count = 0;
|
|
|
dc8c34 |
- @parts = ();
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- open(FILE,"<$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
- while(<FILE>){
|
|
|
dc8c34 |
- @parts = split (' ,, ',$_);
|
|
|
dc8c34 |
- chomp(@parts);
|
|
|
dc8c34 |
- if($#parts > 0){
|
|
|
dc8c34 |
- $fileArray1[$array_count] = $parts[0];
|
|
|
dc8c34 |
- $fileArray2[$array_count] = $parts[1];
|
|
|
dc8c34 |
- $fileArray3[$array_count] = $parts[2];
|
|
|
dc8c34 |
- $array_count++;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- close FILE;
|
|
|
dc8c34 |
+ my $connid = shift;
|
|
|
dc8c34 |
+ return $hashes->{conn_hash}->{$connid};
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
#######################################
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
# The End #
|
|
|
dc8c34 |
# #
|
|
|
dc8c34 |
#######################################
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|