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 09-13-2007, 01:31 AM   #1
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
netcat / tcpdump howto do


Hello !

I use

Quote:
/usr/sbin/tcpdump -i br0 port 4003 -n -X -s 1500 -tttt
to see the contend of my ip-packages passing port 4003.

It`s ok, but I would like to have a tool (maybe netcat) which only gives me the contend, and not the whole packages with the header (which i do not need).

Could somebody help me ?
 
Old 09-13-2007, 02:56 AM   #2
netguy2000
Member
 
Registered: Oct 2003
Location: Karachi, PAKISTAN
Distribution: Redhat, Fedora, Open BSD, FreeBSD, SlackWare
Posts: 115

Rep: Reputation: 15
Exclamation

I am not an expert of tcpdump , but I think you need to use "head" & "tail" command to crop your output of tcpdump command line. with "|" sign.


Regards,
Rizwan.
 
Old 09-13-2007, 03:18 AM   #3
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Original Poster
Rep: Reputation: 32
well i tought of that allready but as there are cr/lf in the output, so there is no chance for cut/grep to make it right.
 
Old 09-13-2007, 06:02 AM   #4
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Original Poster
Rep: Reputation: 32
well i found out that what i want can be done by

tcpdump -X


but this not only shows the data but also the header. Is there a possibility to only get the data of the tcp-Package ?
 
Old 09-13-2007, 07:21 AM   #5
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
I just tried a quick grep on your original command and I didn't seem to have any issues.
 
Old 09-13-2007, 07:33 AM   #6
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Original Poster
Rep: Reputation: 32
i get

Quote:
2007-09-14 04:30:01.242109 IP xxxxxxx > xxxxx.1056: P 38963:39009(46) ack 1 win 4096
0x0000: 4500 0056 1fda 0000 3c06 0d78 0a0a 14ee E..V....<..x....
0x0010: 0a28 2831 0fa3 0420 6463 aa6e aaa2 9a4d .((1....dc.n...M
0x0020: 5018 1000 894b 0000 4558 3030 3034 3830 P....K..EX000480
0x0030: 3030 3038 3638 3130 3139 3030 3030 3030 0008681019000000
0x0040: 3030 3030 3030 3430 3239 3030 3030 3030 0000004029000000

and i want

Quote:
EX0004800008681019000000
 
Old 09-13-2007, 07:58 AM   #7
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
That's isolating the last column and stripping the newline characters, no?
Code:
grep -v ^2007 | awk '{print $10}' | tr -d '\n'

Last edited by win32sux; 09-13-2007 at 08:00 AM.
 
Old 09-13-2007, 09:09 AM   #8
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Original Poster
Rep: Reputation: 32
Yes,

that would be it, nearly, as I need to seperate the different packages, which would begin with 'EX'.

But I think i can add that cr/lf before the 'EX'.

Thanks so far!
 
Old 09-13-2007, 08:44 PM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by saavik View Post
that would be it, nearly, as I need to seperate the different packages, which would begin with 'EX'.

But I think i can add that cr/lf before the 'EX'.
Yeah, sounds like a job for sed, I think. Let us know how it goes!
 
Old 09-18-2007, 05:34 AM   #10
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Hi saavik. Just wondering how it went with this. Did you use sed?
 
  


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
can i use netcat as ethreal mallikk_in Linux - Networking 1 05-17-2007 02:05 PM
Netcat s0n|k Linux - Newbie 3 04-16-2006 05:16 PM
netcat question overbored Linux - Software 13 10-30-2004 04:26 PM
Netcat question igor8 Linux - Security 3 06-21-2004 12:55 PM
Anyone Familiar With Netcat ? Santorres Linux - Software 0 07-10-2003 06:27 PM

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

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