C++ - DLL Injector

Rooster

only business
Legend Member
Katılım
10 Ağu 2019
Konular
727
Mesajlar
3,205
Çözümler
314
Tepkime puanı
4,997
Konum
Milano
RC Point
0
Merhaba Reality Cheats ailesi,
Bugün sizlere C++'da DLL Injector'un source codelerini göstereceğim;

C++ KISMI (.cpp);

Kod:
#include <windows.h>
#include <tlhelp32.h>
#include <shlwapi.h>
#include "realityinjector.h"

#define CREATE_THREAD_ACCESS (PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ)

using namespace std;


string sProcName;
string sDLLName;

DWORD ProcID;
bool InjectSuccess;
bool hasProcID;

string sDLLStatus;
string sProcessStatus;

char* DLLName = NULL;
char* ProcName = NULL;

string sEndStatus = "Press [F2] to quit";
string sCusInjectStatus = "Press [F1] to inject DLL";

bool getProcID(char* cPName,DWORD &idAdd);
bool InjectDLL(DWORD pID);
void UI();


int main()
{
    eigen::central("----------DLL INJECTOR---------");
    cout << endl;
    eigen::central("by Reality Cheats - xr4zz3rs");
    cout << endl;
    eigen::central("-------------------------------");
    cout << endl;
    cout << endl;
    
    cout << "Type in process name: ";
    cin >> sProcName;
    ProcName = new char[sProcName.length()];
    strcpy(ProcName, sProcName.c_str());
    
    cout << endl;
    cout << "Type in the DLL name: "; //DLL ismini yazacaksınız.
    cin >> sDLLName;
    DLLName = new char[sDLLName.length()];
    strcpy(DLLName, sDLLName.c_str());
    
    sDLLStatus = "-";
    sProcessStatus = "-";
    UI();
    while(!InjectSuccess){
    
        if(GetAsyncKeyState(VK_F1))
        {   
            hasProcID = getProcID(ProcName,ProcID);
            InjectSuccess = InjectDLL(ProcID);
            if(InjectSuccess){sEndStatus = "";sCusInjectStatus = "";}
            UI();
            Sleep(100);
        }
        if(GetAsyncKeyState(VK_F2))
        {   
            return 0;
        }
    }
    Beep(1600,200);
    UI();
    cout << endl << endl;
    cout << "---INJECTED---"<<endl; // Injectlendi kapatılıyor...
    for(int i=5;i>0;i--){
        cout << "Closing in " << i << endl;
        Sleep(1000);
    }

    
    return 0;
}

bool getProcID(char* cPName,DWORD &idAdd){

    bool isHere;
    PROCESSENTRY32 pe32;
    HANDLE hSnapShot;

    hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    if(hSnapShot == INVALID_HANDLE_VALUE){return false;}
    pe32.dwSize = sizeof(PROCESSENTRY32);

    isHere = Process32First(hSnapShot,&pe32);

    while(isHere){

        if(strcmp(cPName,pe32.szExeFile) == 0){
            idAdd = pe32.th32ProcessID;
            CloseHandle(hSnapShot);
            sProcessStatus = "--Fine--";
            return true;}
        isHere = Process32Next(hSnapShot,&pe32);
        pe32.dwSize = sizeof(PROCESSENTRY32);
    }
    CloseHandle(hSnapShot);
    sProcessStatus = "Process not found!";


    return false;
}

bool InjectDLL(DWORD pID){

   //DLL varmı kontrol et eğer yoksa
    ifstream fDLL(DLLName);
    if(!fDLL){

            sDLLStatus = "File not found!";
            return false;}
    
   HANDLE Proc;
   char buf[50]={0};
   LPVOID RemoteString, LoadLibAddy;

   Proc = OpenProcess(CREATE_THREAD_ACCESS, FALSE, pID);

   if(!Proc)
   {   
      return false;
   }

   LoadLibAddy = (LPVOID)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
   RemoteString = (LPVOID)VirtualAllocEx(Proc, NULL, strlen(DLLName), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
 
   WriteProcessMemory(Proc, (LPVOID)RemoteString, DLLName, strlen(DLLName), NULL);
 
   CreateRemoteThread(Proc, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibAddy, (LPVOID)RemoteString, NULL, NULL);   
   sDLLStatus = "--Fine--";
   CloseHandle(Proc);   
   return true;
}

//
void UI(){

    system("CLS");
    eigen::central("----------DLL INJECTOR---------");
    cout << endl;
    eigen::central("by Reality Cheats - xr4zz3rs");
    cout << endl;
    eigen::central("-------------------------------");
    cout << endl;
    cout << endl;
    cout << endl;
    cout << sCusInjectStatus << endl;
    cout << sEndStatus << endl << endl;
    cout << "Process Status: " << sProcessStatus << endl;
    cout << "DLL Status    : " << sDLLStatus << endl;
}

HEADER Kısmı (.h);

Kod:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;
namespace eigen{
void central(string s){
        int num = 0;
        int len = s.size();
        if(len > 80){
            num = int(len/80);}
        
        int tmp = len;
        int cur = 0;
        
        for(int i = 0; i <= num; i++){

            
            if(tmp >= 80){
                for(int q = 0; q < 80;q++){
                    cur++;
                    cout << s[q];}
                tmp -= 80;}

            else{
                int strt = int(40 - tmp/2);
                for(int w = 0; w < strt; w++){
                    cout << " ";}
                for(cur; cur <= len-1; cur++){
                    cout << s[cur];}
            }
        }
    }
}
 

egxsy0

Member
Katılım
25 Mar 2020
Mesajlar
1
Tepkime puanı
0
RC Point
0
reis ben bir loader yaptımda injector de oyun çöküyor yardımcı olabilirmisin?
 
Üst