# makeanalyse.pl # # Generate an HTML page containing a list of networks and a list of traffic # sources. This page invokes the CGI script analyse.pl. The page is written to # STDOUT. # # Modification History ###################### # 23 Dec 98 Tony Farr Original coding ############################################################################## use strict; my(@sources, @dests); # Globals my $LOGPATH= "D:\\logs\\whodo\\"; # Directory where csv/logs are stored. get_sources_and_dests(); write_html(); exit(0); sub get_sources_and_dests { # Initialises @sources & @dests with yesterday's traffic sources and destinations my(%srchash, %dsthash, $src, $dst); my $fname= get_input_file(); open(LOG,"<$fname") || die "$0: unable to open input file $fname; $!"; # First 2 lines are headers || die "$0: $fname is empty\n"; || die "$0: $fname lacks second header line\n"; # The rest of the file has traffic for particular sources & destinations while () { ($src, $dst)= split/,/; $srchash{$src}= 1; $dsthash{$dst}= 1; } close(LOG); # Transfer them from the hashes to the arrays @sources= sort( keys(%srchash) ); @dests= sort( keys(%dsthash) ); } sub get_input_file { # Returns the file name of yesterday's whodo log my $t = time() - 24*60*60; my ($mday,$mon,$year) = ( localtime($t) )[3..5]; $LOGPATH . sprintf("%d%02d%02d.csv",$year+1900,$mon+1,$mday); } sub write_html { print <Analyse traffic sources or destinations

Analyse traffic sources or destinations


Show sources sending traffic to: 30 minutes day week month

Summarise minor sources:

OR

Show destinations receiving traffic from: 30 minutes day week month

Summarise minor destinations:


TAIL }