Hi I need help with something, I want to log the packets that are sent from the game.
I have done a hook, and it seems to be working well.
The thing is, when I try to read it from a txt file, I see some unique letters and such.
So I figured I have to convert the second perameter of the send function from Winsock.dll to hex.
How can I achive this?
This is my fake function:
Code:
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
fopen_s(&pSendLogFile, "C:\\SendLog.txt", "a+");
fprintf(pSendLogFile, "%s - %d\n", buf, len);
fclose(pSendLogFile);
return pSend(s, buf, len, flags);
}
I think I succeeded.
Code:
std::string displayText;
char buffer[32];
unsigned short nStrLength;
short j;
//-----------------------
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
displayText = "";
for (j = 0; j < len; j++)
{
sprintf_s(buffer, "%0.2X", buf[j]);
nStrLength = strlen(buffer);
displayText.push_back(buffer[nStrLength-2]);
displayText.push_back(buffer[nStrLength-1]);
displayText.push_back(' ');
}
displayText.pop_back();
fopen_s(&pSendLogFile, "C:\\SendLog.txt", "a+");
fprintf(pSendLogFile, "%s", displayText);
fprintf(pSendLogFile, " - %d\n", len);
fclose(pSendLogFile);
return pSend(s, buf, len, flags);
}
Found it on the web.