Pushok icon

Bunny Hop Source Code

Pushok | PRO | 08/02/11 06:31:32 PM UTC | 0 ⭐ | 1732 👁️ | Never ⏰ | []
C++ |

7.52 KB

|

None

|

0 👍

/

0 👎

#include <windows.h>
#include <Tlhelp32.h>
#include "resource.h"
#include <process.h>
 
#include "COffset.h"
 
#define VIP_Version
 
//#define HWID_Scan
//#define HWID_Text L"{f7da1740-0aad-11e0-8ad9-806d6172696f}"
 
#define WM_APP_NCALLBACK WM_USER + 1
 
#define WM_TRAY_EXIT WM_USER + 2
#define WM_TRAY_ABOUT WM_USER + 3
 
#define ABOUT_MESSAGE L"Programm by Push.\nMy steam: http://steamcommunity.com/id/pushad"
#define ABOUT_CAPTION L"About"
 
inline void DoJump(DWORD Delay)
{
    keybd_event(VK_SPACE, 0x39, KEYEVENTF_EXTENDEDKEY, VIRTUAL_KEY);
    Sleep(Delay);
    keybd_event(VK_SPACE, 0x39, KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP, VIRTUAL_KEY);
}
 
struct OFFSETS
{
    DWORD Offset;
    LPWSTR szModuleName;
} sOffsetData[] = {
 
    {0x5B8C38, L"client.dll"}, // On Ground
    {0x570250, L"client.dll"}, // In Game
    {0x5B6234, L"client.dll"}, // In Water // Obsolete
    {0x4DCA0, L"vgui2.dll"}, // Chat overlay
    {0x5BC088, L"client.dll"} // Server
 
};
 
HINSTANCE g_hInst = nullptr;
HHOOK Hook =        nullptr;
HWND hThisWindow =  nullptr;
HWND hCSWindow =    nullptr;
HANDLE hCSProc =    nullptr;
DWORD dwProcID =    NULL;
static volatile bool KeyState =     false;
 
COffset *OnGround, *InGame, *InWater, *ChatOverlay;
CStringOffset *IpAddress;
 
bool IsIpInBlackList(const char* szServerIP)
{
    return strstr(szServerIP, "77.220.180.246")
        || strstr(szServerIP, "77.220.182.59")
        || strstr(szServerIP, "77.220.182.57")
        || strstr(szServerIP, "77.220.182.71")
        || strstr(szServerIP, "77.220.182.73")
        || strstr(szServerIP, "77.220.182.58")
        || strstr(szServerIP, "77.220.180.58")
        || strstr(szServerIP, "77.220.182.70")
        || strstr(szServerIP, "77.220.180.217")
        || strstr(szServerIP, "77.220.180.17")
        || strstr(szServerIP, "77.220.180.132")
        || strstr(szServerIP, "77.220.180.236")
        || strstr(szServerIP, "77.220.180.243")
        || strstr(szServerIP, "77.220.182.75")
        || strstr(szServerIP, "77.220.180.247")
        || strstr(szServerIP, "77.220.180.227")
        || strstr(szServerIP, "77.220.180.220")
        || strstr(szServerIP, "77.220.180.225")
        || strstr(szServerIP, "77.220.180.123")
        || strstr(szServerIP, "77.220.180.100")
        || strstr(szServerIP, "77.220.182.211");
}
 
DWORD WINAPI KBThread( LPVOID lParam )
{
    static bool bJumpDone = false;
 
    while(KeyState)
    {
 
        if(!bJumpDone && OnGround->ReadThis() != -1)
        {
            DoJump(2);
 
            bJumpDone = true;
        }
 
        if(OnGround->ReadThis() == -1)
        {
            bJumpDone = false;
        }
 
        Sleep(5);
    }
 
    return 0;
}
 
LRESULT CALLBACK HookKBD(int nCode, WPARAM wParam, LPARAM lParam) 
{
    if(!FindWindow(0, L"Counter-Strike Source") || hCSWindow != FindWindow(0, L"Counter-Strike Source"))
    {
        MessageBox(nullptr, L"Open or reboot CS:S", nullptr, MB_OK);
 
        SendMessage(hThisWindow, WM_DESTROY, NULL, NULL);
        return 0;
    }
 
    if(InGame->ReadThis() && !ChatOverlay->ReadThis())
    { 
#ifndef VIP_Version
        if (IsIpInBlackList(IpAddress->ReadString()))
        {
            SendMessage(hThisWindow, WM_DESTROY, NULL, NULL);
            return 0;
        }
#endif
 
        if (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN)
        {
            if(reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam)->vkCode == VK_SPACE && reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam)->dwExtraInfo != VIRTUAL_KEY && !KeyState)
            {
                KeyState = true;
                HANDLE hThread = CreateThread(0, 0, KBThread, 0, CREATE_SUSPENDED, 0);
                 
                SetPriorityClass(hThread, HIGH_PRIORITY_CLASS);
                ResumeThread(hThread);
            }
        }
        else if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP)
        {
            if(reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam)->vkCode == VK_SPACE && reinterpret_cast<PKBDLLHOOKSTRUCT>(lParam)->dwExtraInfo != VIRTUAL_KEY)
            {
                if(KeyState)
                {
                    KeyState = false;
                }
            }
        }
    }
 
    //return  0;
    return CallNextHookEx(NULL, nCode, wParam, lParam);
}
 
LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch(msg)
    {
    case WM_CREATE:
        {
#ifdef HWID_Scan
            HW_PROFILE_INFO hwProfile;
 
            if(GetCurrentHwProfile(&hwProfile) != NULL)
            {
                if(wcscmp(HWID_Text, hwProfile.szHwProfileGuid))
                {
                    SendMessage(hwnd, WM_DESTROY, 0, 0);
                }
            }
            else
            {
                SendMessage(hwnd, WM_DESTROY, 0, 0);
            }
#endif
 
            NOTIFYICONDATA l_nfData;
 
            l_nfData.cbSize = sizeof(l_nfData.cbSize);
            l_nfData.hWnd = hwnd;
            l_nfData.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_BUNNY));
            l_nfData.uID = 1;
            l_nfData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
            l_nfData.uCallbackMessage = WM_APP_NCALLBACK;
            wcscpy_s(l_nfData.szTip, L"Bunny Hop programm by Push.");
 
            Shell_NotifyIcon(NIM_ADD, &l_nfData);
 
            hCSWindow = FindWindow(0, L"Counter-Strike Source");
 
            if(!hCSWindow)
            {
                MessageBox(0, L"First open CS:S!", 0, MB_OK);
                SendMessage(hwnd, WM_DESTROY, 0, 0);
                break;
            }
            
            GetWindowThreadProcessId( hCSWindow, &dwProcID );
            hCSProc = OpenProcess( PROCESS_VM_READ, false, dwProcID);
 
            if(!hCSProc)
            {
                MessageBox(0, L"Can't open CS:S process!", 0, MB_OK);
                SendMessage(hwnd, WM_DESTROY, 0, 0);
                break;
            }
 
            OnGround = new COffset(hCSProc, dwProcID, sOffsetData[0].szModuleName, sOffsetData[0].Offset);
            InGame = new COffset(hCSProc, dwProcID, sOffsetData[1].szModuleName, sOffsetData[1].Offset);
            InWater = new COffset(hCSProc, dwProcID, sOffsetData[2].szModuleName, sOffsetData[2].Offset);
            ChatOverlay = new COffset(hCSProc, dwProcID, sOffsetData[3].szModuleName, sOffsetData[3].Offset);
 
            IpAddress = new CStringOffset(hCSProc, dwProcID, sOffsetData[4].szModuleName, sOffsetData[4].Offset);
 
            hThisWindow = hwnd;
            break;
        }
    case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
            case WM_TRAY_ABOUT:
                {
                    MessageBox(0, ABOUT_MESSAGE, ABOUT_CAPTION, MB_OK);
 
                    break;
                }
            case WM_TRAY_EXIT:
                {
                    if(MessageBox(0, L"Are you sure?", L"Exit", MB_OKCANCEL) == IDOK)
                    {
                        PostQuitMessage(0);
                    }
 
                    break;
                }
            }
 
            break;
        }
    case WM_APP_NCALLBACK:
        {
            switch( lParam )
            {
            case WM_RBUTTONDOWN:
                {
                    POINT pt;
                    GetCursorPos(&pt);
 
                    HMENU hPopupMenu = CreatePopupMenu();
                    InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, WM_TRAY_EXIT, L"Exit");
                    InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, WM_TRAY_ABOUT, L"About");
 
                    TrackPopupMenu(hPopupMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
                    DestroyMenu(hPopupMenu);
                    
                    break;
                }
            }
 
            break;
        }
    case WM_DESTROY:
        {
            delete OnGround;
            delete InGame;
            delete InWater;
            delete ChatOverlay;
 
            delete IpAddress;
 
            PostQuitMessage(0);
            break;
        }
    default:
        return DefWindowProc(hwnd, msg, wParam, lParam);
    }
}
 
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
 
    g_hInst = hInstance;
 
    //Hook = SetWindowsHookEx(WH_GETMESSAGE, HookKBD, g_hInst, 0);
    Hook = SetWindowsHookEx(WH_KEYBOARD_LL, HookKBD, hInstance, 0);
 
 
    MSG  msg;
    WNDCLASS wc = {0};
 
    wc.lpszClassName = L"Bunny Hop";
    wc.hInstance     = hInstance ;
    wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
    wc.lpfnWndProc   = WndProc ;
    wc.hCursor       = LoadCursor(0, IDC_ARROW);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU1);
    wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_BUNNY));
 
    RegisterClass(&wc);
    HWND hWnd = CreateWindow( wc.lpszClassName, L"Bunny Hop",
        WS_OVERLAPPEDWINDOW ^ ~WS_VISIBLE,
        0, 0, 0, 0, 0, 0, hInstance, 0);
 
    while (GetMessage(&msg,NULL,0,0))
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
 
    UnhookWindowsHookEx(Hook);
 
    return 0;
}

Comments