LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2013, 01:37 PM   #1
bgs@pt
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Rep: Reputation: 0
Read pcap data in console


Hi everyone.

I'm trying to find a way (tcpdump command parameter?) to read ALL data from a pcap file on the console.

For example, considering I want to sniff every query and response functions between 2 hosts.

I've tried with "tcpdump -A" and other option but none of them present the entire information, like Wireshark GUI does.

Any ideias?
 
Old 10-16-2013, 02:09 PM   #2
jason_not
Member
 
Registered: Aug 2010
Location: Beaverton, Oregon, USA
Distribution: Pfsense, Ubuntu, Centos, Fedora, Redhat, Scientfic, MacOS
Posts: 76

Rep: Reputation: 19
Hello,

You need to use the -r <filename> option with tcpdump. a pcap file generally is what you get with the -w option of tcpdump.

For example: to see the traffic between hosts A and B, I use:

tcpdump -r <pcapfile> -n host A or host B

-jason
 
Old 10-16-2013, 02:15 PM   #3
bgs@pt
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jason_not View Post
Hello,

You need to use the -r <filename> option with tcpdump. a pcap file generally is what you get with the -w option of tcpdump.

For example: to see the traffic between hosts A and B, I use:

tcpdump -r <pcapfile> -n host A or host B

-jason
I've used "-r" before but that shows very little info. I need something that is able to give me the entire information, as seen with Wireshark!

For example, in Wireshark we get detailed info when the following sections are expanded, for some Protocol:
- Frame data
- Ethernet data
- IP data
- TCP/UDP data
- Protocol data

I want this in a way that I can read from the CLI.
 
Old 10-16-2013, 03:16 PM   #4
jason_not
Member
 
Registered: Aug 2010
Location: Beaverton, Oregon, USA
Distribution: Pfsense, Ubuntu, Centos, Fedora, Redhat, Scientfic, MacOS
Posts: 76

Rep: Reputation: 19
Hello,

You might need to run several different dumps to see what you want.

the -e option will print the link-level headers: this will show the source and destination mac addresses.
not sure what you mean by "frame data"
ip, tcp, and udp can all be filtered upon. if tcpdump doesn't show how to do this, read the man page on pcap-filter.

the -v options will print out more data, but this depends on the version of tcpdump.

The big issue to remember though is even though the data is there, it's hard to keep things in context. There are also lots of examples and tutorials online, such as tcpdump's website.

--jason
 
Old 10-16-2013, 03:18 PM   #5
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
tshark is probably what you are looking for.


http://www.wireshark.org/docs/man-pages/tshark.html
 
1 members found this post helpful.
Old 10-16-2013, 03:21 PM   #6
jason_not
Member
 
Registered: Aug 2010
Location: Beaverton, Oregon, USA
Distribution: Pfsense, Ubuntu, Centos, Fedora, Redhat, Scientfic, MacOS
Posts: 76

Rep: Reputation: 19
Hello,

I like 0.o's reply: I hadn't realized there was a console-based wireshark.

--jason
 
Old 10-16-2013, 05:04 PM   #7
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
You might also like this:

tcpdump -As0 -vvnn -r <pcap>
 
1 members found this post helpful.
  


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
read a file .pcap jsluoning Linux - Software 11 01-30-2012 07:24 AM
Read System Call is getting blocked when tried to read the data from CDC device sanju.lnt Linux - Embedded & Single-board computer 0 09-11-2011 11:48 PM
How can I read a .pcap file? abefroman Linux - Software 3 05-29-2008 03:18 PM
convert packet level pcap captures to flow level data hedpe Linux - Networking 1 07-27-2006 02:56 PM
pcap data extraction black_man Linux - Networking 1 08-28-2004 08:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:12 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