Navigation
Artikel
Stuff
RSS Feeds
|
Tutorials - Speicherzugriff Tutorial Teil 2Sprachenübersicht/Programmierung/C / C++/ C#/Security Keywords: C++, Speicherzugriff, Buffer, Memory, Memoryscanner, Trainer programmieren, auf Speicher von anderen Programmen zugreifen, Speicher verändern, Tutorial, manipulieren, Arbeitsspeicher, Cheattools, Tutorial, Anleitung, Programmieren, entwickeln Orginal von Thomas Nitschke aka namespace.
Code: #include <windows.h> #include <iostream> using namespace std; typedef unsigned int uint; HANDLE hproc; DWORD procid; int main(void) { HWND hWnd; hWnd = FindWindow(0,"Opfer"); if(!hWnd) return 0; GetWindowThreadProcessId(hWnd, &procid); hproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procid); CloseHandle(hproc);//<-- Wichtig! return 0; }
Code: #include <windows.h> #include <iostream> using namespace std; typedef unsigned int uint; HANDLE hproc; DWORD procid; void GetMemMinMax(void); int main(void) { HWND hWnd; hWnd = FindWindow(0,"Opfer"); if(!hWnd) return 0; GetWindowThreadProcessId(hWnd, &procid); hproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procid); GetMemMinMax(); CloseHandle(hproc);//<-- Wichtig! return 0; } void GetMemMinMax(void) { //hier speicherbereich bestimmen }
Code: struct _MEMORY_BASIC_INFORMATION { PVOID BaseAddress; PVOID AllocationBase; DWORD AllocationProtect; DWORD RegionSize; DWORD State; DWORD Protect; DWORD Type; } MEMORY_BASIC_INFORMATION;
Code: MEMORY_BASIC_INFORMATION mbi; unsigned int adress = 0x400000; do { VirtualQueryEx( hproc, (void*)adress, &mbi, sizeof(MEMORY_BASIC_INFORMATION) ); adress += mbi.RegionSize; } while(adress < 0x80000000);
Code: void GetMemMinMax(void) { MEMORY_BASIC_INFORMATION mbi; unsigned int adress = 0x400000; do { VirtualQueryEx( hproc, (void*)adress, &mbi, sizeof(MEMORY_BASIC_INFORMATION) ); if((mbi.State == MEM_COMMIT) && (mbi.Protect == PAGE_READWRITE) && (mbi.Type == MEM_PRIVATE)) { uint start = (uint)mbi.BaseAddress; uint end = (uint)mbi.BaseAddress+mbi.RegionSize; cout << "Bereich: " << hex << start << " - " << hex << end; } adress += mbi.RegionSize; } while(adress < 0x80000000); }
Code: void ScanMem(DWORD start, DWORD end) { cout << "Bereich wird gescannt... "; DWORD read = 0; uint buffer = 0; for(start; start < end; start++) { ReadProcessMemory( hproc, (void*)start, &buffer, sizeof(uint), &read ); if(buffer == 15) { cout << "Wert an " << hex << start << " gefunden!"; char choice; cout << "Abbrechen? [j,n]"; cin >> choice; if(choice == 'j') return; } } }
Code: do { VirtualQueryEx( hproc, (void*)adress, &mbi, sizeof(MEMORY_BASIC_INFORMATION) ); if((mbi.State == MEM_COMMIT)&& (mbi.Protect == PAGE_READWRITE)&& (mbi.Type == MEM_PRIVATE)) { uint start = (uint)mbi.BaseAddress; uint end = (uint)mbi.BaseAddress+mbi.RegionSize; cout << "Bereich: " << hex << start << " - " << hex << end; ScanMem(start,end); } adress += mbi.RegionSize; } while(adress < 0x80000000);
Code: #include <windows.h> #include <iostream> using namespace std; typedef unsigned int uint; void GetMemMinMax(void); void ScanMem(DWORD start, DWORD end); HANDLE hproc; DWORD procid; int main(void) { HWND hWnd; hWnd = FindWindow(0,"Opfer"); if(!hWnd) return 0; GetWindowThreadProcessId(hWnd, &procid); hproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procid); GetMemMinMax(); CloseHandle(hproc);//<-- Wichtig! return 0; } void GetMemMinMax(void) { MEMORY_BASIC_INFORMATION mbi; unsigned int adress = 0x400000; do { VirtualQueryEx( hproc, (void*)adress, &mbi, sizeof(MEMORY_BASIC_INFORMATION) ); if((mbi.State == MEM_COMMIT)&& (mbi.Protect == PAGE_READWRITE)&& (mbi.Type == MEM_PRIVATE)) { uint start = (uint)mbi.BaseAddress; uint end = (uint)mbi.BaseAddress+mbi.RegionSize; cout << "Bereich: " << hex << start << " - " << hex << end; ScanMem(start,end); } adress += mbi.RegionSize; } while(adress < 0x80000000); } void ScanMem(DWORD start, DWORD end) { cout << " Bereich wird gescannt... "; DWORD read = 0; int buffer = 0; for(start;start<end;start++) { ReadProcessMemory( hproc, (void*)start, &buffer, sizeof(int), &read ); if(buffer == 15) { cout << "Wert an " << hex << start << " gefunden!"; char choice; cout << "Abbrechen? [j,n]"; cin >> choice; if(choice == 'j') return; } } }
Gibt es noch irgendwelche Fragen, oder wollen Sie über den Artikel diskutieren? Sprachenübersicht/Programmierung/C / C++/ C#/Security/Speicherzugriff Tutorial Teil 2 |