Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 05:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ hook wsasend und wsarecv

Discussion on C++ hook wsasend und wsarecv within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
C++ hook wsasend und wsarecv

Habe eine funktion bei der ich falls ich ein packet kriege eine MessageBox bekomme jedoch kriege ich nix und die packete laufen zwischen server und client weiter.

Detours direkt will ich nicht nutzen da Hackshield es vermutlich erkennen würde.




Klappt aber nicht wo ist der fehler
vitalka is offline  
Old 01/20/2012, 22:50   #2
 
elite*gold: 0
Join Date: Nov 2009
Posts: 343
Received Thanks: 45
Test mal in Olly ob die Funktionen aufgerufen werden. Dann schreib den Name richtig "WSASend"! Weiß nicht ob er das als Fehler anerkennt( Hier hastes korrigiert, auf cpg noch nicht ). Ansonsten good job c&p :P
yihaaa is offline  
Old 01/20/2012, 22:56   #3
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
Kann nicht auf den Prozess zugreifen da er durch Hackshield geschützt ist
vitalka is offline  
Old 01/20/2012, 23:01   #4
 
elite*gold: 0
Join Date: Nov 2009
Posts: 343
Received Thanks: 45
Dann teste es doch bei einem Programm was nicht geschützt ist, ob da der hook richtig ausgeführt wird. Dann siehst du ja ob es an deinem Code liegt oder du noch andere Sachen in dem geschützten Programm verändern musst.
yihaaa is offline  
Old 01/21/2012, 00:55   #5
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Welch ein Wunder, dass c&p code nicht geht
MoepMeep is offline  
Old 01/22/2012, 11:25   #6
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
Da es bei mir nun mit dem Detour funktioniert bin ich bei einem neuen problem undzwar habe ich schon vor dem hooken eine connection gemacht die auf mein bot connectet soweit das connecten klappt und bin gerade senden dran hier habe ich die send funktion gehooked, er send pro hook recv und send ein packet nach meinem bot dann stürzt das game mit fehlermeldung von windows ab. Habe dann auchmal ein anderes programm was kein HS hat, da kam der gleiche fehler. Wo ist das prob:

Quote:
// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <winsock2.h>

#pragma comment(lib,"ws2_32.lib")

using namespace std;

typedef int ( WINAPI *realConnect )(SOCKET s, const struct sockaddr* name, int namelen );
typedef int (WINAPI* realRecv)(SOCKET socket, const char* buffer, int length, int flags);
typedef int (WINAPI* realSend)(SOCKET socket, const char* buffer, int length, int flags);

realSend o_send;
realRecv o_recv;
realConnect o_connect;

SOCKET Bot;
SOCKADDR_IN addr;


int WINAPI my_connect( SOCKET s, const struct sockaddr* name, int namelen)
{
WORD port = ntohs((*(WORD*)name->sa_data));
sockaddr_in *sockaddr = (sockaddr_in*)name;
sockaddr->sin_port = htons(16000);
if ( port != 80 )
{
sockaddr->sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
}
return o_connect(s,name,namelen);
}

int WINAPI my_send(SOCKET socket, const char* buffer, int length, int flags)
{
send(Bot, buffer, length, flags);
return o_send(socket, buffer, length, flags);
}

int WINAPI my_recv(SOCKET socket, const char* buffer, int length, int flags)
{
send(Bot, buffer, length, flags);
return o_recv(socket, buffer, length, flags);
}

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
//Socketpart
WSADATA wsa;
WSAStartup(MAKEWORD(2,2), &wsa);

Bot=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
memset(&addr,0,sizeof(SOCKADDR_IN)); // zuerst alles auf 0 setzten
addr.sin_family=AF_INET;
addr.sin_port=htons(16000);
addr.sin_addr.s_addr=inet_addr("127.0.0.1");

short status;
status=connect(Bot,(SOCKADDR*)(&addr),sizeof(addr) );
if (status==SOCKET_ERROR)
{
MessageBox(NULL, TEXT("Bot dont exists"), TEXT("Error"), MB_OK);
exit(0);
}
/////////////////////////////////////////////////////
HMODULE hWS32 = LoadLibraryA( "ws2_32.dll" );
FARPROC pConnect = GetProcAddress(hWS32,"connect");
FARPROC pSend = GetProcAddress(hWS32,"send");
FARPROC pRecv = GetProcAddress(hWS32,"recv");
//DetourCreate((LPVOID)pConnect,my_connect,5);
//__asm mov [ o_connect ], eax;
DetourCreate((LPVOID)pSend,my_send,5);
__asm mov [ o_send ], eax;
DetourCreate((LPVOID)pRecv,my_recv,5);
__asm mov [ o_recv ], eax;
break;
}
return true;
}

vitalka is offline  
Old 01/22/2012, 12:14   #7
 
xNopex's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 827
Received Thanks: 471
Quote:
undzwar habe ich schon vor dem hooken eine connection gemacht die auf mein bot connectet soweit das connecten klappt und bin gerade senden dran hier habe ich die send funktion gehooked, er send pro hook recv und send ein packet nach meinem bot dann stürzt das game mit fehlermeldung von windows ab

Semantik

Das was du hier laberst macht semantisch und syntaktisch keinen Sinn.

EDIT: Und Code einrücken. Dieses erbrochene Etwas will sich kein Mensch durchlesen.
xNopex is offline  
Thanks
1 User
Old 01/22/2012, 12:21   #8
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
Entweder ich kriege ich hilfe oder eben nicht sowas kannst du dir echt sparen, genau solche Vögel wie dich kann ich nicht gebrauchen, es ist nicht die Section hilfe bei meinen Grammatikfehlern etc. also spars dir.
vitalka is offline  
Old 01/22/2012, 12:24   #9
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Quote:
Originally Posted by vitalka View Post
Entweder ich kriege ich hilfe oder eben nicht sowas kannst du dir echt sparen, genau solche Vögel wie dich kann ich nicht gebrauchen, es ist nicht die Section hilfe bei meinen Grammatikfehlern etc. also spars dir.
Und solche Vögel mit C&P code wollen wir hier nicht, machn Abflug ;o
MoepMeep is offline  
Old 01/22/2012, 12:41   #10
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
oh man kinder ja dann viel spass ihr vögel untereinander wer spricht von c&p
vitalka is offline  
Old 01/22/2012, 12:44   #11
 
Dr. Coxxy's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 1,206
Received Thanks: 736
code ordentlich einrücken, dann seh ich vllt mal drüber und geb dir nen stups in die richtige richtung... - vielleicht.

EDIT:
und einheitlichen codestyle bitte.
Dr. Coxxy is offline  
Old 01/22/2012, 13:02   #12
 
vitalka's Avatar
 
elite*gold: 0
Join Date: May 2007
Posts: 160
Received Thanks: 23
Quote:
Originally Posted by Dr. Coxxy View Post
code ordentlich einrücken, dann seh ich vllt mal drüber und geb dir nen stups in die richtige richtung... - vielleicht.

EDIT:
und einheitlichen codestyle bitte.
bin absoluter c++ anfänger schreibe normal in c# daher happerts da noch ein wenig
vitalka is offline  
Old 01/23/2012, 09:35   #13
 
xNopex's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 827
Received Thanks: 471
Rückt man in C# jetzt nichtmehr ein?
xNopex is offline  
Old 01/23/2012, 13:17   #14
 
Dr. Coxxy's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 1,206
Received Thanks: 736
anscheinend nicht bei c&p code, der im forum wo er es her hat leider (aufgrund der unfähigkeit des urhebers code tags zu benutzen) seine einrückung verloren hat.
Dr. Coxxy is offline  
Reply


Similar Threads Similar Threads
C++ hook wsarecv and wsasend
01/23/2012 - SRO Coding Corner - 3 Replies
Hey guys i dont know why my source doesnt work. Whats the mistake? #include "stdio.h" #include "winsock2.h" #include "windows.h" #include <iostream> #include <commctrl.h> #include <time.h>
[Help] WSARecv Hook
08/26/2011 - General Coding - 8 Replies
Ich hooke mit Microsoft's Detour Library die Funktion WSASend & WSARecv. Die Packet-Auswertung erfolgt bei WSASend ohne Probleme, aber bei WSARecv kommen oft nur 0'en an. Weiß jemand vielleicht warum?
<26.06.11> Chico™ Public Hook, //Invisible//Chams /Stamina/Mini Hook/NO CRASH VERSION
07/08/2011 - WarRock Hacks, Bots, Cheats & Exploits - 46 Replies
26.06.11 Hack Released 26.06.11 SuperNoSpread Problem Fixxen Status= Not in Hack Hej Com, leider hab ich eine schlechte nachricht xP^^ aus egendeinen Grund verursacht bei mir SuperNoSpread einen Direkten Crash sobald man in game ist, deshalb habe ich es entfernt O,o der Hack ist tortzdem nett und wird euch gefallen, sobald ich mehr addys habe kommen mehrere funktionen noch dazu ;) http://img4.fotos-hochladen.net/uploads/public24e lfvtrw1u.png STOP! VOR DEM DOWNLOAD! Mit Dem...
WSAsend/WSABUF
08/14/2009 - General Coding - 2 Replies
hiho =) i'm reversing a mmo which uses WSAsend to send it's packets WSASend Function (Windows) as you can see the parameter lpBuffers holds the adress to an array of WSABUF structs WSABUF Structure (Windows) ..which contains length and data i'm trying to read the data of wsabuf -> but this differs from my parallel collected packet in WPE ->only the size of the packet is correct, the rest is rubbish =/



All times are GMT +1. The time now is 05:29.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.