LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 11-14-2008, 11:06 AM   #1
shreks
Member
 
Registered: Aug 2004
Posts: 79

Rep: Reputation: 15
Reconstruction of TCP Session from Captured IP Packets


Hi Everyone,

Recently I ran into a problem during the development of a network software that captures IP packages directly from the hub of LAN network and reconstructs these packets into TCP sessions in Unix/Linux. The goal is to able to produce complete data of multiple TCP sessions from captured IP packets. Generated TCP session data tries to match the output of standard socket interface provided by Unix/Linux operating system, e.g. recv() and recvfrom().

Capture of IP packet uses libpcap and reassembly of TCP session uses libnids. However, after several weeks of desperate trials and errors, I found libnids can hardly generate qualified output of TCP session data that can be acquired as conveniently as Unix socket function calls. It looks like the direct output tcp_stream structure from its callback function is raw TCP packets that have to be re-organized to obtain an ordered,complete and non-redundant TCP packet stream for each unique TCP session. And also the seemingly organized internal TCP stream table still generates disordered,overlapped, and even mis-calculated data array in memory for each TCP session at the end of each TCP session determined by NIDS_CLOSE signal.

I know of course users can go straight forward to reconstruct TCP session themselves, but such efforts will involve significant amount of energy to make sure everything works as expected when a large number of TCP packets from multiple sessions are pumped out from data capture engine and they need to be re-created to original TCP sessions correctly and efficiently. Such a task can be daunting for non network programming experts.

Therefore I keep wondering if there exist development tools that usual-level software developer can make use of in their developments. I did some research on web for such tools but the results are not very encouraging.

Any suggestions or comments are warmly welcome! Great appreciations!
 
Old 11-14-2008, 11:27 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,051
Blog Entries: 2

Rep: Reputation: 93
Have you looked at wireshark? You can use it to look at captured packets and it has tools to look at individual tcp and other sessions within the captured packets.
 
Old 11-15-2008, 12:36 AM   #3
shreks
Member
 
Registered: Aug 2004
Posts: 79

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by estabroo View Post
Have you looked at wireshark? You can use it to look at captured packets and it has tools to look at individual tcp and other sessions within the captured packets.
Thanks a lot! I heard of wireshark, a big network analysis tool. I will look into it. By the way, does it have development libraries? Thanks!
 
Old 11-15-2008, 09:08 AM   #4
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,051
Blog Entries: 2

Rep: Reputation: 93
In general I'm sure it does have development libraries cause on debian you can apt-get install wireshark-dev to get them.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing TCP flags in TCP packets on Linux using C !! vishamr2000 Programming 2 10-16-2006 09:46 AM
nslookup: no response, captured 3 "server failure" packets trainpic Linux - Networking 3 02-08-2006 10:14 AM
What is the best way to view data captured in packets with Ethereal? abefroman Linux - Security 4 05-07-2005 01:30 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
tcp packets wedgeworth Linux - Software 7 05-10-2004 04:40 PM


All times are GMT -5. The time now is 10:05 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration