It seems syn_packets is only called for syn packets (as the name implies), so you probably won't be counting ack packets without changing the filter expression. That should be the same number normally but bugs, network problems or malice might make them differ)

Now what is your problem with counting? It seems this is already done with '$count++'. The only thing missing seems to be the reporting (the print after the loop call won't be executed if the capture loop is endless). Either write to a log file or print a report every 100 or 1000 packets or after some time has elapsed (this can be done in the syn_packets subroutine). The time in seconds you get with time(). Put the starting time in some variable and subtract the actual time from that to know how much time elapsed. Or check how to end the Net::Pcap::loop (check the documentation) so that the print afterwards really gets executed


In reply to Re: counting syn+ack. Help!!! by jethro
in thread counting syn+ack. Help!!! by Arijit

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.