1
0
mirror of synced 2025-02-22 21:19:56 +01:00

Added hook into bind method for winsock, also added 4P Event Mode

This commit is contained in:
nzgamer41 2019-01-09 20:44:41 +13:00
parent 82824e0ce5
commit e52595162d

View File

@ -13,6 +13,8 @@ uintptr_t imageBase;
static unsigned char hasp_buffer[0xD40];
static bool isFreePlay;
static bool isEventMode2P;
static bool isEventMode4P;
const char *ipaddr;
// Data for IC card, Force Feedback etc OFF.
unsigned char settingData[406] = {
@ -204,6 +206,80 @@ unsigned char terminalPackage6_Coin[139] = {
0x00, 0x28, 0x00, 0xBD, 0x07, 0xCF, 0xDC
};
//Event mode 2P
unsigned char terminalPackage1_Event4P[79] = {
0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0xd1, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc1, 0x96, 0xc9, 0x2e
};
unsigned char terminalPackage2_Event4P[139] = {
0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0xd2, 0x0b, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08,
0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38,
0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68,
0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90,
0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd8, 0xc3, 0xd6, 0xe1, 0x05,
0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x91, 0x74, 0xca, 0x1e
};
unsigned char terminalPackage3_Event4P[79] = {
0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0x8d, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x86, 0xb1, 0x27, 0x9e
};
unsigned char terminalPackage4_Event4P[139] = {
0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0x8e, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08,
0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38,
0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68,
0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90,
0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xd9, 0xc3, 0xd6, 0xe1, 0x05,
0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xc2, 0x11, 0x2a, 0x66
};
unsigned char terminalPackage5_Event4P[79] = {
0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0xc9, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0x5d, 0x49, 0x01, 0x1e
};
unsigned char terminalPackage6_Event4P[139] = {
0x01, 0x04, 0x80, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
0x20, 0x00, 0x28, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1a, 0x00, 0x2a, 0x13,
0x08, 0xca, 0x0c, 0x12, 0x0c, 0x32, 0x37, 0x32, 0x32, 0x31, 0x31, 0x39,
0x39, 0x30, 0x30, 0x30, 0x32, 0x18, 0x00, 0x30, 0x00, 0x42, 0x3a, 0x08,
0x01, 0x10, 0x03, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x30, 0x01, 0x38,
0x01, 0x40, 0x01, 0x48, 0x00, 0x50, 0x02, 0x58, 0x60, 0x60, 0x60, 0x68,
0x60, 0x70, 0x60, 0x78, 0x60, 0x80, 0x01, 0x60, 0x88, 0x01, 0x60, 0x90,
0x01, 0x60, 0x98, 0x01, 0x00, 0xa0, 0x01, 0xda, 0xc3, 0xd6, 0xe1, 0x05,
0xa8, 0x01, 0x04, 0xb0, 0x01, 0x24, 0xb8, 0x01, 0x00, 0x4a, 0x08, 0x08,
0x03, 0x10, 0x01, 0x18, 0x00, 0x20, 0x00, 0x52, 0x0b, 0x08, 0x64, 0x10,
0xde, 0x0f, 0x18, 0x05, 0x20, 0x00, 0x28, 0x00, 0xd4, 0x80, 0x16, 0xc2
};
//Event mode 2P
unsigned char terminalPackage1_Event2P[79] = {
0x01, 0x04, 0x44, 0x00, 0x12, 0x0e, 0x0a, 0x00, 0x10, 0x04, 0x18, 0x00,
@ -326,6 +402,27 @@ unsigned int Hook_hasp_write(int hasp_handle, int hasp_fileid, unsigned int offs
return HASP_STATUS_OK;
}
typedef int (WINAPI *BIND)(SOCKET, CONST SOCKADDR *, INT);
BIND pbind = NULL;
unsigned int WINAPI Hook_bind(SOCKET s, const sockaddr *addr, int namelen) {
sockaddr_in bindAddr = { 0 };
bindAddr.sin_family = AF_INET;
bindAddr.sin_addr.s_addr = inet_addr("192.168.96.20");
bindAddr.sin_port = htons(50765);
if (addr == (sockaddr*)&bindAddr) {
sockaddr_in bindAddr2 = { 0 };
bindAddr2.sin_family = AF_INET;
bindAddr2.sin_addr.s_addr = inet_addr(ipaddr);
bindAddr2.sin_port = htons(50765);
return pbind(s, (sockaddr*)&bindAddr2, namelen);
}
else {
return pbind(s, addr, namelen);
}
}
unsigned char saveData[0x2000];
// BASE: 0x24E0
@ -847,7 +944,7 @@ void GenerateDongleData(bool isTerminal)
}
char customName[256];
const char *ipaddr;
static DWORD WINAPI SpamCustomName(LPVOID)
{
@ -923,6 +1020,24 @@ static DWORD WINAPI SpamMulticast(LPVOID)
sizeof(terminalPackage6_Event2P),
};
const uint8_t* byteSequences_Event4P[] = {
terminalPackage1_Event4P,
terminalPackage2_Event4P,
terminalPackage3_Event4P,
terminalPackage4_Event4P,
terminalPackage5_Event4P,
terminalPackage6_Event4P,
};
const size_t byteSizes_Event4P[] = {
sizeof(terminalPackage1_Event4P),
sizeof(terminalPackage2_Event4P),
sizeof(terminalPackage3_Event4P),
sizeof(terminalPackage4_Event4P),
sizeof(terminalPackage5_Event4P),
sizeof(terminalPackage6_Event4P),
};
const uint8_t* byteSequences_Coin[] = {
terminalPackage1_Coin,
terminalPackage2_Coin,
@ -948,24 +1063,34 @@ static DWORD WINAPI SpamMulticast(LPVOID)
isFreePlay = ToBool(config["General"]["FreePlay"]);
isEventMode2P = ToBool(config["General"]["Event2P"]);
isEventMode2P = ToBool(config["TerminalEmuConfig"]["2P Event Mode"]);
isEventMode4P = ToBool(config["TerminalEmuConfig"]["4P Event Mode"]);
if (isFreePlay)
{
while(true) for (int i = 0; i < _countof(byteSequences_Free); i++)
{
sendto(sock, (const char*)byteSequences_Free[i], byteSizes_Free[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
Sleep(8);
if (isEventMode2P) {
while (true) for (int i = 0; i < _countof(byteSequences_Event2P); i++)
{
sendto(sock, (const char*)byteSequences_Event2P[i], byteSizes_Event2P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
Sleep(8);
}
}
else if (isEventMode4P) {
while (true) for (int i = 0; i < _countof(byteSequences_Event4P); i++)
{
sendto(sock, (const char*)byteSequences_Event4P[i], byteSizes_Event4P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
Sleep(8);
}
}
else {
while (true) for (int i = 0; i < _countof(byteSequences_Free); i++)
{
sendto(sock, (const char*)byteSequences_Free[i], byteSizes_Free[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
Sleep(8);
}
}
}
else if (isEventMode2P) {
while (true) for (int i = 0; i < _countof(byteSequences_Event2P); i++)
{
sendto(sock, (const char*)byteSequences_Event2P[i], byteSizes_Event2P[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
Sleep(8);
}
}
while (true) for (int i = 0; i < _countof(byteSequences_Coin); i++)
{
sendto(sock, (const char*)byteSequences_Coin[i], byteSizes_Coin[i], 0, (sockaddr*)&toAddr, sizeof(toAddr));
@ -1043,6 +1168,7 @@ static InitFunction Wmmt5Func([]()
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_encrypt", Hook_hasp_encrypt, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_logout", Hook_hasp_logout, NULL);
MH_CreateHookApi(L"hasp_windows_x64_109906.dll", "hasp_login", Hook_hasp_login, NULL);
MH_CreateHookApi(L"WS2_32", "bind", Hook_bind, reinterpret_cast<LPVOID*>(&pbind));