Solved

Capturing network packets for use in userland application - TCPDUMP?

Posted on 2003-12-09
2
277 Views
Last Modified: 2010-03-18
Hi,

I want to be able to capture packets from my network to use as input for a program i am writing. the program will dessimate the packet and use different parts of it so i need the packet in a usable format.  Can i do this with TCPDUMP?  I tried with  tcpdump -x -s 0 -i lo -w pkt -c 1, but the output from pkt looked like

\324\303\262\241^B^@^D^@^@^@^@^@^@^@^@^@\377^@^@^A^@^@^@\327Y\326?\254.^K^@W

etc

the full output cut & pastes like

Ôò¡

Any pointers?
0
Comment
Question by:dtod
2 Comments
 
LVL 2

Accepted Solution

by:
asbharadwaj earned 120 total points
ID: 9910253
Hi
>> i need the packet in a usable format
What do u exactly have in mind?

the -w option causes tcpdump to dump the raw packets to the specified file and exit
You can directly redirect the output of tcpdump to a file and read it later on in your
program
The -v option gives you verbose output and the -vv option gives you even more verbose output

You can also read the packet information from the dump file you generated using the -w
option
inorder to do that you'll have to use the -r filename option.
Your program needs to have a good understanding of the protocol it is looking for
to make good use of the tcpdump output
you'll also have to do a lot of string processing if your program is written in C or something like that
whereas a program written in something like perl will find a lot easier for this purpose

refer the tcpdump man page for more options
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9913968
tcpdump write packets in a *usable* format. Dot.
The problem seems to be that *your* definition of usable is different to that from tcpdump.
So you first need to define, means: tell us, what a usable format is for you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
*STABLE* and free Linux Firewall distribution 6 81
linux / python expert needed 3 88
Open BDS Pf 3 48
App holding yum lock unable to update my rpm package 1 37
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now