piosmexeri Δημοσ. 27 Αυγούστου 2002 Δημοσ. 27 Αυγούστου 2002 thelo kathos trexi mia efarmogi na epemveno sto kommati tis mnimis pou piani, na allazo+na diavazo kapies times..opote arxizo...vrisko ena module pou mou dini mia lista me olles tis processes pou trexoun(gia na do an trexi afti pou me endiaferi)..os eki kala..meta kolao...pao na do me to OpenProcess prota an boro na grapso i na diavazo apo tin mnimi omos...den xeros pos na vrisko to processID tis process pou endiaferome... to opoio xreiazete ke gia to ReadProcessMemory alla ke gia to WriteProcessMemory...eki exo kolisi...alla me berdevi ke to handle..pos to xrisimopoio afto to rimadi ????
Directx Δημοσ. 27 Αυγούστου 2002 Δημοσ. 27 Αυγούστου 2002 Αν κατάλαβα καλά, αυτό που χρειάζεσαι στο OpenProcess είναι το λεγόμενο ProcessID, ο μοναδικός δηλαδή 32-μπιτός ,τυχαίος κάθε φορά, αριθμός που προσδιορίζει κάθε «διεργασία» στο περιβάλλον Windows. -=Για να αποκτήσεις τον συγκεκριμένο αριθμό μπορείς=- 1ον) Να χρησιμοποιήσεις τις ρουτίνες Process32First & Process32Next της βιβλιοθήκης TOOLHELP.DLL (Windows 9x/2000) οι οποίες σου επιτρέπουν να δεις όλες τις εκτελούμενες από το Λ.Σ. «διεργασίες» επιστρέφοντας στην δομή PROCESSENTRY32 μεταξύ άλλων χρήσιμων στοιχείων, το όνομα αρχείου αλλά και το ProcessID έκαστης εφαρμογής. 2ον) Αν η εφαρμογή είναι συγκεκριμένη, τότε μπορείς να χρησιμοποιήσεις την CreateProcess με την οποία εκκινείς την εφαρμογή και μεταξύ άλλων χρήσιμων δυνατοτήτων (ουσιαστικά είναι μια ρουτίνα για debugging εφαρμογών) λαμβάνεις και το ProcessID της στην δομή PROCESS_INFORMATION. 3ον) Τέλος, αν γνωρίζεις το HANDLE του παράθυρο της εφαρμογής (δες την ρουτίνα FindWindow) μπορείς να χρησιμοποιήσεις την εντολή GetWindowThreadProcessId ώστε να βρεις την ProcessID του συγκεκριμένου παραθύρου. -- Oι παραπάνω ρουτίνες επιστρέφουν είτε απευθείας είτε σε κάποια δομή το ProcessID και από εκεί και πέρα μπορείς να το χρησιμοποιήσεις στην OpenProcess (ορίζοντας στα DesiredAccess τα flags PROCESS_VM_READ | PROCESS_VM_WRITE ή ότι άλλο χρειάζεται) ώστε να ασχοληθείς πια με τις WriteProcessMemory & ReadProcessMemory. -- Καλή τύχη. Υ.Γ. Όλα τα παραπάνω σε C/C++ (Borland C-Builder) <small>[ 27-08-2002, 14:13: Το μήνυμα επεξεργάστηκε από: Directx ]</small>
damn3 Δημοσ. 30 Αυγούστου 2002 Δημοσ. 30 Αυγούστου 2002 mallon kati tetoio xreiazese... In this tutorial, I'm going to outline all the basic API and code necessary to create a trainer in Delphi 4. A basic knowledge of Delphi is preferred, but Delphi's a damn easy language to learn anyway. ############### # The Concept # ############### Okay, this is what we want the trainer to do. We run the game, and then [alt][tab] out to Windows. We run the trainer, and press a button. This action will poke a value into a certain memory address of the game. So if we know the memory address of the money in a game, we can hack the money using this trainer. To make a trainer, here are the basic things we need. The Game's Window Title: Run the game, and then alt-tab out to Windows. Look at the taskbar for your game, and write down the exact window title. The Memory Address (in hex): Using a program like GameHack [http://www.gamehack.com] or MTC, we can do a search for any value and find the memory address. An example address in hex form is 41D090. Write the address down somewhere. A Value To Poke (in hex): So we have the memory address. What value do we want to poke into it? Let's say I want 50 gold, so first, I must convert 50 into hex form using a hex converter. The converter says 32, so write this number down also. Number Of Bytes: In the value to poke that you wrote down above, you must also know how many bytes this will take up in memory. For example, 32 will take up only 1 byte, but FF07 will take up two bytes. In general, two digits take up one byte. ########################## # Let's Start The Coding # ########################## We are going to use the Win32 API to poke values into the memory of another process. Here are the functions we'll be using, in the correct order: FindWindow GetWindowThreadProcessId OpenProcess ReadProcessMemory WriteProcessMemory CloseHandle [Read up these API fuctions in the Win32.hlp file for full details. I will only go through the basics such that beginners can just copy and paste the code in this turorial] The coding begins. First we declare our variables. Copy and paste these into your code: Var WindowName : integer; ProcessId : integer; ThreadId : integer; buf : PChar; HandleWindow : Integer; write : cardinal; Time to declare all the important stuff. Copy and paste the following into the same area of the code. Set up the following variables to what you have written down earlier. Const WindowTitle = 'prog test'; Address = $41D090; PokeValue = $32; NumberOfBytes = 1; Now to poke a value, you must get the handle of the memory of the game. There is no direct way to do this, so here's what we do. 1) Get the main window's handle. 2) With the handle, get the process identifier. 3) With the pID, get the handle of the memory area. 4) With this handle, we can start hacking! First, we need to get the handle of the main window of the game. Use the FindWindow function like this: WindowName := FindWindow(nil,WindowTitle); If WindowName = 0 then begin MessageDlg('The game must be running in the background. Run it now, and then try again.', mtwarning,[mbOK],0); end; Notice that the code checks whether windowname is zero. If it is, it means the game is not running, so we warn the user and tell him to run the damn game now! Next, we need the window's processidentifier. We use the GetWindowThreadProcessId function for this. Then we get the handle of the memory are using OpenProcess. Copy the code below. ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId); HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); That's it! Now we can use WriteProcessMemory to hack into the handle. Once we're done, we close the handle, just to be safe. Copy the code below. GetMem(buf,1); buf^ := Chr(PokeValue); WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write); FreeMem(buf); closehandle(HandleWindow); Below is the source code for the entire trainer. For beginner programmers, to make a fast trainer, all you have to do is change the constants declared in the beginning of the code. ############################################################ ############################################################ #### #### #### Trainer +1 For MTC's Prog Test #### #### Source Code (Delphi 4) #### #### Copyright 1999 By CheatMagic #### #### #### ############################################################ ############################################################ Var WindowName : integer; ProcessId : integer; ThreadId : integer; buf : PChar; HandleWindow : Integer; write : cardinal; Const WindowTitle = 'prog test'; Address = $41D090; PokeValue = $32; NumberOfBytes = 1; ########################################################### # (Put the following code inside a command button routine)# ########################################################### begin WindowName := FindWindow(nil,WindowTitle); If WindowName = 0 then begin MessageDlg('The game must be running in the background. Run it now, and then try again.', mtwarning,[mbOK],0); end; ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId); HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); GetMem(buf,1); buf^ := Chr(PokeValue); WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write); FreeMem(buf); closehandle(HandleWindow); end; Written By Fairuz Lokman Copyright 1999 By CheatMagic
piosmexeri Δημοσ. 2 Σεπτεμβρίου 2002 Μέλος Δημοσ. 2 Σεπτεμβρίου 2002 ..apo eki arxise damn3 <img border="0" title="" alt="[big Grin]" src="images/icons/grin.gif" /> ..tnx both of u <img border="0" title="" alt="[smile]" src="images/icons/smile.gif" /> <img border="0" title="" alt="[smile]" src="images/icons/smile.gif" />
Directx Δημοσ. 4 Σεπτεμβρίου 2002 Δημοσ. 4 Σεπτεμβρίου 2002 Αν και δεν μπορώ να σε βοηθήσω στην PASCAL / DELPHI γιατί δεν γνωρίζω.. πειραματίστηκα λίγο με τις συγκεκριμένες ρουτίνες και σχεδίασα ένα λογισμικό σε C που δείχνει πως δουλεύει η ReadProcessMemory. Ορίζεις τίτλο παραθύρου και base address (ως decimal όμως άρα προσοχή στα conversions) και το λογισμικό επιστρέφει την τιμή (BYTE) που υπάρχει εκεί. Είναι πολύ βασικό και δεν το έχω δοκιμάσει εκτενώς (ουσιαστικά το δοκίμασα με το notepad.exe φορτωμένο [και με ένα dumped του από κάποιο λογισμικό [WinDASM ]]), για τις συγκεκριμένες λειτουργίες βασίστηκα στο Win32s API Reference της Microsoft. Ελπίζω να σε βοηθήσει κάπως. . . ////////////////////////////////////// // Dump Process Address by Directx // ////////////////////////////////////// #include <windows.h> #include <stdio.h> DWORD dwBA; HANDLE hPID; DWORD dwPID,dwRB; HWND hwndHOST; BYTE byteDATA; void main(int argc,char *argv[]) { // check in-params. if(argc==1 || argc<3 || argc>3) { printf("Dump Process Address usage: DPA window-name address offset\n"); return; } // convert argv[2] decimal address to unsigned long if(!(dwBA=atol(argv[2]))) { printf("Incorrect address - %ld\n",dwBA); return; } // find required process window hwnd ref. if(!(hwndHOST=FindWindow(NULL,argv[1]))) { printf("Window caption not found - %s\n",argv[1]); return; } // via hwnd ref. locate process id (PID) if(!GetWindowThreadProcessId(hwndHOST,&dwPID)) { printf("Cannot resolve window to process - %s\n",argv[1]); return; } // now, lets open the process for read.. if(!(hPID=OpenProcess(PROCESS_VM_READ,TRUE,dwPID))) { printf("Cannot open process for read (access denied?) - %x\n",dwPID); return; } // PEEK .. (dwBA should BE casted as const void* else there are problems ahead) if(!ReadProcessMemory(hPID,(const void*)dwBA,&byteDATA,sizeof(byteDATA),&dwRB)) { CloseHandle(hPID); printf("Read process failed - %x\n",dwPID); return; } printf("PID: %x - RB: %ld - Offset: %x - Data: %x (%c)\n",dwPID,dwRB,dwBA,byteDATA,byteDATA); CloseHandle(hPID); } (Παράμετροι πχ: dpa "untitled - notepad" 4209337 (επιστρεφθείς τιμή: E9), compiler: BCC32 v.5.5) [Το μόνο δύσκολο σημείο στην ReadProcessMemory ήταν ότι το base address πρέπει να γίνει cast ως const void* κατά τις υποδείξεις του compiler αλλιώς οι επιστρεφόμενες τιμές είναι λανθασμένες..] <small>[ 03-09-2002, 19:43: Το μήνυμα επεξεργάστηκε από: Hal9000 ]</small>
piosmexeri Δημοσ. 4 Σεπτεμβρίου 2002 Μέλος Δημοσ. 4 Σεπτεμβρίου 2002 Directx distixos den xero c <img border="0" title="" alt="[Frown]" src="images/icons/frown.gif" /> <img border="0" title="" alt="[Frown]" src="images/icons/frown.gif" /> tnx a lot pados...oson afora to WriteProcessMemory ola kala ...aplos prepi na akolouthisis kata vima to tut... <small>[ 04-09-2002, 22:40: Το μήνυμα επεξεργάστηκε από: piosmexeri ]</small>
piosmexeri Δημοσ. 5 Σεπτεμβρίου 2002 Μέλος Δημοσ. 5 Σεπτεμβρίου 2002 gia opion to xreiastei.. <img border="0" title="" alt="[Roll Eyes]" src="images/icons/rolleyes.gif" /> kodikas gia ReadProcessMemory: Var WindowName : integer; ProcessId : integer; ThreadId : integer; buf : PChar; HandleWindow : Integer; BytesRead : cardinal; Const WindowTitle = 'prog test'; Address = $4012B1; BytesToRead = 1; begin WindowName := FindWindow(nil,WindowTitle); If WindowName = 0 then begin MessageDlg('The prog must be running in the background. Run it now, and then try again.', mtwarning,[mbOK],0); end; ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId); HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); getmem(buf,1); ReadProcessMemory(HandleWindow, ptr(Address), buf , BytesToRead, BytesRead ); showmessage(buf^);//i oti alo thelete kade to <img border="0" title="" alt="[Razz]" src="images/icons/tongue.gif" /> FreeMem(buf); closehandle(HandleWindow); end; <small>[ 05-09-2002, 01:11: Το μήνυμα επεξεργάστηκε από: piosmexeri ]</small>
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.