This file is indexed.

/usr/share/logwatch/scripts/services/sonicwall is in logwatch 7.4.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
#!/usr/bin/perl
#########################################################################
# $Id: sonicwall 150 2013-06-18 22:19:38Z mtremaine $
##########################################################################
# $Log: sonicwall,v $
# Revision 1.4  2008/06/30 23:07:51  kirk
# fixed copyright holders for files where I know who they should be
#
# Revision 1.3  2008/03/24 23:31:27  kirk
# added copyright/license notice to each script
#
# Revision 1.2  2006/10/18 17:57:49  mike
# Updates from Laurent DuFour -mgt
#
# Revision 1.1  2005/05/04 15:54:23  bjorn
# Sonicwall submitted by Laurent Dufour
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Laurent DUFOUR <laurent.dufour@havas.com>,<dufour_l@hotmail.com>
#    based on the work of
#    Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
#    etc, to logwatch-devel@lists.sourceforge.net
########################################################

#######################################################
## Copyright (c) 2008 Laurent DUFOUR
## Covered under the included MIT/X-Consortium License:
##    http://www.opensource.org/licenses/mit-license.php
## All modifications and contributions by other persons to
## this script are assumed to have been donated to the
## Logwatch project and thus assume the above copyright
## and licensing terms.  If you want to make contributions
## under your own copyright or a different license this
## must be explicitly stated in the contribution an the
## Logwatch project reserves the right to not accept such
## contributions.  If you have made significant
## contributions to this script and want to claim
## copyright please contact logwatch-devel@lists.sourceforge.net.
#########################################################

use Logwatch ':all';

my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

my %configConvert = (
    'human-readable'    => 0,
    'Human-readable'    => 1,
    'truncate-readable' => 2,
  );

# Taken from DiskUsage.pm inside Filesys-DiskUsage-0.02
#
# Jose Castro, C<< <cog@cpan.org>
# Please report any bugs or feature requests to
# C<bug-disk-usage@rt.cpan.org>, or through the web interface at
# L<http://rt.cpan.org>.  I will be notified, and then you'll
# automatically be notified of progress on your bug as I make changes.
#
# Copyright 2004 Jose Castro, All Rights Reserved.
#
#This program is free software; you can redistribute it and/or modify it
#under the same terms as Perl itself.
#
#
# convert size to human readable format
sub _convert {
  defined (my $size = shift) || return undef;
  my $config = {@_};
#  $config->{human} || return $size;
  my $block = $config->{'Human-readable'} ? 1000 : 1024;
  my @args = qw/B K M G/;
  while (@args && $size > $block) {
    shift @args;
    $size /= $block;
  }

  if ($config->{'truncate-readable'} > 0) {
    $size = sprintf("%.$config->{'truncate-readable'}f",$size);
  }

  return "$size$args[0]";
}



if ( $Debug >= 5 ) {
    print STDERR "\n\nDEBUG: Inside SONICWALL Filter \n\n";
    $DebugCounter = 1;
}


my ($month,$day,$time,$host_ip,$host,$conn,$msg,$message);

while (defined($ThisLine = <STDIN>)) {
    if ( $Debug >= 30 ) {
	print STDERR "DEBUG($DebugCounter): $ThisLine";
	$DebugCounter++;
    }

($month,$day,$time,$host_ip,$host_id,$host_sn,$msg)=split(/ +/,$ThisLine,7);

if ($ThisLine =~ /sn=/ ) { #mean that we ave to deal with a sonicwall log file line

   if ( ($ThisLine =~ /traffic/ ) or
         ($ThisLine =~ /Copyright/ ) or
         ($ThisLine =~ /removed due to simultaneous rekey/ ) or
         ($ThisLine =~ /Administrator logged out/ ) or
         ($ThisLine =~ /Connection (Closed|Opened)/ ) or
         ($ThisLine =~ /(TCP|UDP) connection dropped/ )
    ) {
      # don't care about this, will code this later
   }

    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$pad) = ($ThisLine =~ /msg="UDP packet dropped" n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? (.*)?/) ) {
      $UDP_dropped{$host_ip}{LookupIP($src_ip)," to ",LookupIP($dst_ip)}++
   }
    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$pad) = ($ThisLine =~ /msg="TCP packet dropped" n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? (.*)?/) ) {
      $TCP_dropped{$host_ip}{LookupIP($src_ip)," to ",LookupIP($dst_ip)}++
   }
    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$pad) = ($ThisLine =~ /msg="ICMP packet dropped" n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? (.*)?/) ) {
      $ICMP_dropped{$host_ip}{LookupIP($src_ip)," to ",LookupIP($dst_ip)}++
   }

    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$ip_proto,$xfer_port_type,$op_type,$http_result) = ($ThisLine =~ /n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? proto=(udp|tcp)\/(http|80) op=(HEAD|Other) result=(\d+)/) ) {

 	if ($op_type eq "HEAD") {
	$URL_HEAD{$host_ip}{$url}++;
	}
	else {
	$URL_OTHER{$host_ip}{$url}++;
	}
}


    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$ip_proto,$xfer_port_type,$op_type,$xfer_way,$xfer_byte,$http_result,$url,$args) = ($ThisLine =~ /n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? proto=(udp|tcp|icmp)\/(http|80) op=(GET|POST) (rcvd|sent)=(\d+) result=(\d+) dstname=(.*) arg=(.*)(.*)/) ) {


	if ($op_type eq "GET") {
	$URL_GET{$host_ip}{$url}++;
	}
	else {
	$URL_POST{$host_ip}{$url}++;
	}

      if ($xfer_way eq "sent")	{

        $ProtoPacketSent{$host_ip}{$ip_proto}++;
	$TotalProtoByteSent{$host_ip}{$ip_proto}=$TotalProtoByteSent{$host_ip}{$ip_proto}+$xfer_byte;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
        $ByteSent{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteSent{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte;
 	$PortPacketSent{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}
     }
 else {
        $ProtoPacketReceived{$host_ip}{$ip_proto}++;
	$TotalProtoByteReceived{$host_ip}{$ip_proto}=$TotalProtoByteReceived{$host_ip}{$ip_proto}+$xfer_byte;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
	 $ByteReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteReceived{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte;
	 $PortPacketReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}
   }
}


    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$ip_proto,$xfer_port_type,$op_type,$xfer_byte_sent,$xfer_byte_rcvd,$http_result,$url,$args) = ($ThisLine =~ /n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? proto=(udp|tcp|icmp)\/(http|80) op=(GET|POST) sent=(\d+) rcvd=(\d+) result=(\d+) dstname=(.*) (arg=(.*))?/) ) {


	if ($op_type eq "GET") {
	$URL_GET{$host_ip}{$url}++;
	}
	else {
	$URL_POST{$host_ip}{$url}++;
	}

        $ProtoPacketSent{$host_ip}{$ip_proto}++;
	$TotalProtoByteSent{$host_ip}{$ip_proto}=$TotalProtoByteSent{$host_ip}{$ip_proto}+$xfer_byte_sent;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
        $ByteSent{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteSent{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte_sent;
 	$PortPacketSent{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}

	$ProtoPacketReceived{$host_ip}{$ip_proto}++;
	$TotalProtoByteReceived{$host_ip}{$ip_proto}=$TotalProtoByteReceived{$host_ip}{$ip_proto}+$xfer_byte_rcvd;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
	 $ByteReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteReceived{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte_rcvd;
	 $PortPacketReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}
}









    elsif ( ($number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$ip_proto,$xfer_port_type,$xfer_way,$xfer_byte) = ($ThisLine =~ /n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? proto=(udp|tcp|icmp)\/(.*) (rcvd|sent)=(\d+)(.*)/) ) {

      if ($xfer_way eq "sent")	{

        $ProtoPacketSent{$host_ip}{$ip_proto}++;
	$TotalProtoByteSent{$host_ip}{$ip_proto}=$TotalProtoByteSent{$host_ip}{$ip_proto}+$xfer_byte;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
        $ByteSent{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteSent{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte;
 	$PortPacketSent{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}
     }
 else {
        $ProtoPacketReceived{$host_ip}{$ip_proto}++;
	$TotalProtoByteReceived{$host_ip}{$ip_proto}=$TotalProtoByteReceived{$host_ip}{$ip_proto}+$xfer_byte;

        if (($ip_proto eq "tcp") or ($ip_proto eq "udp")) {
	 $ByteReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}=$ByteReceived{$ip_proto}{$ip_proto,"/",$xfer_port_type}+$xfer_byte;
	 $PortPacketReceived{$host_ip}{$ip_proto,"/",$xfer_port_type}++;
	}
   }
}
#time="2005-03-23 09:03:27" fw=62.2.84.91 pri=5 c=128 m=37 msg="UDP packet dropped" n=3759 src=64.74.133.26:11379:WAN dst=62.2.84.91:33436:WAN^M
#Mar 23 12:45:32 10.15.30.1 id=firewall sn=004010144097 time="2005-03-23 11:08:20" fw=62.2.84.91 pri=6 c=1024 m=98 n=61505 src=195.143.213.210:4992:WAN dst=62.2.84.92:1802:DMZ proto=tcp/1802 rcvd=106 ^M


    elsif ( ($dst_ip,$msg) = ($ThisLine =~ /System Config saved from host (\d+\.\d+\.\d+\.\d+) (.*)/) ) {
      $SysCfgSaved{$host_ip}{LookupIP($dst_ip)}++;
   }
   elsif ( ($dst_ip,$msg) = ($ThisLine =~ /The system configuration was saved from host (\d+\.\d+\.\d+\.\d+) by (.*)/) ) {
      $SysCfgSaved{$host_ip}{LookupIP($dst_ip)}++;
   }
   elsif ( ($ThisLine =~ /Compiled/) ) {
      $Started{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /DNS entries have been automatically refreshed./) ) {
      $DNSRefreshed{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /DNS has been refreshed./) ) {
      $DNSRefreshed{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /Log successfully sent via email/) ) {
      $SyslogHost{$host_ip}{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /Syslog facility has been changed/) ) {
      $SyslogFacility{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /Syslog security facility has been changed/) ) {
      $SyslogFacility{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /The system clock has been updated through NTP./) ) {
      $NTPUpdated{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /failed to get clock through NTP/) ) {
      $NTPFailed{$host_ip}++;
   }
   elsif ( ($ThisLine =~ /Access Rule added/) ) {
      $AccessRuleAdded{$host_ip}++;
   }
   elsif ( ($message) = ($ThisLine =~ /RELOAD: (.*)/) ) {
      $ReloadRequested{$host_ip}{$message}++;
   }
   elsif ( ($message) = ($ThisLine =~ /RESTART: (.*)/) ) {
      $Restarted{$host_ip}{$message}++;
   }
   elsif ( $ThisLine =~ m/msg="Probable TCP NULL scan " n=(\d+) src=(\d+\.\d+\.\d+\.\d+) (.*)/ ) {
       if ( $Debug >= 5 ) {
	   print STDERR "DEBUG: Found -TCP NULL scan- line\n";
       }
       my $name = LookupIP($2);
       $Temp = "TCP NULL scan from $name";
       $TCP_NULL_scan{$host_ip}{$Temp}++;
   }
   elsif ( ($interface) = ($ThisLine =~ /msg="Successful administrator login" n=(\d+) src=(\d+\.\d+\.\d+\.\d+) (.*)/) ) {
       if ($Debug >= 5) {
	   print STDERR "DEBUG: Found -$1 logged in from $4 using $2\n";
       }
       if ($Detail >= 20) {
	   $Users{$host_ip}{"from ",$2}{"using port 80"}{$1}++;
       } else {
	   $Users{$host_ip}{"from ",$2}{"using port 80"}{"(all)"}++;
       }
   }
   elsif ( ($interface) = ($ThisLine =~ /msg="(WAN zone administrator login allowed|Web management request allowed)" n=(\d+) usr=(\w+) src=(\d+\.\d+\.\d+\.\d+)(.*)?/) ) {
       if ($Debug >= 5) {
	   print STDERR "DEBUG: Found -$1 logged in from $5 using $3\n";
       }
       if ($Detail >= 20) {
	   $Users{$host_ip}{"from ",$3}{"using port 80"}{$1}++;
       } else {
	   $Users{$host_ip}{"from ",$3}{"using port 80"}{"(all)"}++;
       }
   }



   elsif ( $ThisLine =~ m/msg="Administrator login failed - incorrect password" n=(\d+) src=(\d+\.\d+\.\d+\.\d+) (.*)/ ) {
       if ( $Debug >= 5 ) {
	   print STDERR "DEBUG: Found -Failed login- line\n";
       }
       my $name = LookupIP($2);
       $Temp = "HTTP from $name";
       $BadAdminLogins{$host_ip}{"Administrator login failed - incorrect password from $name"}++;
       $IllegalUsers{$host_ip}{$Temp}++;
   }
   elsif ( $ThisLine =~ m/msg="Unknown user attempted to log in" n=(\d+) src=(\d+\.\d+\.\d+\.\d+) dst=(\d+\.\d+\.\d+\.\d+) user=(.*)/ ) {
       if ( $Debug >= 5 ) {
	   print STDERR "DEBUG: Found -Failed login- line\n";
       }
       my $name = LookupIP($2);
       $Temp = "HTTP from $name";
       $BadLogins{$host_ip}{"$4 user attempted to log in from $name"}++;
       $IllegalUsers{$host_ip}{$Temp}++;
   }
   elsif ( $ThisLine =~ m/SSH client at (.+) has attempted to make an SCS connection to interface untrust with IP (.+) but failed (.*)/ ) {
       my $name = LookupIP($2);
       $Temp = "SSH from $name";
       $BadLogins{$host_ip}{$Temp}++;
       $IllegalUsers{$host_ip}{$Temp}++;
   }

    elsif ( ($Msg,$number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$pad) = ($ThisLine =~ /msg="(.*)" n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)?(S+)?(.*)?/) ) {
      $Msg{$host_ip}{$Msg," for ",LookupIP($src_ip)," to ",LookupIP($dst_ip)}++
   }
    elsif ( ($Msg,$number,$src_ip,$port_src,$interface_src,$src_name,$dst_ip,$port_dst,$interface_dst,$dst_name,$pad) = ($ThisLine =~ /msg="(Ping of death dropped|Smurf Amplification attack dropped)" n=(\d+) src=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)? dst=(\d+\.\d+\.\d+\.\d+):(\d+):(WAN|LAN|DMZ):?(.*)?/) ) {
      $Msg{$host_ip}{$Msg," for ",LookupIP($src_ip)," to ",LookupIP($dst_ip)}++
   }



else {
      # Report any unmatched entries...
      push @OtherList,$ThisLine;
   }
}
} #end of mean we have a sonic wall logfile line

if (keys %Started) {
   print "\nDevice started :\n";
   foreach $ThisOne (keys %Started) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$Started{$ThisOne}}) {
         print "\t Started" .$ThatOne . "\t: " . $Started{$ThisOne}{$ThatOne} . "{ Time(s)\n";
      }
   }
}

if (keys %UDP_dropped) {
   print "\nDevice where ip UDP packets have been dropped  :\n";
   foreach $ThisOne (keys %UDP_dropped) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$UDP_dropped{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $UDP_dropped{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %TCP_dropped) {
   print "\nDevice where ip TCP packets have been dropped  :\n";
   foreach $ThisOne (keys %TCP_dropped) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$TCP_dropped{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $TCP_dropped{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %ICMP_dropped) {
   print "\nDevice where ip ICMP packets have been dropped  :\n";
   foreach $ThisOne (keys %ICMP_dropped) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ICMP_dropped{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $ICMP_dropped{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %Msg) {
   print "\nDevice others message  :\n";
   foreach $ThisOne (keys %Msg) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$Msg{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $Msg{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %URL_GET) ) {
   print "\nDevice URL GET :\n";
   foreach $ThisOne (keys %URL_GET) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$URL_GET{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $URL_GET{$ThisOne}{$ThatOne} . " times(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %URL_POST) ) {
   print "\nDevice URL POST :\n";
   foreach $ThisOne (keys %URL_POST) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$URL_POST{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $URL_POST{$ThisOne}{$ThatOne} . " times(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %URL_HEAD) ) {
   print "\nDevice URL HEAD :\n";
   foreach $ThisOne (keys %URL_HEAD) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$URL_HEAD{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $URL_HEAD{$ThisOne}{$ThatOne} . " times(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %URL_OTHER) ) {
   print "\nDevice URL OTHER :\n";
   foreach $ThisOne (keys %URL_OTHER) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$URL_OTHER{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $URL_OTHER{$ThisOne}{$ThatOne} . " times(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %ProtoPacketReceived) ) {
   print "\nDevice Total packets received by protocols :\n";
   foreach $ThisOne (keys %ProtoPacketReceived) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ProtoPacketReceived{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $ProtoPacketReceived{$ThisOne}{$ThatOne} . " packet(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %PortPacketReceived) ) {
   print "\nDevice Total packets received by ports :\n";
   foreach $ThisOne (keys %PortPacketReceived) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$PortPacketReceived{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $PortPacketReceived{$ThisOne}{$ThatOne} . " packet(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %TotalProtoByteReceived) ) {
   print "\nDevice Total Bytes received by protocols :\n";
   foreach $ThisOne (keys %TotalProtoByteReceived) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$TotalProtoByteReceived{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . _convert($TotalProtoByteReceived{$ThisOne}{$ThatOne}, %configConvert ) . " Byte(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %ByteReceived) ) {
   print "\nDevice Total Bytes received by ports :\n";
   foreach $ThisOne (keys %ByteReceived) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ByteReceived{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " .  _convert($ByteReceived{$ThisOne}{$ThatOne}, %configConvert ) . " Byte(s)\n";
      }
   }
}


if ( ( $Detail >= 5 ) and (keys %ProtoPacketSent) ) {
   print "\nDevice Total packets sent by protocols :\n";
   foreach $ThisOne (keys %ProtoPacketSent) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ProtoPacketSent{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $ProtoPacketSent{$ThisOne}{$ThatOne} . " packet(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %PortPacketSent) ) {
   print "\nDevice Total packets sent by ports :\n";
   foreach $ThisOne (keys %PortPacketSent) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$PortPacketSent{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $PortPacketSent{$ThisOne}{$ThatOne} . " packet(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %TotalProtoByteSent) ) {
   print "\nDevice Total Bytes sent by protocols :\n";
   foreach $ThisOne (keys %TotalProtoByteSent) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$TotalProtoByteSent{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . _convert($TotalProtoByteSent{$ThisOne}{$ThatOne},  %configConvert ) . " Byte(s)\n";
      }
   }
}

if ( ( $Detail >= 5 ) and (keys %ByteSent) ) {
   print "\nDevice Total Bytes sent by ports :\n";
   foreach $ThisOne (keys %ByteSent) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ByteSent{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . _convert($ByteSent{$ThisOne}{$ThatOne}, %configConvert ) . " Byte(s)\n";
      }
   }
}



if (keys %NTPUpdated) {
   print "\nDevice where The system clock has been updated through NTP :\n";
   foreach $ThisOne (keys %NTPUpdated) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$NTPUpdated{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $NTPUpdated{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %NTPFailed) {
   print "\nDevice where failed to get clock through NTP :\n";
   foreach $ThisOne (keys %NTPFailed) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$NTPFailed{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $NTPFailed{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %DNSRefreshed) {
   print "\nDevice where DNS have been refreshed  :\n";
   foreach $ThisOne (keys %DNSRefreshed) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$DNSRefreshed{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $DNSRefreshed{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %SyslogFacility) {
   print "\nDevice where Syslog facility has been changed  :\n";
   foreach $ThisOne (keys %SyslogFacility) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$SyslogFacility{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $SyslogFacility{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %SyslogHost) {
   print "\nDevice where Syslog have been mail succesfully :\n";
   foreach $ThisOne (keys %SyslogHost) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$SyslogHost{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $SyslogHost{$ThisOne}{$ThisOne} . " Time(s)\n";
      }
   }
}


if (keys %Restarted) {
   print "\nDevice restarted :\n";
   foreach $ThisOne (keys %Restarted) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$Restarted{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $Restarted{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %AccessRuleAdded) {
   print "\nDevice where rules have been added :\n";
   foreach $ThisOne (keys %AccessRuleAdded) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$AccessRuleAdded{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $AccessRuleAdded{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %ReloadRequested) {
   print "\nDevice reload requested :\n";
   foreach $ThisOne (keys %ReloadRequested) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$ReloadRequested{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $ReloadRequested{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}

if (keys %SysCfgSaved) {
   print "\nDevice where system config have been saved :\n";
   foreach $ThisOne (keys %SysCfgSaved) {
      print "   " . $ThisOne . ":\n";
      foreach $ThatOne (keys %{$SysCfgSaved{$ThisOne}}) {
         print "\t " .$ThatOne . "\t: " . $SysCfgSaved{$ThisOne}{$ThatOne} . " Time(s)\n";
      }
   }
}



if (keys %BadLogins) {
    print "\nFailed logins from these:\n";
    foreach $ThisOne (keys %BadLogins) {
	print "   " . $ThisOne . ":\n";
	for (sort keys %{$BadLogins{$ThisOne}}) {
	    print "\t   $_: $BadLogins{$ThisOne}{$_} Time(s)\n";
	}
    }
}

if (keys %TCP_NULL_scan) {
    print "\nDevice whcih had been ports scanned :\n";
    foreach $ThisOne (keys %TCP_NULL_scan) {
	print "   " . $ThisOne . ":\n";
	for (sort keys %{$TCP_NULL_scan{$ThisOne}}) {
	    print "\t   $_: $TCP_NULL_scan{$ThisOne}{$_} Time(s)\n";
	}
    }
}

if (keys %BadAdminLogins) {
    print "\nFailed administrator logins from these:\n";
    foreach $ThisOne (keys %BadAdminLogins) {
	print "   " . $ThisOne . ":\n";
	for (sort keys %{$BadAdminLogins{$ThisOne}}) {
	    print "\t   $_: $BadAdminLogins{$ThisOne}{$_} Time(s)\n";
	}
    }
}

if (keys %IllegalUsers) {
    print "\nIllegal users from these:\n";
    foreach $ThisOne (keys %IllegalUsers) {
	print "   " . $ThisOne . ":\n";
	for (sort keys %{$IllegalUsers{$ThisOne}}) {
	    print "\t   $_: $IllegalUsers{$ThisOne}{$_} Time(s)\n";

	}
    }
}


if (keys %Users) {
    print "\nUsers logging in through :\n";
foreach $ThisOne (keys %Users) {
    print "   " . $ThisOne . ":\n";

foreach $user (sort {$a cmp $b} keys %{$Users{$ThisOne}}) {
    print "   $user:\n";
    my $totalSort = TotalCountOrder(%{$Users{$ThisOne}{$user}}, \&SortIP);
    foreach my $ip (sort $totalSort keys %{$Users{$ThisOne}{$user}}) {
	my $name = LookupIP($ip);
	if ($Detail >= 20) {
            print "      $name:\n";
            my $sort = CountOrder(%{$Users{$ThisOne}{$user}{$ip}});
            foreach my $method (sort $sort keys %{$Users{$ThisOne}{$user}{$ip}}) {
		my $val = $Users{$ThisOne}{$user}{$ip}{$method};
		my $plural = ($val > 1) ? "s" : "";
		print "         $method: $val time$plural\n";
            }
	} else {
            my $val = (values %{$Users{$ThisOne}{$user}{$ip}})[0];
            my $plural = ($val > 1) ? "s" : "";
            print "      $name: $val time$plural\n";
	}
    }
}
}
}


if ($#OtherList >= 0) {
   print "\n**Unmatched Entries**\n";
   print @OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 syntax=perl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End: