LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-30-2012, 04:09 AM   #1
jsluoning
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Rep: Reputation: Disabled
read a file .pcap


I have a .pcap file but it is really in large size (1G).

I just need a part of this file which is choosen by time. For example, from 12:00:00 to 12:00:10. Is this possible?

Thank you.
 
Old 01-30-2012, 04:17 AM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Lightbulb

Use the below command

Code:
tcpdump -ttttnnr pcapfile.pcap | awk '/12:00:00/,/12:00:10/'

Last edited by vikas027; 01-30-2012 at 04:18 AM.
 
Old 01-30-2012, 04:17 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
wireshark (well.. tshark) can certainly do this easily, but tcpslice is written specifically for this purpose, so check that out.
 
1 members found this post helpful.
Old 01-30-2012, 04:18 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by vikas027 View Post
Use the below command

Code:
tcpdump -ttttnnr pcapfile.pcap
I think the point is they don't want to have to load all the uninteresting data, not see what time the packets were. I certainly would not like the idea of loading a 1gb pcap file into wireshark.
 
Old 01-30-2012, 04:24 AM   #5
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
Yes using grep.
Code:
grep "12:00:0[0-9]"
 
Old 01-30-2012, 04:37 AM   #6
jsluoning
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
wireshark (well.. tshark) can certainly do this easily, but tcpslice is written specifically for this purpose, so check that out.
Actually i need to use the information chosen in a new software to analyze the errors. I want to show these informations with GTK and then do the analyzation.
So maybe i can use wireshark like plug-in?
 
Old 01-30-2012, 04:45 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
not sure what you mean by a plugin, but I would use tcpslice to hack out the interesting region of traffic to a new pcap file and then loads of 10mb or so into wireshark.
 
Old 01-30-2012, 05:09 AM   #8
jsluoning
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
not sure what you mean by a plugin, but I would use tcpslice to hack out the interesting region of traffic to a new pcap file and then loads of 10mb or so into wireshark.
I am sorry i don't speak very well English and i don't know a thing about network.

So you mean i can generate a new file (10 seconds of the interesting region)with tcpslice and then juste analyze this file in my software?
 
Old 01-30-2012, 05:33 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
yes, that *seems* to be exactly what you're after, no?
 
Old 01-30-2012, 07:02 AM   #10
jsluoning
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
yes, that *seems* to be exactly what you're after, no?
Yeah, I really need a file in small size but tcpslice is a linux commande, no?

what i want to realize is:
1. choose the 1G file
2. choose the time limit in a filter(something like the red words), click OK
hh : mm : ss to hh : mm : ss OK
3. show the text

I can not use the tcpslice commande in the console to generate the file.
 
Old 01-30-2012, 07:14 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you're asking on a linux forum about manipulating data created by a linux command and you expect us not to mention linux based solutions? :-)

tshark comes with wireshark on windows, I expect that's probably your best bet.

see this: http://www.wireshark.org/lists/wires.../msg00187.html for an example filter for a time range.

Last edited by acid_kewpie; 01-30-2012 at 07:16 AM.
 
1 members found this post helpful.
Old 01-30-2012, 07:24 AM   #12
jsluoning
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by acid_kewpie View Post
you're asking on a linux forum about manipulating data created by a linux command and you expect us not to mention linux based solutions? :-)

tshark comes with wireshark on windows, I expect that's probably your best bet.

see this: http://www.wireshark.org/lists/wires.../msg00187.html for an example filter for a time range.
you are right, i find myself a little stupid. >_<
But thank you very much. It's really helpful.

Merci et je vous souhaite une très bonne journée.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort pcap file contents by file date zakiakhmad Linux - Networking 5 01-03-2012 06:40 AM
pcap.h file problem nwprogrammer Linux - Software 1 04-25-2011 12:25 PM
How can I read a .pcap file? abefroman Linux - Software 3 05-29-2008 03:18 PM
How can I generate a pcap file? abefroman Linux - Software 3 05-29-2008 03:18 PM
looking for a MSN msgsnarf for pcap file metabaron Linux - Networking 0 07-13-2006 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration