 |

18.11.2023, 18:23
|
|
Новичок
Регистрация: 27.03.2022
Сообщений: 10
С нами:
2176865
Репутация:
1
|
|
Приветствую всех. Хочу написать .asi для блокировки конкретного айпи, чтобы gta_sa.exe не могла до нее добраться. Прошу о помощи и советах как начать. (Это будет моим первым проектом)
|
|
|

27.11.2023, 04:22
|
|
Познавший АНТИЧАТ
Регистрация: 29.09.2018
Сообщений: 1,292
С нами:
4012500
Репутация:
138
|
|
Похукай функи из винсока по типу getaddrinfo, gethostbyname
|
|
|

29.11.2023, 01:05
|
|
Постоянный
Регистрация: 11.01.2019
Сообщений: 585
С нами:
3862210
Репутация:
118
|
|
Хукнуть отправку подключения к серверу (RakPeer::SendConnectionRequest( const char* host, unsigned short remotePort, char* passwordData, int passwordDataLength ))
(Можно хукнуть и socketlayer, но тогда будет ломаться connectfix)
(Ниже offset под r1)
C++:
Код:
#include
#include
#include "Windows.h"
uintptr_t dwSAMP
=
0xFF
;
void
*
SetCallHook
(
uintptr_t HookAddress
,
void
*
DetourFunction
)
{
uintptr_t OriginalFunction
=
*
reinterpret_cast
(
HookAddress
+
1
)
+
HookAddress
+
5
;
DWORD oldProt
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
PAGE_READWRITE
,
&
oldProt
)
;
*
reinterpret_cast
(
HookAddress
+
1
)
=
reinterpret_cast
(
DetourFunction
)
-
HookAddress
-
5
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
oldProt
,
&
oldProt
)
;
return
reinterpret_cast
(
OriginalFunction
)
;
}
using
SendConnectionRequest
=
bool
(
__fastcall
*
)
(
void
*
,
void
*
,
const
char
*
,
unsigned
short
,
char
*
,
int
)
;
SendConnectionRequest pSendConnectionRequest
=
nullptr
;
int
__fastcall
ConnectionHook
(
void
*
EDX
,
void
*
thats
,
const
char
*
host
,
unsigned
short
remotePort
,
char
*
passwordData
,
int
passwordDataLength
)
{
if
(
!
strncmp
(
host
,
"127.0.0.1"
,
9
)
)
return
0
;
return
pSendConnectionRequest
(
EDX
,
thats
,
host
,
remotePort
,
passwordData
,
passwordDataLength
)
;
}
void
Hooking
(
)
{
pSendConnectionRequest
=
reinterpret_cast
(
SetCallHook
(
dwSAMP
+
0x3CB16
,
&
ConnectionHook
)
)
;
}
BOOL APIENTRY
DllMain
(
HMODULE hModule
,
DWORD ul_reason_for_call
,
LPVOID lpReserved
)
{
switch
(
ul_reason_for_call
)
{
case
DLL_PROCESS_ATTACH
:
{
dwSAMP
=
reinterpret_cast
(
GetModuleHandleA
(
"samp.dll"
)
)
;
std
::
thread
(
Hooking
)
.
detach
(
)
;
break
;
}
}
return
TRUE
;
}
|
|
|

26.12.2023, 18:13
|
|
Новичок
Регистрация: 27.03.2022
Сообщений: 10
С нами:
2176865
Репутация:
1
|
|
Сообщение от atomlin
Хукнуть отправку подключения к серверу (RakPeer::SendConnectionRequest( const char* host, unsigned short remotePort, char* passwordData, int passwordDataLength ))
(Можно хукнуть и socketlayer, но тогда будет ломаться connectfix)
(Ниже offset под r1)
C++:
Код:
#include
#include
#include "Windows.h"
uintptr_t dwSAMP
=
0xFF
;
void
*
SetCallHook
(
uintptr_t HookAddress
,
void
*
DetourFunction
)
{
uintptr_t OriginalFunction
=
*
reinterpret_cast
(
HookAddress
+
1
)
+
HookAddress
+
5
;
DWORD oldProt
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
PAGE_READWRITE
,
&
oldProt
)
;
*
reinterpret_cast
(
HookAddress
+
1
)
=
reinterpret_cast
(
DetourFunction
)
-
HookAddress
-
5
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
oldProt
,
&
oldProt
)
;
return
reinterpret_cast
(
OriginalFunction
)
;
}
using
SendConnectionRequest
=
bool
(
__fastcall
*
)
(
void
*
,
void
*
,
const
char
*
,
unsigned
short
,
char
*
,
int
)
;
SendConnectionRequest pSendConnectionRequest
=
nullptr
;
int
__fastcall
ConnectionHook
(
void
*
EDX
,
void
*
thats
,
const
char
*
host
,
unsigned
short
remotePort
,
char
*
passwordData
,
int
passwordDataLength
)
{
if
(
!
strncmp
(
host
,
"127.0.0.1"
,
9
)
)
return
0
;
return
pSendConnectionRequest
(
EDX
,
thats
,
host
,
remotePort
,
passwordData
,
passwordDataLength
)
;
}
void
Hooking
(
)
{
pSendConnectionRequest
=
reinterpret_cast
(
SetCallHook
(
dwSAMP
+
0x3CB16
,
&
ConnectionHook
)
)
;
}
BOOL APIENTRY
DllMain
(
HMODULE hModule
,
DWORD ul_reason_for_call
,
LPVOID lpReserved
)
{
switch
(
ul_reason_for_call
)
{
case
DLL_PROCESS_ATTACH
:
{
dwSAMP
=
reinterpret_cast
(
GetModuleHandleA
(
"samp.dll"
)
)
;
std
::
thread
(
Hooking
)
.
detach
(
)
;
break
;
}
}
return
TRUE
;
}
Как я понял он провеяет айпи хоста, и если он соотвествует, то полностью блокирует все подключения?
|
|
|
|
 |
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|