Sampling pcap file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sampling pcap file
# 8  
Old 11-14-2010
OK, try this. It copies the current IPs array to PIPs (previous IPs) once a line is output. This array is used to check each for IPs not in the previous range.

Code:
awk -F"[:, ]" ' { now=mktime("2000 1 1 "$1" "$2" "$3); 
if (NR==1) printf("#Time Packets IPs New_IPs\n", to=now+10, new=0);
else {
    if (now >= to) {
           printf("%d %d %d %d\n", count+=10, found, length(IPs), new); 
           while((to+10) < now) printf("%d 0 0 0\n", count+=10, to+=10);
           delete PIPs;
           for (ip in IPs) PIPs[ip]=IPs[ip];
           delete IPs;
           new=found=0;
           to+=10; 
        }
}
found++;
IPs[$5]++;
if (!($5 in PIPs)) new++;
}
END { printf("%d %d %d %d\n", count + 10 - to + now, found, length(IPs), new); } ' logfile

This User Gave Thanks to Chubler_XL For This Post:
# 9  
Old 11-14-2010
Hi,

Apparently it appears to be working, I just need to cross-check it by cutting the pacp file and comparing the statistics.

Will let you know if it need any further modification.

Thanks a lot :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

printing out information from pcap file

Hi Folks, i got the following Problem: I want to make an analysis on a pcap file. (diestance between different packets and so on) The difficulty now... it's not a simple Ethernet/ IP/ File, but it's a SS7 file. There are the Layers MTP2 MTP3 and ISUP. My analysis depends on the ISUP Layer. Now... (0 Replies)
Discussion started by: thisismyname
0 Replies

2. Shell Programming and Scripting

data sampling

I have a requirement where I have multiple flat file sources. I need to create sample data from each source. Example: Source 1 has 10 flat files-- member, transaction,item,email,....etc Now if I get any 10 records (say first 10 records) from the member flat file, I need to find those matching... (2 Replies)
Discussion started by: arrivederci
2 Replies

3. Shell Programming and Scripting

Sampling and Binning- Engineering problem

Hi everyone! Can you please help me with some shell scripting? I have an input file input.txt It has 3 columns (Time, Event, Value) Time event Value 03:38:22 A 57 03:38:23 A 56 03:38:24 B 24 03:38:25 C 51 03:38:26 B 7 03:38:26 ... (7 Replies)
Discussion started by: Needhelp2
7 Replies

4. Shell Programming and Scripting

Pcap.h Sniffing

Can someone please help me figure out how to use pcap.h to sniff packets between only 2 computers whose mac addresses are know? Thanks (0 Replies)
Discussion started by: papabearcares
0 Replies

5. Programming

Pcap.h Sniffing

Can someone please help me figure out how to use pcap.h to sniff packets between only 2 computers whose mac addresses are know? Thanks (0 Replies)
Discussion started by: papabearcares
0 Replies

6. Programming

pcap.h

I cant use pcap.h include file. How can I do so? :confused: (8 Replies)
Discussion started by: Pervez Sajjad
8 Replies

7. Programming

Compiling Pcap.c

I don't know if this is the correct forum to post this but hopefully someone can atleast point me in the right direction if they can't help me. I am trying to install the Net::Pcap module for perl from Tim Potter version .04. I have installed gcc 2.95.3 on my Solaris 8 box. I am sure it's just... (6 Replies)
Discussion started by: TioTony
6 Replies
Login or Register to Ask a Question