Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Trace/track socket messages

0
mgazza
Asked:
mgazza
1 Solution
 
stzizzaCommented:
First off let me say this can't be done easily in Delphi. Mainly because if you want to do this right you would have to right a kernel mode driver which can't be done with Delphi. That being said you have a few options (depending on the platforms you wish to excecute your code on) . You could write an NDIS driver which would perform all raw network IO, refer to Windows NT or 2000 DDK. You could also write an NDIS intermediate driver or NDIS filter driver that sits between the NDIS protocol driver and the NIC adapters driver (this actually hooks  jump events in NDIS's drivers protocol table) eg. replaces the jump address for fx xyz with its own. Finally you could use a TDI filter which uses the NT legacy interface for TDI.  

Your next option would be to write a User Level "hook" using the Winsock Layered Sercvise Provider (LSP) search for this in the MS Platform SDK I think there is an example you could implement in Delphi. Next you could use the Windows 2K packet filtering protocol to do this I have an example in C from the WDJ if you would like. Next you could replace the Winsock layer with your own implementation of the winsock.dll where you could filter out packets. This would be tedious but could be done. You would have to write a dll that reproduced all the exports from winsock and where you would do your stuff then load the real dll say winsock2.dll passing the parameters verbetum as they would be passed to you.

Finally and the option I suggest is to find a component (try torry.net) that wrappers an NDIS dirver with events that are linked to call backs or something like this I've seen a few. Here is an ocx link - Ive seen a vcl link but can't remember it. Also check out project Jedi they have an IPHelper wrapper for low level ip programming.
http://www.datawizard.net/Free_Software/SocketView_Free/ socketview_free.htm
0
 
mgazzaAuthor Commented:
i found what i want in c++ but i dont think it lets me sink or swim the packers or read them but it does alow me to know when a packet has been read

http://www.mgazzasodft.150m.com/Downloads/NetHook.zip
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now