L
L
Luchnik222012-07-12 13:14:01
.NET
Luchnik22, 2012-07-12 13:14:01

Socket Hook or how to intercept WS2_32.dll function call on .NET?

There is a certain application (game) which sends TCP/UDP requests. My task is to intercept these requests and * change their direction to another host (computer).

* change their direction - it is necessary that the packet is not sent to the host that it was previously sent to.

I read a bunch of articles on this topic, including this one, but they are all in C ++ or ASMe, are there any ways to implement it in C # (or in any other .NET language)?

PS Implementations of the sniffer, OpenVPN, do not offer network drivers, because they don't fit.
P.S.2. I can't do without pictures. This is to the fact that the picture below carries a small semantic load.

333c972133b8db38e7f6158da19083d0.png

Answer the question

In order to leave comments, you need to log in

5 answer(s)
U
Unhandled_Exception, 2012-07-12
@Unhandled_Exception

Try the BoxedApp SDK for an example of a similar hook in C# (see samples\C#\Sample6_CreateFileHooking).

@
@zzeneg, 2012-07-12
_

In C#, you can use the Win32API with P/Invoke (DllImport).
List of methods in ws2_32.dll - www.pinvoke.net/default.aspx/ws2_32.wsastartup
Ready wrapper class: www.elitepvpers.com/forum/co2-programming/159327-advanced-winsock-c.html

A
Alexander Sulimov, 2012-07-12
@AlexandrDP

host
route
?

G
garrich, 2012-07-12
@garrich

Your conditions explicitly say that you need to intercept the packet and change its direction.
Can you explain why you can't use a locally installed sniffer?

K
kemsky, 2012-07-12
@kemsky

maybe it's easier to edit hosts or twist the dns server?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question