it may be overkill or underkill but if the statistics that are needed are contained in the tcp/udp header (srcip, dstip, srcport, dstport, length, flags, ...) say for counting the number of connections/packets/data/protocol between hosts then use flow-tools and Cflow.

parse the firewall logs with Perl using the Cflow module to convert to netflow format, it holds data you find in the IP headers and some more. then use the flow-tools to process them. there is a learning curve, but it's worth it.

the simplest Perl version of say counting the number of packets and bytes transfered between a given pair of hosts over enough time/data so that the script takes 1 minute to run. well, the equivalent flow-tools command will do the same in 2 seconds. it does nice text-based reports, scan detection, powerfull filtering and there's excellent support on the mailing list.

if you're counting based on the data in the packet like specific intrusion attempt types then flow-tools won't do much good. if you have lots of header type data flow-tools rocks.


In reply to Re: Re^3: *Fastest* way to print a hash sorted by value (less Perl) by zengargoyle
in thread *Fastest* way to print a hash sorted by value by smellysocks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.