Solved

Capturing network packets for use in userland application - TCPDUMP?

Posted on 2003-12-09
2
273 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

18 Experts available now in Live!

Get 1:1 Help Now