segunda-feira, 13 de agosto de 2012

Anti Shotbot

Porque eu decidi não ser um burro, eu vou liberar o código contra shotbots


Code:
HHOOK MouseHook;

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
 if (nCode == HC_ACTION)
 {
  if(wParam == WM_RBUTTONDOWN || wParam == WM_LBUTTONDOWN)
  {
   MSLLHOOKSTRUCT *info=(MSLLHOOKSTRUCT*)lParam;     
   if((info->flags & LLMHF_INJECTED) == LLMHF_INJECTED)
   {
    ExitProcess(-1);
   }
  }
 }
 return CallNextHookEx(MouseHook,nCode,wParam,lParam);
}


void AntiShotbotLogger()
{
    HINSTANCE hInstance = GetModuleHandle(NULL);

    MouseHook = SetWindowsHookEx( WH_MOUSE_LL, MouseHookProc, hInstance, NULL );
    MSG message;
    while (GetMessage(&message,NULL,0,0)) {
        TranslateMessage( &message );
        DispatchMessage( &message );
    }

    UnhookWindowsHookEx(MouseHook);
    return;
}
Criar um thread para logger antishotbot.
Graças WizKid para apontar a função que eu tinha que usar.
Obrigado, Google para obter informações sobre WH_MOUSE_LL.

Para os usuários de código:

Criar antishotbot.cpp:

Code:
#include "StdAfx.h"

HHOOK MouseHook;

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
 if (nCode == HC_ACTION)
 {
  if(wParam == WM_RBUTTONDOWN || wParam == WM_LBUTTONDOWN)
  {
   MSLLHOOKSTRUCT *info=(MSLLHOOKSTRUCT*)lParam;     
   if((info->flags & LLMHF_INJECTED) == LLMHF_INJECTED)
   {
    ExitProcess(-1);
   }
  }
 }
 return CallNextHookEx(MouseHook,nCode,wParam,lParam);
}


void AntiShotbotLogger()
{
    HINSTANCE hInstance = GetModuleHandle(NULL);

    MouseHook = SetWindowsHookEx( WH_MOUSE_LL, MouseHookProc, hInstance, NULL );
    MSG message;
    while (GetMessage(&message,NULL,0,0)) {
        TranslateMessage( &message );
        DispatchMessage( &message );
    }

    UnhookWindowsHookEx(MouseHook);
    return;
}
Go to main.cpp in the gunz solution and add:
Code:
//Don't put this inside a function, Do it like somewhere at the top (Like line 96 or so)
        void AntiShotbotLogger();
//Put this on line 197 under InitialLoading success
 CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AntiShotbotLogger, 0, 0, 0);

For the DLL users:
Code:
#include <windows.h>

HHOOK MouseHook;

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
 if (nCode == HC_ACTION)
 {
  if(wParam == WM_RBUTTONDOWN || wParam == WM_LBUTTONDOWN)
  {
   MSLLHOOKSTRUCT *info=(MSLLHOOKSTRUCT*)lParam;     
   if((info->flags & LLMHF_INJECTED) == LLMHF_INJECTED)
   {
    ExitProcess(-1);
   }
  }
 }
 return CallNextHookEx(MouseHook,nCode,wParam,lParam);
}


void AntiShotbotLogger()
{
    HINSTANCE hInstance = GetModuleHandle(NULL);

    MouseHook = SetWindowsHookEx( WH_MOUSE_LL, MouseHookProc, hInstance, NULL );
    MSG message;
    while (GetMessage(&message,NULL,0,0)) {
        TranslateMessage( &message );
        DispatchMessage( &message );
    }

Creditos:Gunblade

0 comentários:

Postar um comentário