Click here to Skip to main content
15,878,970 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to create a program that monitors incoming packets to a certain process. Each incoming packet needs to be searched for a string of hex (e.g. FF 00 00 03) and modified to be null (e.g. 00 00 00 00). Or, if it's easier, to just completely block the packet from coming through.
I currently have a console app that monitors packets from the whole machine, in and out. But, I can't figure out how to read the whole packet, It's just reading the header info, any ideas? I'm using WinPcap to do this at the moment. I don't know if WinPcap can modify packets or search them though, I've only seen it used to filter packets by IP or protocol, not by the actual content itself. Does anyone know how to do this? If you need my source code please tell and I'll post it.
Posted
Updated 6-May-10 9:49am
v3

I used the Microsoft Detours to hook the send/recv functions of a process and run all data through my application before sending through the target process.
 
Share this answer
 
I suggest writing your own driver since if i am not mistaken WinpCap is not capable of modifying packets. (you can read the contents of the packet though check the WinPcap documentation or one of the open source projects that use WinpCap)

If you take my suggestion and attempt to write a driver, the first thing you should do is get a hold of the Latest WDK (windows driver development kit, i am assuming your targeting the NT platform), you will probably need to write an NDIS Protocol Driver combined with an NDIS intermediate driver


Good Luck!!

D, Kurt.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900