Sorry fürs Pushen wollte jetzt aber kein neuen Thread aufmachen.
Ich wollte mich jetzt auch mal mit packets usw auseinander setzen und hab mehrere Fragen und wäre euch sehr verbunden wenn ihr sie ohne irgendwelche blöden Kommentare beantworten könnten.
Erstmal hab ich folgenden Beitrag im Internet gefunden der mir sehr geholfen hab zudem ich aber eine Frage habe:
Quote:
|
Look at WS2_32.dll in Depends.exe, load it in to IDA Pro or something similar. Most of the time you will want to hook send(), recv(), for TCP, and sendto() and recvfrom() for UDP. But some times other calls are used. In particular WSASend() for example. You should really see "call chains" with these if you really want to make some universal capture. Look in IDA Pro to figure the chains out then you can just hook the root functions. Most games use TCP for main packets
|
Woher weiß ich hab ich send() oder WSASend() benutzen muss? Das gleiche für recv?
Muss ich das in Olly oder so heraufinden?
So und meine zweite Frage ist, was falsch an folgendem Source code ist?
Ich wollte mal die WSA_Recv func hooken testweise aber der compiler spuckt mir errors aus der winsock2.h raus, hier der Source:
Code:
#include <Windows.h>
#include <detours.h>
#include <winsock2.h>
#pragma comment(lib, "detours.lib")
typedef int (WINAPI *WSA_recv) (SOCKET, LPWSABUF , DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE );
WSA_recv Recv_original = NULL;
int WINAPI Recv_hook(SOCKET s,LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd,LPDWORD lpFlags,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
{
return Recv_original( s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine);
}
BOOL APIENTRY DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
Recv_original = (WSA_recv)DetourFunction((PBYTE)&WSARecv, (PBYTE)&Recv_hook);
break;
}
return true;
}
Lg!
Edit:
Sorry, hier die Compilerfehler:
Quote:
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2304): error C2375: 'WSASetBlockingHook': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(889): Siehe Deklaration von 'WSASetBlockingHook'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2321): error C2375: 'WSACancelBlockingCall': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(891): Siehe Deklaration von 'WSACancelBlockingCall'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2343): error C2375: 'WSAAsyncGetServByName': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(893): Siehe Deklaration von 'WSAAsyncGetServByName'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2370): error C2375: 'WSAAsyncGetServByPort': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(901): Siehe Deklaration von 'WSAAsyncGetServByPort'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2396): error C2375: 'WSAAsyncGetProtoByName': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(909): Siehe Deklaration von 'WSAAsyncGetProtoByName'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2421): error C2375: 'WSAAsyncGetProtoByNumber': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(916): Siehe Deklaration von 'WSAAsyncGetProtoByNumber'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2446): error C2375: 'WSAAsyncGetHostByName': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(923): Siehe Deklaration von 'WSAAsyncGetHostByName'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2473): error C2375: 'WSAAsyncGetHostByAddr': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(930): Siehe Deklaration von 'WSAAsyncGetHostByAddr'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2496): error C2375: 'WSACancelAsyncRequest': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(939): Siehe Deklaration von 'WSACancelAsyncRequest'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock2.h(2517): error C2375: 'WSAAsyncSelect': Neudefinition; unterschiedliche Bindung
1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winsock.h(941): Siehe Deklaration von 'WSAAsyncSelect
|