Solved c++ dll injector via FTP

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

mcdeliver1993

Newbie
Silenced
Jul 3, 2013
5
151
0
hey fellas..I'm looking for a dll injector that download the dll from my ftp server and put it temporarily in a folder, and after injection it will be deleted

im looking for a project or source.. im new to c++ and understand a little bit how it work..

thx for the help

kind regards McDeliver1993

i got now this but also it wont inject into my process

C++:
#include <iostream> 
#include <windows.h> 
#include <urlmon.h>
#pragma comment(lib, "Urlmon.lib")

using namespace std; 

int Inject(HWND hwnd, char *name); 

void main()
{
	URLDownloadToFile(NULL, L"My ftp server location of DLL", L"C:\bf3.dll", 0, 0);
	char dll[]="C:\bf3.dll";//Change the name to the dll you want to inject. 
	HWND hw=0;
	hw = FindWindow(L"bf3.exe",NULL);// process
	cout<<"Coded by McDeliver1993.\n\n"<<endl; 
	if(!hw) 
	{ 
		cout<<"Unable find window.\n\n"<<endl; 
		system("pause");
	} 
	if(Inject(hw,dll)) 
	{ 
		cout<<"DLL has injected into the process successfully.\n\n"<<endl; 
	} 
	else 
	{ 
		cout<<"Couldn't inject DLL into the process.\n\n"<<endl; 
	} 
	system("pause");
} 


int Inject(HWND hwnd,char *name) 
{ 
	DWORD Pid; 
	HANDLE    hProcess,hThread; 
	DWORD   BytesWritten; 
	LPVOID    mem; 
	GetWindowThreadProcessId(hwnd, &Pid); 
	hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid); 
	
	if(!hProcess) 
		return 0; 

	mem = VirtualAllocEx(hProcess, NULL,  strlen(name), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); 
	if(mem==NULL) 
	{ 
		CloseHandle(hProcess); 
		return 0; 
	} 
	if(WriteProcessMemory(hProcess, mem, (LPVOID)name,  strlen(name), &BytesWritten)) 
	{ 
		hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(L"KERNEL32.DLL"), "LoadLibraryA"), mem, 0, NULL); 
	
		if(!hThread) 
		{ 
			VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
			CloseHandle(hProcess); 
			return 0; 
		} 
		
		VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
		CloseHandle(hThread); 
		CloseHandle(hProcess); 
		return 1; 
	}    
	
	VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
	CloseHandle(hProcess); 
	return 0;
}
 
Last edited:

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
You're going to need to write a rootkit to do that unless you dump the dll into the memory. If you download it and inject you're gonna have handles open to it and you can't close them in r3 afaik..

Not very smart thing to do anyways directly from ftp
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
too complex idea for me. But recently i was thinking of sending data (real asm code) which is pasted somewhere in program memory, then jumped into and jump back after execution. I wonder if simple send api could do the magic
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
But recently i was thinking of sending data (real asm code) which is pasted somewhere in program memory, then jumped into and jump back after execution. I wonder if simple send api could do the magic
That will never work that simply. I could name tons of reasons why it wouldn't starting with imports..
 

mcdeliver1993

Newbie
Silenced
Jul 3, 2013
5
151
0
He's able to download the file now :p but the injection won't work :p
yup here's the source

C++:
#include <iostream> 
#include <windows.h> 
#include <urlmon.h>
#pragma comment(lib, "Urlmon.lib")

using namespace std; 

int Inject(HWND hwnd, char *name); 

void main()
{
	URLDownloadToFile(NULL, L"my server", L"C:\&H%&76t5h7.dll", 0, 0);
	char dll[]="C:\&H%&76t5h7.dll";//Change the name to the dll you want to inject. 
	HWND hw=0;
	hw = FindWindow(L"Battlefield 3™",NULL);//Change Notepad to your window name. 
	cout<<"Coded by Kevin.\n\n"<<endl; 
	if(!hw) 
	{ 
		cout<<"Unable find window.\n\n"<<endl; 
		system("pause");
	} 
	if(Inject(hw,dll)) 
	{ 
		cout<<"DLL has injected into the process successfully.\n\n"<<endl; 
	} 
	else 
	{ 
		cout<<"Couldn't inject DLL into the process.\n\n"<<endl; 
	} 
	system("pause");
} 


int Inject(HWND hwnd,char *name) 
{ 
	DWORD Pid; 
	HANDLE    hProcess,hThread; 
	DWORD   BytesWritten; 
	LPVOID    mem; 
	GetWindowThreadProcessId(hwnd, &Pid); 
	hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid); 
	
	if(!hProcess) 
		return 0; 

	mem = VirtualAllocEx(hProcess, NULL,  strlen(name), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); 
	if(mem==NULL) 
	{ 
		CloseHandle(hProcess); 
		return 0; 
	} 
	if(WriteProcessMemory(hProcess, mem, (LPVOID)name,  strlen(name), &BytesWritten)) 
	{ 
		hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(L"KERNEL32.DLL"), "LoadLibraryA"), mem, 0, NULL); 
	
		if(!hThread) 
		{ 
			VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
			CloseHandle(hProcess); 
			return 0; 
		} 
		
		VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
		CloseHandle(hThread); 
		CloseHandle(hProcess); 
		return 1; 
	}    
	
	VirtualFreeEx(hProcess,NULL,strlen(name),MEM_RESERVE|MEM_COMMIT); 
	CloseHandle(hProcess); 
	return 0;
}
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods