• Trainer
  • Forums
  • Suche
  • Members
  • Kalender
  • Hilfe
  • Extras
Forum stats
Show team
Neue Beiträge ansehen
Heutige Beiträge ansehen
Home of Gamehacking - Archiv
Login to account Create an account
Login
Benutzername:
Passwort: Passwort vergessen?
 



  Home of Gamehacking - Archiv Coding C, C#, C++, Visual C++
1 2 Weiter »
C++ Code Injection(ohne DLL)

Ansichts-Optionen
C++ Code Injection(ohne DLL)
Colix Offline
Junior Member
**
Beiträge: 6
Themen: 1
Registriert seit: Jul 2012
Bewertung: 0
#12
17.07.2012, 23:35 (Dieser Beitrag wurde zuletzt bearbeitet: 18.07.2012, 23:22 von Colix.)
nach einigen tagen meld ich mich jetzt auch mal wieder! Happy

Erstmal danke für die Erklärung und den weiteren Link, hat mir eigentlich gut geholfen, sodass ich folgendes zusammengeschrieben hab.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
struct SGame
{
	HWND hWnd;
	HANDLE hProcess;	
	LPVOID pAllocMemory;
	DWORD dwProcessID;
};
SGame Game;

LPCTSTR lpCaption = "Message";
LPCTSTR lpText = "Hello";

void InjectThread()
{
	FARPROC Message = GetProcAddress(GetModuleHandle( TEXT("user32.dll")), "MessageBox");
	_asm
	{
		push 0
		push lpCaption
		push lpText
		push 0
		call dword ptr [Message]
	}
}
static void after_InjectThread()
{

}
int main()
{
	if(!(Game.hWnd = FindWindow(NULL, "iTunes")))
		printf("[-] FindWindow failed! Error: %d\n", GetLastError());
	else 
		printf("[+] FindWindow succesfully\n");

	GetWindowThreadProcessId(Game.hWnd,&Game.dwProcessID);
	if(!(Game.hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, Game.dwProcessID)))
		printf("[-] OpenProcess failed! Error: %d\n", GetLastError());
	else 
        printf("[+] OpenProcess succesfully\n");

	DWORD sizeOfFunc = (PBYTE)&after_InjectThread - (PBYTE)&InjectThread;
	printf("[+] Size of Function: %d\n", sizeOfFunc);
	
	if(!(Game.pAllocMemory = VirtualAllocEx(Game.hProcess, 0, sizeOfFunc, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE)))
		printf("[-] VirtualAllocEx failed! Error: %d\n", GetLastError());
	else 
	{
		printf("[+] VirtualAllocEx succesfully\n!");
		if(!WriteProcessMemory(Game.hProcess, Game.pAllocMemory, &InjectThread,  sizeOfFunc, 0))
			printf("[-] WriteProcessMemory failed! Error: %d\n", GetLastError());
		else
		{
			printf("[+] WriteProcessMemory succesfully\n");
			if(!CreateRemoteThread(Game.hProcess, NULL, NULL, (LPTHREAD_START_ROUTINE)Game.pAllocMemory, NULL, NULL, NULL))
				printf("[-] CreateRemoteThread failed! Error: %d\n", GetLastError());
			else printf("[+] CreateRemoteThread succesfully\n");
		}
	}
	CloseHandle(Game.hProcess);

	while(true)
	{

		Sleep(100);
	}
	return 0;
}


Schön und gut, dacht ich zumindest, doch der Prozess, egal ob iTunes oder irgendein Game, crasht einfach. In meiner Konsole wird kein Fehler ausgegeben, die Funktionen werden alle ordnungsgemäß ausgeführt, laut meinen logs.
Könnte jemand von euch drüber schauen und es vielleicht selber mal ausprobieren? Hab ich was komplett falsch verstanden oder fehlt irgendwas? :P

Danke für jede Hilfe! Smiling

Gruß
Colix

Suchen
Antworten
Share Thread:            


Nachrichten in diesem Thema
C++ Code Injection(ohne DLL) - von Colix - 12.07.2012, 22:33
RE: C++ Code Injection(ohne DLL) - von fr33k - 12.07.2012, 23:56
RE: C++ Code Injection(ohne DLL) - von Colix - 13.07.2012, 00:31
RE: C++ Code Injection(ohne DLL) - von iNvIcTUs oRCuS - 13.07.2012, 10:59
RE: C++ Code Injection(ohne DLL) - von Colix - 13.07.2012, 13:31
RE: C++ Code Injection(ohne DLL) - von fr33k - 13.07.2012, 15:31
RE: C++ Code Injection(ohne DLL) - von Colix - 13.07.2012, 15:37
RE: C++ Code Injection(ohne DLL) - von Acubra - 13.07.2012, 16:37
RE: C++ Code Injection(ohne DLL) - von iNvIcTUs oRCuS - 13.07.2012, 17:13
RE: C++ Code Injection(ohne DLL) - von Colix - 13.07.2012, 17:14
RE: C++ Code Injection(ohne DLL) - von Acubra - 13.07.2012, 17:49
RE: C++ Code Injection(ohne DLL) - von Colix - 17.07.2012, 23:35
RE: C++ Code Injection(ohne DLL) - von Acubra - 19.07.2012, 14:42
RE: C++ Code Injection(ohne DLL) - von sungwoo - 14.10.2012, 19:37

  • Druckversion anzeigen
  • Thema abonnieren


Benutzer, die gerade dieses Thema anschauen:
1 Gast/Gäste

  • Kontakt
  • Forum team
  • Forum stats
  • Nach oben
 
  • RSS-Synchronisation
  • Lite mode
  • Home of Gamehacking - Archiv
  • Help
 
Forum software by © MyBB - Theme © iAndrew 2014



Linearer Modus
Baumstrukturmodus