Python Bypass Valve

Новичок
Статус
Оффлайн
Регистрация
7 Фев 2024
Сообщения
1
Реакции[?]
1
Поинты[?]
1K
Python:
import ctypes
import struct


def find_offsets(pattern, game_module):
    memory_view = ctypes.string_at(game_module, 0x100000)
    offset = memory_view.find(pattern)

    if offset != -1:
        address = game_module + offset
        return address
    else:
        return None


def bypass_valve_anti_cheat():

    game_module = ctypes.windll.kernel32.GetModuleHandleA(None)

    client_state_pattern = b"\x8B\x35\x00\x00\x00\x00\x8B\x0D\x00\x00\x00\x00"
    game_directory_pattern = b"\x8D\x8E\x00\x00\x00\x00\x50\xE8\x00\x00\x00\x00"
    map_directory_pattern = b"\x8D\x8E\x00\x00\x00\x00\x50\xE8\x00\x00\x00\x00"
    server_ip_pattern = b"\x8B\x35\x00\x00\x00\x00\x8B\x0D\x00\x00\x00\x00"
    server_port_pattern = b"\x8B\x35\x00\x00\x00\x00\x8B\x0D\x00\x00\x00\x00"

    client_state_address = find_offsets(client_state_pattern, game_module)
    game_directory_address = find_offsets(game_directory_pattern, game_module)
    map_directory_address = find_offsets(map_directory_pattern, game_module)
    server_ip_address = find_offsets(server_ip_pattern, game_module)
    server_port_address = find_offsets(server_port_pattern, game_module)

    game_directory = ctypes.wstring_at(game_directory_address)
    map_directory = ctypes.wstring_at(map_directory_address)
    server_ip = struct.unpack('<I', ctypes.string_at(server_ip_address, 4))[0]
    server_port = struct.unpack(
        '<H', ctypes.string_at(server_port_address, 2))[0]

    # Print the read values
    print("Game Directory:", game_directory)
    print("Map Directory:", map_directory)
    print("Server IP:", server_ip)
    print("Server Port:", server_port)

    new_game_directory = game_directory + "_bypass"
    new_map_directory = map_directory + "_bypass"
    new_server_ip = "127.0.0.1"
    new_server_port = 27015

    ctypes.memmove(game_directory_address, new_game_directory.encode(
        'utf-16-le'), len(new_game_directory) * 2)
    ctypes.memmove(map_directory_address, new_map_directory.encode(
        'utf-16-le'), len(new_map_directory) * 2)
    ctypes.memmove(server_ip_address, struct.pack(
        '<I', int(server_ip_address.IPv4Address(new_server_ip))), 4)
    ctypes.memmove(server_port_address, struct.pack('<H', new_server_port), 2)


bypass_valve_anti_cheat()
C++ Variant:

Код:
#include <iostream>
#include <string>
#include <vector>
#include <windows.h>

std::vector<unsigned char> search_pattern(const std::vector<unsigned char>& pattern, HANDLE hProcess) {
    std::vector<unsigned char> result;
    MEMORY_BASIC_INFORMATION mbi;
    unsigned char* p = nullptr;

    for (p = nullptr; VirtualQueryEx(hProcess, p, &mbi, sizeof(mbi)) == sizeof(mbi); p += mbi.RegionSize) {
        if (mbi.State == MEM_COMMIT && (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_EXECUTE_READWRITE)) {
            std::vector<unsigned char> buffer(mbi.RegionSize);
            SIZE_T bytesRead;

            if (ReadProcessMemory(hProcess, p, &buffer[0], mbi.RegionSize, &bytesRead)) {
                for (size_t i = 0; i < bytesRead - pattern.size(); ++i) {
                    if (std::equal(pattern.begin(), pattern.end(), buffer.begin() + i)) {
                        result.insert(result.end(), p + i, p + i + pattern.size());
                    }
                }
            }
        }
    }

    return result;
}

void bypass_valve_anti_cheat() {
    HANDLE hProcess = GetCurrentProcess();

    // Define the patterns to search for
    std::vector<unsigned char> client_state_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };
    std::vector<unsigned char> game_directory_pattern = { 0x8D, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x50, 0xE8, 0x00, 0x00, 0x00, 0x00 };
    std::vector<unsigned char> map_directory_pattern = { 0x8D, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x50, 0xE8, 0x00, 0x00, 0x00, 0x00 };
    std::vector<unsigned char> server_ip_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };
    std::vector<unsigned char> server_port_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };

 
    std::vector<unsigned char> client_state_address = search_pattern(client_state_pattern, hProcess);
    std::vector<unsigned char> game_directory_address = search_pattern(game_directory_pattern, hProcess);
    std::vector<unsigned char> map_directory_address = search_pattern(map_directory_pattern, hProcess);
    std::vector<unsigned char> server_ip_address = search_pattern(server_ip_pattern, hProcess);
    std::vector<unsigned char> server_port_address = search_pattern(server_port_pattern, hProcess);

    std::string game_directory(reinterpret_cast<char*>(&game_directory_address[0]));
    std::string map_directory(reinterpret_cast<char*>(&map_directory_address[0]));
    DWORD server_ip = *reinterpret_cast<DWORD*>(&server_ip_address[0]);
    WORD server_port = *reinterpret_cast<WORD*>(&server_port_address[0]);

    std::cout << "Game Directory: " << game_directory << std::endl;
    std::cout << "Map Directory: " << map_directory << std::endl;
    std::cout << "Server IP: " << server_ip << std::endl;
    std::cout << "Server Port: " << server_port << std::endl;


    std::string new_game_directory = game_directory + "_bypass";
    std::string new_map_directory = map_directory + "_bypass";
    std::string new_server_ip = "127.0.0.1";
    WORD new_server_port = 27015;

    WriteProcessMemory(hProcess, &game_directory_address[0], new_game_directory.c_str(), new_game_directory.size() + 1, nullptr);
    WriteProcessMemory(hProcess, &map_directory_address[0], new_map_directory.c_str(), new_map_directory.size() + 1, nullptr);
    WriteProcessMemory(hProcess, &server_ip_address[0], &new_server_ip, new_server_ip.size() + 1, nullptr);
    WriteProcessMemory(hProcess, &server_port_address[0], &new_server_port, sizeof(new_server_port), nullptr);
}

int main() {
    bypass_valve_anti_cheat();

    return 0;
}
Work no work idk
 
Пользователь
Статус
Оффлайн
Регистрация
25 Мар 2021
Сообщения
149
Реакции[?]
68
Поинты[?]
25K
я вообще не вижу смысла что-то байпасить в этой игре, хватит нормального црц, и правильной логики действий аттаки(это к примеру)
 
Новичок
Статус
Оффлайн
Регистрация
29 Май 2024
Сообщения
1
Реакции[?]
0
Поинты[?]
0
Чуток Исправлю код на c++

Код:
#include <windows.h>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>

// Функция для поиска паттерна в памяти
uintptr_t find_offsets(const std::vector<BYTE>& pattern, uintptr_t module_base) {
    // Прочитать участок памяти
    MEMORY_BASIC_INFORMATION mbi;
    BYTE* memory = reinterpret_cast<BYTE*>(module_base);
    size_t memory_size = 0x100000; // Ограничим область поиска

    // Поиск паттерна в памяти
    for (size_t i = 0; i < memory_size - pattern.size(); ++i) {
        bool found = true;
        for (size_t j = 0; j < pattern.size(); ++j) {
            if (memory[i + j] != pattern[j] && pattern[j] != 0x00) {
                found = false;
                break;
            }
        }
        if (found) {
            return module_base + i;
        }
    }
    return 0; // Не найдено
}

// Функция для обхода Valve Anti-Cheat
void bypass_valve_anti_cheat() {
 
    HMODULE game_module = GetModuleHandleA(nullptr);
    if (!game_module) {
        std::cerr << "Не удалось получить дескриптор модуля." << std::endl;
        return;
    }

 
    std::vector<BYTE> client_state_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };
    std::vector<BYTE> game_directory_pattern = { 0x8D, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x50, 0xE8, 0x00, 0x00, 0x00, 0x00 };
    std::vector<BYTE> map_directory_pattern = { 0x8D, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x50, 0xE8, 0x00, 0x00, 0x00, 0x00 };
    std::vector<BYTE> server_ip_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };
    std::vector<BYTE> server_port_pattern = { 0x8B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 };

  
    uintptr_t client_state_address = find_offsets(client_state_pattern, reinterpret_cast<uintptr_t>(game_module));
    uintptr_t game_directory_address = find_offsets(game_directory_pattern, reinterpret_cast<uintptr_t>(game_module));
    uintptr_t map_directory_address = find_offsets(map_directory_pattern, reinterpret_cast<uintptr_t>(game_module));
    uintptr_t server_ip_address = find_offsets(server_ip_pattern, reinterpret_cast<uintptr_t>(game_module));
    uintptr_t server_port_address = find_offsets(server_port_pattern, reinterpret_cast<uintptr_t>(game_module));

    if (!game_directory_address || !map_directory_address || !server_ip_address || !server_port_address) {
        std::cerr << "Не удалось найти один или несколько паттернов." << std::endl;
        return;
    }

  
    wchar_t game_directory[256];
    wchar_t map_directory[256];
    memcpy(game_directory, reinterpret_cast<void*>(game_directory_address), sizeof(game_directory));
    memcpy(map_directory, reinterpret_cast<void*>(map_directory_address), sizeof(map_directory));

    DWORD server_ip;
    memcpy(&server_ip, reinterpret_cast<void*>(server_ip_address), sizeof(DWORD));

    WORD server_port;
    memcpy(&server_port, reinterpret_cast<void*>(server_port_address), sizeof(WORD));

    // Вывод значений
    std::wcout << L"Game Directory: " << game_directory << std::endl;
    std::wcout << L"Map Directory: " << map_directory << std::endl;
    std::cout << "Server IP: " << (server_ip & 0xFF) << "." << ((server_ip >> 8) & 0xFF) << "."
              << ((server_ip >> 16) & 0xFF) << "." << ((server_ip >> 24) & 0xFF) << std::endl;
    std::cout << "Server Port: " << server_port << std::endl;

  
    std::wstring new_game_directory = std::wstring(game_directory) + L"_bypass";
    std::wstring new_map_directory = std::wstring(map_directory) + L"_bypass";
    DWORD new_server_ip = inet_addr("127.0.0.1");
    WORD new_server_port = 27015;

    memcpy(reinterpret_cast<void*>(game_directory_address), new_game_directory.c_str(), new_game_directory.size() * sizeof(wchar_t));
    memcpy(reinterpret_cast<void*>(map_directory_address), new_map_directory.c_str(), new_map_directory.size() * sizeof(wchar_t));
    memcpy(reinterpret_cast<void*>(server_ip_address), &new_server_ip, sizeof(DWORD));
    memcpy(reinterpret_cast<void*>(server_port_address), &new_server_port, sizeof(WORD));
}

int main() {
    bypass_valve_anti_cheat();
    return 0;
}
 
Сверху Снизу