• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 5 of 5
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iVision's Avatar
      Join Date
      Jun 2012
      Posts
      17
      Thanks (-->)
      0
      Thanks (<--)
      0

      Receiving nothing when hooking

      Silent VPN
      Hey, I followed the tutorial from hooking. But there is problem, only the send hook does it thing. While receiving is just plain/empty:
      Receiving nothing when hooking

      Here is the full code :
      Code:
      #include &lt;Windows.h&gt;
      #include &lt;Winsock.h&gt;
      #include "detours.h"
      
      #pragma comment (lib, "detours.lib")
      #pragma comment (lib, "ws2_32.lib")
      
      using namespace std;
      
      int (__stdcall *send_o)(__in SOCKET s, __in const char *buf, __in int len, __in int flags);
      int (__stdcall *recv_o)(__in SOCKET s, __out const char *buf, __in int len, __in int flags);
      char logBuffer[4096] = "\0";
      
      int __stdcall send_h(__in SOCKET s, __in const char *buf, __in int len, __in int flags)
      {
      	strcat(logBuffer, "Sent:\n");
      	strcat(logBuffer, buf);
      	
        return send_o(s, buf, len, flags);
      }
      
      int __stdcall recv_h(__in SOCKET s, __out const char *buf, __in int len, __in int flags)
      {
      	strcat(logBuffer, "Receive:\n");
      	strcat(logBuffer, buf);
      
        return recv_o(s, buf, len, flags);
      }
      
      DWORD WINAPI HookApi(LPVOID lpParam)
      {
      	HANDLE h_adrSend = GetProcAddress(GetModuleHandle("ws2_32.dll"), "send");	
      	HANDLE h_adrRecv = GetProcAddress(GetModuleHandle("ws2_32.dll"), "recv");
      	if (h_adrSend)
      		send_o = (int (__stdcall *)( __in SOCKET s, __in const char *buf, __in int len, __in int flags ))DetourFunction((PBYTE)h_adrSend,(PBYTE)send_h);
      		
      	if (h_adrRecv)
      	  recv_o = (int (__stdcall *)( __in SOCKET s, __out const char *buf, __in int len, __in int flags ))DetourFunction((PBYTE)h_adrRecv,(PBYTE)recv_h);
      		
      	WSADATA      wsaData;
        SOCKET       sock;
        SOCKADDR_IN    servAddr;
        int        nPort = 1111;
      
        //Initialize winsock 2.2
        WSAStartup(MAKEWORD(2, 2), &amp;wsaData);
      
        //Create socket to connect
        sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
      
        //Initialize SocketAddress
        servAddr.sin_family = AF_INET;
        servAddr.sin_port = htons(nPort);
        servAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
      
        //Connect to our server
        connect(sock, (sockaddr *)&amp;servAddr, sizeof(servAddr));
      
      	while (true)
      	{
      		if (logBuffer[0] != '\0')
      		{
      			send_o(sock, logBuffer, strlen(logBuffer), NULL);
      			logBuffer[0] = '\0';
      			Sleep(200);
      		}
      	}
      	return 0;
      }
      
      BOOL APIENTRY DllMain (HINSTANCE hInst,DWORD reason,LPVOID reserved)   
      {
      	if (reason == DLL_PROCESS_ATTACH)
      	{
      		DisableThreadLibraryCalls(hInst);
      		CreateThread(0,0,HookApi,0,0,NULL);
      
      		return true;
      	}
      
      	return TRUE;
      }
      btw I inject this into the msn process.

      Regards
      Proud to be Dutch, excuse my English.

    2. #2
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      konsowa's Avatar
      Join Date
      May 2012
      Posts
      184
      Thanks (-->)
      1
      Thanks (<--)
      2
      Did u check if it uses the recv function or are u doing this and just hoping the process uses this function?

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iVision's Avatar
      Join Date
      Jun 2012
      Posts
      17
      Thanks (-->)
      0
      Thanks (<--)
      0
      I was just hoping, but do you mean that its likely using WSARecv or other methods for receiving? Is there a way to see that? Maybe with olly and see the api calls?
      Edit: he calls the recv function otherwisethat shouldn't be called I think.
      Proud to be Dutch, excuse my English.

    4. #4
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      konsowa's Avatar
      Join Date
      May 2012
      Posts
      184
      Thanks (-->)
      1
      Thanks (<--)
      2
      Yes open olly and attach it to msn and open the main module(msn.exe) and then right click and select search for referenced text then all modular cells and search for the recv function..

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iVision's Avatar
      Join Date
      Jun 2012
      Posts
      17
      Thanks (-->)
      0
      Thanks (<--)
      0
      Silent VPN
      Well after opening some other dlls from msn I came across with this:
      Receiving nothing when hooking
      It uses recv and recvfrom also it uses send and sendto. But I thought the from/to versions of receive/send are for the DGRAM protocol?
      Is it possible that is uses the recv to check whether something is going to be received and then use the recvfrom that contains the data that is send?
      Well I just check out and post my results to get some tips/ideas
      Proud to be Dutch, excuse my English.

    Similar Game Hacker Threads

    1. [Tutorial] VEH Hooking (aka PageGuard Hooking) - An In-depth Look
      By Zuva in forum Game Hacking Tutorials
      Replies: 7
      Last Post: 08-02-2016, 01:02 PM
    2. [Help] Hooking D3D
      By lukaluka in forum GH Tutorials Help
      Replies: 4
      Last Post: 07-21-2015, 03:46 PM
    3. [Help] D3D Hooking
      By Solaire in forum Direct-X, OpenGL
      Replies: 3
      Last Post: 10-25-2014, 06:45 PM
    4. OpenGL Hooking ( Mac-OSX)
      By NTvalk in forum Direct-X, OpenGL
      Replies: 3
      Last Post: 03-07-2014, 12:54 PM
    5. [Tutorial] vTable Hooking / VMT hooking
      By c5 in forum Game Hacking Tutorials
      Replies: 4
      Last Post: 11-06-2013, 12:25 AM