Open Source CS2 Basic İnjector

Teox09

Diamond Üye
Katılım
6 Tem 2026
Mesajlar
704
Beğeniler
185
C++:
#include <windows.h>
#include <iostream>
#include <string>
#include <shellapi.h>
#include <tlhelp32.h>
#include <commdlg.h>

#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "comdlg32.lib")
#pragma comment(lib, "shell32.lib")

void SetConsoleTitleAndColor() {
    SetConsoleTitleW(L"cs2 injector");
}

std::wstring SelectDLLFile() {
    OPENFILENAMEW ofn;
    wchar_t szFile[MAX_PATH] = { 0 };

    ZeroMemory(&ofn, sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = NULL;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile) / sizeof(wchar_t);
    ofn.lpstrFilter = L"DLL Dosyalari (*.dll)\0*.dll\0Tum Dosyalar (*.*)\0*.*\0";
    ofn.nFilterIndex = 1;
    ofn.lpstrFileTitle = NULL;
    ofn.nMaxFileTitle = 0;
    ofn.lpstrInitialDir = NULL;
    ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;

    if (GetOpenFileNameW(&ofn) == TRUE) {
        return std::wstring(ofn.lpstrFile);
    }
    return L"";
}

bool EnableDebugPrivilege() {
    HANDLE hToken;
    TOKEN_PRIVILEGES tp;
    LUID luid;

    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
        return false;

    if (!LookupPrivilegeValueW(nullptr, L"SeDebugPrivilege", &luid)) {
        CloseHandle(hToken);
        return false;
    }

    tp.PrivilegeCount = 1;
    tp.Privileges[0].Luid = luid;
    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    if (!AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr)) {
        CloseHandle(hToken);
        return false;
    }

    CloseHandle(hToken);
    return true;
}

DWORD GetProcessIdByName(const wchar_t* processName) {
    PROCESSENTRY32W entry;
    entry.dwSize = sizeof(PROCESSENTRY32W);

    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
    if (snapshot == INVALID_HANDLE_VALUE) return 0;

    if (Process32FirstW(snapshot, &entry)) {
        do {
            if (_wcsicmp(entry.szExeFile, processName) == 0) {
                CloseHandle(snapshot);
                return entry.th32ProcessID;
            }
        } while (Process32NextW(snapshot, &entry));
    }
    CloseHandle(snapshot);
    return 0;
}

bool InjectProcess(DWORD processId, const std::wstring& dllPath) {
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
    if (!hProcess) return false;

    SIZE_T dllPathSize = (dllPath.size() + 1) * sizeof(wchar_t);
    LPVOID pRemoteBuf = VirtualAllocEx(hProcess, nullptr, dllPathSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    if (!pRemoteBuf) {
        CloseHandle(hProcess);
        return false;
    }

    if (!WriteProcessMemory(hProcess, pRemoteBuf, dllPath.c_str(), dllPathSize, nullptr)) {
        VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
        CloseHandle(hProcess);
        return false;
    }

    LPVOID pLoadLibrary = (LPVOID)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "LoadLibraryW");
   
    HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)pLoadLibrary, pRemoteBuf, 0, nullptr);
    if (!hThread) {
        VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
        CloseHandle(hProcess);
        return false;
    }

    WaitForSingleObject(hThread, INFINITE);

    DWORD exitCode = 0;
    GetExitCodeThread(hThread, &exitCode);

    VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
    CloseHandle(hThread);
    CloseHandle(hProcess);
   
    // Eger exitCode 0 ise LoadLibraryW basarisiz olmustur (NULL donmustur)
    return exitCode != 0;
}

int main() {
    EnableDebugPrivilege();
    SetConsoleOutputCP(CP_UTF8);
    SetConsoleTitleAndColor();

    std::cout << "==================================================\n";
    std::cout << "               cs2 injector                       \n";
    std::cout << "==================================================\n\n";

    std::cout << "[*] Lutfen acilan pencereden enjekte edilecek DLL dosyasini secin..." << std::endl;

    std::wstring dllPath = SelectDLLFile();

    if (dllPath.empty()) {
        std::cout << "[-] Herhangi bir DLL secilmedi. Cikis yapiliyor..." << std::endl;
        Sleep(2000);
        return 1;
    }

    DWORD fileAttr = GetFileAttributesW(dllPath.c_str());
    if (fileAttr == INVALID_FILE_ATTRIBUTES) {
        std::cout << "[-] Secilen DLL dosyasi bulunamadi!" << std::endl;
        Sleep(2000);
        return 1;
    }

    int size_needed = WideCharToMultiByte(CP_UTF8, 0, dllPath.c_str(), -1, NULL, 0, NULL, NULL);
    std::string utf8Path(size_needed, 0);
    WideCharToMultiByte(CP_UTF8, 0, dllPath.c_str(), -1, &utf8Path[0], size_needed, NULL, NULL);
    if (!utf8Path.empty() && utf8Path.back() == '\0') utf8Path.pop_back();

    std::cout << "\n[+] Secilen DLL: " << utf8Path << std::endl;
   
    std::cout << "[*] CS2 Steam uzerinden -insecure parametresiyle baslatiliyor..." << std::endl;
   
    // Oyunu Steam uzerinden -insecure komutuyla baslatir
    ShellExecuteW(NULL, L"open", L"steam://rungameid/730//-insecure/", NULL, NULL, SW_SHOWNORMAL);
   
    std::cout << "[*] Oyunun acilmasi bekleniyor..." << std::endl;
   
    DWORD pid = 0;
    while (pid == 0) {
        pid = GetProcessIdByName(L"cs2.exe");
        Sleep(1000);
    }
   
    std::cout << "[+] Oyun bulundu! (PID: " << pid << ")" << std::endl;
    std::cout << "[*] Oyunun tamamen yuklenmesi ve menunun gelmesi icin 15 saniye bekleniyor..." << std::endl;
   
    // Oyunun arka planda grafik motorunu ve bilesenlerini yuklemesini bekliyoruz
    for(int i = 15; i > 0; i--) {
        std::cout << "\r[*] Kalan sure: " << i << " saniye... " << std::flush;
        Sleep(1000);
    }
    std::cout << "\n[*] Enjeksiyon basliyor..." << std::endl;

    if (InjectProcess(pid, dllPath)) {
        std::cout << "[+] BASARILI! Hile oyuna enjekte edildi. Oyuna donup kontrol edebilirsiniz." << std::endl;
    }
    else {
        std::cout << "[-] HATA! Enjeksiyon basarisiz oldu. (Oyun guvenlik duvarina/VAC korumasina takilmis olabilir)" << std::endl;
    }

    std::cout << "\nCikmak icin bir tusa basin...";
    system("pause >nul");
    return 0;
}
 
C++:
#include <windows.h>
#include <iostream>
#include <string>
#include <shellapi.h>
#include <tlhelp32.h>
#include <commdlg.h>

#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "comdlg32.lib")
#pragma comment(lib, "shell32.lib")

void SetConsoleTitleAndColor() {
    SetConsoleTitleW(L"cs2 injector");
}

std::wstring SelectDLLFile() {
    OPENFILENAMEW ofn;
    wchar_t szFile[MAX_PATH] = { 0 };

    ZeroMemory(&ofn, sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = NULL;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile) / sizeof(wchar_t);
    ofn.lpstrFilter = L"DLL Dosyalari (*.dll)\0*.dll\0Tum Dosyalar (*.*)\0*.*\0";
    ofn.nFilterIndex = 1;
    ofn.lpstrFileTitle = NULL;
    ofn.nMaxFileTitle = 0;
    ofn.lpstrInitialDir = NULL;
    ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;

    if (GetOpenFileNameW(&ofn) == TRUE) {
        return std::wstring(ofn.lpstrFile);
    }
    return L"";
}

bool EnableDebugPrivilege() {
    HANDLE hToken;
    TOKEN_PRIVILEGES tp;
    LUID luid;

    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
        return false;

    if (!LookupPrivilegeValueW(nullptr, L"SeDebugPrivilege", &luid)) {
        CloseHandle(hToken);
        return false;
    }

    tp.PrivilegeCount = 1;
    tp.Privileges[0].Luid = luid;
    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    if (!AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr)) {
        CloseHandle(hToken);
        return false;
    }

    CloseHandle(hToken);
    return true;
}

DWORD GetProcessIdByName(const wchar_t* processName) {
    PROCESSENTRY32W entry;
    entry.dwSize = sizeof(PROCESSENTRY32W);

    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
    if (snapshot == INVALID_HANDLE_VALUE) return 0;

    if (Process32FirstW(snapshot, &entry)) {
        do {
            if (_wcsicmp(entry.szExeFile, processName) == 0) {
                CloseHandle(snapshot);
                return entry.th32ProcessID;
            }
        } while (Process32NextW(snapshot, &entry));
    }
    CloseHandle(snapshot);
    return 0;
}

bool InjectProcess(DWORD processId, const std::wstring& dllPath) {
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
    if (!hProcess) return false;

    SIZE_T dllPathSize = (dllPath.size() + 1) * sizeof(wchar_t);
    LPVOID pRemoteBuf = VirtualAllocEx(hProcess, nullptr, dllPathSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    if (!pRemoteBuf) {
        CloseHandle(hProcess);
        return false;
    }

    if (!WriteProcessMemory(hProcess, pRemoteBuf, dllPath.c_str(), dllPathSize, nullptr)) {
        VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
        CloseHandle(hProcess);
        return false;
    }

    LPVOID pLoadLibrary = (LPVOID)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "LoadLibraryW");
   
    HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)pLoadLibrary, pRemoteBuf, 0, nullptr);
    if (!hThread) {
        VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
        CloseHandle(hProcess);
        return false;
    }

    WaitForSingleObject(hThread, INFINITE);

    DWORD exitCode = 0;
    GetExitCodeThread(hThread, &exitCode);

    VirtualFreeEx(hProcess, pRemoteBuf, 0, MEM_RELEASE);
    CloseHandle(hThread);
    CloseHandle(hProcess);
   
    // Eger exitCode 0 ise LoadLibraryW basarisiz olmustur (NULL donmustur)
    return exitCode != 0;
}

int main() {
    EnableDebugPrivilege();
    SetConsoleOutputCP(CP_UTF8);
    SetConsoleTitleAndColor();

    std::cout << "==================================================\n";
    std::cout << "               cs2 injector                       \n";
    std::cout << "==================================================\n\n";

    std::cout << "[*] Lutfen acilan pencereden enjekte edilecek DLL dosyasini secin..." << std::endl;

    std::wstring dllPath = SelectDLLFile();

    if (dllPath.empty()) {
        std::cout << "[-] Herhangi bir DLL secilmedi. Cikis yapiliyor..." << std::endl;
        Sleep(2000);
        return 1;
    }

    DWORD fileAttr = GetFileAttributesW(dllPath.c_str());
    if (fileAttr == INVALID_FILE_ATTRIBUTES) {
        std::cout << "[-] Secilen DLL dosyasi bulunamadi!" << std::endl;
        Sleep(2000);
        return 1;
    }

    int size_needed = WideCharToMultiByte(CP_UTF8, 0, dllPath.c_str(), -1, NULL, 0, NULL, NULL);
    std::string utf8Path(size_needed, 0);
    WideCharToMultiByte(CP_UTF8, 0, dllPath.c_str(), -1, &utf8Path[0], size_needed, NULL, NULL);
    if (!utf8Path.empty() && utf8Path.back() == '\0') utf8Path.pop_back();

    std::cout << "\n[+] Secilen DLL: " << utf8Path << std::endl;
   
    std::cout << "[*] CS2 Steam uzerinden -insecure parametresiyle baslatiliyor..." << std::endl;
   
    // Oyunu Steam uzerinden -insecure komutuyla baslatir
    ShellExecuteW(NULL, L"open", L"steam://rungameid/730//-insecure/", NULL, NULL, SW_SHOWNORMAL);
   
    std::cout << "[*] Oyunun acilmasi bekleniyor..." << std::endl;
   
    DWORD pid = 0;
    while (pid == 0) {
        pid = GetProcessIdByName(L"cs2.exe");
        Sleep(1000);
    }
   
    std::cout << "[+] Oyun bulundu! (PID: " << pid << ")" << std::endl;
    std::cout << "[*] Oyunun tamamen yuklenmesi ve menunun gelmesi icin 15 saniye bekleniyor..." << std::endl;
   
    // Oyunun arka planda grafik motorunu ve bilesenlerini yuklemesini bekliyoruz
    for(int i = 15; i > 0; i--) {
        std::cout << "\r[*] Kalan sure: " << i << " saniye... " << std::flush;
        Sleep(1000);
    }
    std::cout << "\n[*] Enjeksiyon basliyor..." << std::endl;

    if (InjectProcess(pid, dllPath)) {
        std::cout << "[+] BASARILI! Hile oyuna enjekte edildi. Oyuna donup kontrol edebilirsiniz." << std::endl;
    }
    else {
        std::cout << "[-] HATA! Enjeksiyon basarisiz oldu. (Oyun guvenlik duvarina/VAC korumasina takilmis olabilir)" << std::endl;
    }

    std::cout << "\nCikmak icin bir tusa basin...";
    system("pause >nul");
    return 0;
}
es
 
loadlıbrary ise kullanmamda gene elıne saglık
 
Değerli Yorumunuz İçin Teşekkür Ederim.
es cs için denicem bi ara
Değerli Yorumunuz İçin Teşekkür Ederim.FeedBack'inizi Beklerim.
Değerli Yorumunuz İçin Teşekkür Ederim.
loadlıbrarymı bu
Evet LoadLibrary Method Kullanmaktadır.
loadlıbrary ise kullanmamda gene elıne saglık
Değerli Yorumunuz İçin Teşekkür Ederim.
 
Değerli Yorumunuz İçin Teşekkür Ederim.

Değerli Yorumunuz İçin Teşekkür Ederim.FeedBack'inizi Beklerim.

Değerli Yorumunuz İçin Teşekkür Ederim.

Evet LoadLibrary Method Kullanmaktadır.

Değerli Yorumunuz İçin Teşekkür Ederim.
rica
 

Şuanda konuyu görüntüleyen kullanıcılar

Geri
Üst Alt