C++ winsock hooking

c++ / delphi package - dll injection and api hooking

C++ winsock hooking

Postby behelit » Tue May 18, 2004 9:44 am

could you use madcodehook to hook/inject another process and use that processes winsock send method/s
behelit
 
Posts: 4
Joined: Tue May 18, 2004 6:40 am

Postby madshi » Wed May 19, 2004 9:55 am

That is possible, but it sounds "bad" to me. Please use madCodeHook only for legal projects! :-x
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby nildo » Wed May 19, 2004 3:47 pm

madshi wrote:That is possible, but it sounds "bad" to me. Please use madCodeHook only for legal projects! :-x


Not at all the time.
If you have a socket openned in another process, and if you want to send a Buffer by this Openned Socket, you can not do in our own process, we need to inject a DLL and send messages to the DLL recognize this.

If it is what you want, so you dont need to inject a DLL. Just use the API DuplicateHandle and passing the SocketID as the source parameter, then you could call SEND or RECV (whatever) in your own process.
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby behelit » Sun May 23, 2004 1:55 am

its not "bad" if its a process you made

that api is perfect thx for the help
but how would you get the socket descriptor
behelit
 
Posts: 4
Joined: Tue May 18, 2004 6:40 am

Postby madshi » Sun May 23, 2004 6:58 am

If the other process is your own, then I take that "bad" word back... :D

Okay, could you tell us a bit more about why one of your processes wants to use the socket functions of another of your processes? Why can't you implement the socket functions in both processes?

Anyway, there are several possibilities:

(1) Either the non-socket process can ask the socket process to send data for it. You can use SendMessage to send the request or madCodeHook's SendIpcMessage.

(2) Or the non-socket process can copy the socket's process socket (that's nildo's suggestion). Not sure how/whether this works, since I'm not socket expert at all!

(3) Or the non-socket process could execute a function in the context of the socket process (e.g. by using madRemote's RemoteExecute).

(4) Or the non-socket process could inject a dll into the socket process which could then do the sending.
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby behelit » Mon May 24, 2004 12:10 pm

it was something my brother made
ive wanted to learn hooks for awhile so this was a good chance to start
would madshi or someone be able to write a small tutorial on how to use madcodehook even if it has nothing to do with socks
behelit
 
Posts: 4
Joined: Tue May 18, 2004 6:40 am

Postby nildo » Mon May 24, 2004 12:14 pm

Look at HELP and DEMOS.
They will help a lot.
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Mon May 24, 2004 12:21 pm

Yep, nildo is right. Some of the demos are pretty easy to understand and I did my best to document them well. Together with the documentation it should hopefully get you going.
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby behelit » Thu May 27, 2004 9:40 am

hmm the help page is all in delphi code
behelit
 
Posts: 4
Joined: Tue May 18, 2004 6:40 am

Postby nildo » Thu May 27, 2004 11:38 am

Delphi to C++ and C++ to Delphi is easy to translate... The HELP shows the teory and How to use. See the Demos for examples of use
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am


Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 2 guests