Go Back   BWHacks > Development > Programming

Programming General non-hacking related programming.

Reply
 
LinkBack Thread Tools

Old 09-04-2008, 08:04 PM   #1 (permalink)
feng
Mortal
 
Join Date: Sep 2008
Posts: 9
feng is on a distinguished road
Default how to hook recv in Warcraft3

I'm new in hooking socket api and i had managed to hook send, sendto and recvfrom with modify IAT table, However i can't hook the recv.I find recv entrypoint is 0x71a42e70, but it can't make work, anyone can share tips or codes that managed to hook recv in warcraft 3?thanks!
feng 15 0FF11|\|3   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links


Old 09-04-2008, 09:32 PM   #2 (permalink)
MiCrOz
Senior Member

Blessed
 
MiCrOz's Avatar
 
Join Date: Aug 2005
Location: Cherry Hill, NJ
Posts: 2,517
MiCrOz is just really niceMiCrOz is just really nice
Send a message via AIM to MiCrOz
Default

Maybe if you didn't make two threads of this, AND post the same question in another thread, I'd help you.
__________________

Quote:
Originally Posted by DarthSlyGuy View Post
Your opinion DOES NOT count for anything on these forums. This isn't a democracy on these forums its a 'dt'ocracy/dictatorship and us staff are his officers.
Quote:
Originally Posted by 1a2a3a View Post
hey Zynastor~ can you release [a fix] for apocalypse too please?


MiCrOz 15 0FF11|\|3   Reply With Quote

Old 09-05-2008, 05:15 AM   #3 (permalink)
feng
Mortal
 
Join Date: Sep 2008
Posts: 9
feng is on a distinguished road
Icon1 sorry

sorry, I first time coming here,when i post that question, Internet speed is very slow,so i make a mistake ,post this in two thread.i sincere hope to know why result in can't hook the recv in war3.can you telll me?
feng 15 0FF11|\|3   Reply With Quote

Old 09-05-2008, 06:29 PM   #4 (permalink)
Dyndrilliac

Enlightened
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,586
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via AIM to Dyndrilliac Send a message via MSN to Dyndrilliac Send a message via Yahoo to Dyndrilliac
Default

If hooking via modifying the IAT isn't working, implement inline hooking (google is your friend). And Microz doesn't know anything, so don't get too worked up if he claims he wont help, or you're SOL.

One of the better API hooking topics on BWH: Trying to create a hook that hooks send(..) in WS2_32.dll
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.
Dyndrilliac 15 0FF11|\|3   Reply With Quote

Old 09-05-2008, 06:53 PM   #5 (permalink)
feng
Mortal
 
Join Date: Sep 2008
Posts: 9
feng is on a distinguished road
Default

thanks ,I'will have a try!
feng 15 0FF11|\|3   Reply With Quote

Old 09-05-2008, 08:12 PM   #6 (permalink)
devINVISIBLE
Mortal
 
Join Date: Aug 2008
Posts: 6
devINVISIBLE is on a distinguished road
Default

Check out @http://research.microsoft.com/sn/detours/. They've done a nice job with their injection library.

Mathias Rauen ("Madshi") also has a pretty sweet library for hooking. I believe it's the library WC3Banlist decided to use. You can find more info at @http://help.madshi.net/madCodeHook.htm. This page gives you a nice run-down of some different ways you can hook a method: @http://help.madshi.net/ApiHookingMethods.htm

Last edited by devINVISIBLE : 09-05-2008 at 08:18 PM.
devINVISIBLE 15 0FF11|\|3   Reply With Quote

Old 09-06-2008, 02:40 PM   #7 (permalink)
feng
Mortal
 
Join Date: Sep 2008
Posts: 9
feng is on a distinguished road
Default

thanks all,I have sloved my problem! In war3, it uses 4 socketApi :"send,sendto ,WSARecv and WSARecvFrom "!
Code:
their offset address is :	
             mysendJmp.HookOneAPI((PROC)0x71a2428a,(FARPROC)hook_send);
	mysendJmp.SetHookOn();
	mysendtoJmp.HookOneAPI((PROC)0x71a22c69,(FARPROC)hook_sendto);
	mysendtoJmp.SetHookOn();
	mywsarecvfromJmp.HookOneAPI((PROC)0x71a2f652,(FARPROC)hook_wsarecvfrom);
	mywsarecvfromJmp.SetHookOn();
	mywsarecvJmp.HookOneAPI((PROC)0x71a24318,(FARPROC)hook_wsarecv);
	mywsarecvJmp.SetHookOn();
feng 15 0FF11|\|3   Reply With Quote

Old 09-06-2008, 09:06 PM   #8 (permalink)
Zephyrix
Ereetu.
Senior Member
Game Hacking Staff

High Priest
 
Zephyrix's Avatar
 
Join Date: Oct 2005
Location: xor 1D27,1337
Posts: 1,565
Zephyrix is a name known to allZephyrix is a name known to allZephyrix is a name known to allZephyrix is a name known to all
Default

Don't use static addressess..
Use GetProcAddress to get the address.
Something like:
Code:
HANDLE hMod = GetModuleHandle("ws2_32.dll");
        mysendJmp.HookOneAPI(GetProcAddress(hMod, "send"),(FARPROC)hook_send);
	mysendJmp.SetHookOn();
        ...
Otherwise you could be hooking random addresses across different computers.
__________________


Zephyrix 15 0FF11|\|3   Reply With Quote

Old 09-06-2008, 09:57 PM   #9 (permalink)
MiCrOz
Senior Member

Blessed
 
MiCrOz's Avatar
 
Join Date: Aug 2005
Location: Cherry Hill, NJ
Posts: 2,517
MiCrOz is just really niceMiCrOz is just really nice
Send a message via AIM to MiCrOz
Default

Quote:
Originally Posted by Dyndrilliac View Post
And Microz doesn't know anything, so don't get too worked up if he claims he wont help, or you're SOL.
And you assume this because..? Don't assume **** just because I'm not willing to help someone who spams the forums looking for help.
__________________

Quote:
Originally Posted by DarthSlyGuy View Post
Your opinion DOES NOT count for anything on these forums. This isn't a democracy on these forums its a 'dt'ocracy/dictatorship and us staff are his officers.
Quote:
Originally Posted by 1a2a3a View Post
hey Zynastor~ can you release [a fix] for apocalypse too please?


MiCrOz 15 0FF11|\|3   Reply With Quote

Old 09-06-2008, 11:44 PM   #10 (permalink)
Dyndrilliac

Enlightened
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,586
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via AIM to Dyndrilliac Send a message via MSN to Dyndrilliac Send a message via Yahoo to Dyndrilliac
Default

lawlz nub, prove me wrong then.

And FYI, take that petty kiddy BS attitude else where. Go give people ultimatums and troll in the flame board or general chat.
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.
Dyndrilliac 15 0FF11|\|3   Reply With Quote

Old 09-08-2008, 04:37 PM   #11 (permalink)
sd333221

Advocate
 
sd333221's Avatar
 
Join Date: Jul 2007
Posts: 290
sd333221 will become famous soon enough
Default

just use
Code:
hook((DWORD)recv, myrecv);
__________________
sd333221 15 0FF11|\|3   Reply With Quote

Old 09-09-2008, 08:15 AM   #12 (permalink)
ulliklliwi

Disciple
 
ulliklliwi's Avatar
 
Join Date: May 2007
Location: The Code Cave after the JMP Gate
Posts: 545
ulliklliwi has a spectacular aura about
Send a message via MSN to ulliklliwi
Default

PHP Code:
#include <windows.h>
#include <winsock.h>
#include "detours.h"

#pragma comment(lib, "detours.lib")
#pragma comment(lib, "Ws2_32.lib")

typedef int (WINAPItRecv)(SOCKET scharbufint lenint Flag);

    
tRecv oRecv NULL;

DWORD WINAPI SetHooks(LPVOID);
int WINAPI hRecv(SOCKET scharbufint lenint Flag);

BOOL APIENTRY DllMain(HINSTANCE hModuleDWORD  ul_reason_for_callLPVOID lpReserved)
{
    switch(
ul_reason_for_call)
    {
        case 
DLL_PROCESS_ATTACH:
            
CreateThread(00SetHooks000);
        break;
        case 
DLL_PROCESS_DETACH:
        break;
    }
    return 
TRUE;
}
    
// Put me in a Thread;
DWORD WINAPI SetHooks(LPVOID) {
    for (
Sleep(1000); GetModuleHandle("Ws2_32.dll") == NULLSleep(1000))
        continue;

    
oRecv = (tRecv)DetourFunction((PBYTE)RecvhRecv);
}

int WINAPI hRecv(SOCKET scharbufint lenint Flag) {
    
    
// do something b4 you call the RECV
    
int iRet oRecv(sbuflenFlag); // call real function
    // do something after you call RECV
    
return iRet;

Attached Files
File Type: zip detours.zip (65.1 KB, 4 views)

Last edited by ulliklliwi : 09-09-2008 at 07:10 PM.
ulliklliwi 15 0FF11|\|3   Reply With Quote

Old 09-12-2008, 08:34 AM   #13 (permalink)
feng
Mortal
 
Join Date: Sep 2008
Posts: 9
feng is on a distinguished road
Default

thanks a lot!
feng 15 0FF11|\|3   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Advertisement

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to hook recv in Warcraft3 feng Warcraft Hacking Related 5 09-07-2008 10:11 PM
how to get the base adress of a programm Owyn Programming 6 09-04-2008 08:03 PM
Hook recv in Warcraft3 tinman Warcraft Hacking Related 9 11-08-2007 04:41 AM
Trying to create a hook that hooks send(..) in WS2_32.dll sleepster Programming 16 09-13-2006 10:33 AM
Tutorial: The easy way to make a keyboard hook. Dyndrilliac Programming 40 09-07-2006 04:44 PM


All times are GMT. The time now is 01:50 AM.


vBulletin style developed by Transverse Styles

Powered by vBulletin Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright © 2004-2008 BWHacksAd Management by RedTyger