#!/usr/bin/perl -w # # sumflags # # summarize TCP flags from tethereal output # # Nick DeBaggis # use strict; my %hash; my $total = 0; while(<>){ chomp; if(m/TCP/){ if(m/\[(.*)\]/){ $hash{$1}++; } } } print "TCP Flags Statistics\n\n"; foreach(sort {$hash{$b} <=> $hash{$a}} keys %hash){ printf("%-36s %8d\n", $_, $hash{$_}); $total += $hash{$_}; } printf("\n%-36s %8d\n", "Total:", $total);