LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-15-2012, 11:00 AM   #1
BMWE
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
capturing packets with tcpdump


Hello

I have a lot of processes in the network between network elements.

I want to capture some HTTP/SOAP packets which contain specific value. This packet can arrive at any time so it's not possible to capture all the traffic as there is a lot of it.

Is it possible to set some filter to capture only those packets?
 
Old 06-15-2012, 12:17 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Yes, it's possible.
 
Old 06-15-2012, 12:37 PM   #3
BMWE
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Question

How?
 
Old 06-15-2012, 12:49 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
A BPF filter can help with protocol (TCP) port (80) and packet headers like SYN, narrowing down the amount of traffic you log with tcpdump, tshark or whatever you use. And although the application interprets the payload as XML SOAP IIRC is just plain text you can grep.
 
Old 06-15-2012, 01:55 PM   #5
BMWE
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
so if i'll execute

tcpdump -s0 -w file.cap -i eth0 |grep 42507

will work?
 
Old 06-15-2012, 04:18 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Yeah, it'll work.
But what the result is remains to be seen using grep in that way.
Better save the capture though and use Wireshark as it has a lot of dissectors.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Tcpdump : Capturing TCP packets with particular flag combinations apit Linux - Networking 9 09-20-2008 09:45 PM
Capturing, modifying and injecting packets flukebox Linux - Networking 2 07-03-2007 08:07 AM
capturing loopback with tcpdump trek413 Linux - Networking 3 12-06-2006 11:22 AM
VoIP Packets capturing in linux fastian Linux - Networking 1 03-25-2005 11:34 AM
capturing ethernet packets shrike_912 Programming 5 08-02-2004 01:46 PM

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

All times are GMT -5. The time now is 06:10 PM.

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