Active Members vatman32 Posted April 28, 2017 Active Members Report Posted April 28, 2017 (edited) Neata. address = 0x0018FB54 address = address + 0x14 address = address + 0x0 address = address + 0x7 ReadProcessMemory(processHandle, address, buffer, bufferSize, byref(bytesRead)) Se rupe filmul la acel "0x0" , prin urmare nu reusesc sa completez pointerul. Am luat la puricat documentatia python cat mi-a permis experienta pana in prezent, am rupt stackoverflow, am cautat si pe rst si nu gasesc un exemplu viabil sa accesez un amarat de pointer. Am invartit variabila aia de am innebunit, de ieri ma chinui intruna. Am luat cateva snipetturi de cod C++ si le-am transcris in python insa nu faceau obiectul problemei prezentate mai sus, ci ma aducea intr-un punct in care am mai fost, sa inaintez cu 2-3 offset-uri asta daca vreun offset nu echivala cu decimal mai mare de 99 (de ex am avut offset +444 (1BCh) si iar s-a rupt filmul ca la 0x0, nu schimba cu nimic rezultatul final oricate offset-uri ii mai adaugam dupa acel +444. Provocarea principala este ca vreau sa pot manevra un proces la fel de usor si rapid prin cod Python nu C++ (am fix pe creier) si inafara de impedimente de astea stupide nu am avut nici o dilema pana in prezent care sa ma retina mai mult de 6-7 ore pana sa gasesc o rezolvare. Sistem de operare: Windows 7 x64 Aplicatiile pe care exersez: x32 Multumesc anticipat. Edited April 28, 2017 by vatman32 uitat paranteza Quote
gear Posted April 28, 2017 Report Posted April 28, 2017 Ai omis o paranteză 24 minutes ago, vatman32 said: ReadProcessMemory(processHandle, address, buffer, bufferSize, byref(bytesRead)) Quote
Active Members vatman32 Posted April 28, 2017 Author Active Members Report Posted April 28, 2017 (edited) 36 minutes ago, gear said: Ai omis o paranteză Multumesc de atentionare, am copiat linia dintr-un cod principal la care lucrez si probabil am omis, insa nu e motivul pentru care nu reusesec sa formez acel pointer. Edited April 28, 2017 by vatman32 am scris ca un bou in graba, imi place sa editez posturi pe care la postez acum 5 secunde :-| Quote
Active Members MrGrj Posted April 28, 2017 Active Members Report Posted April 28, 2017 (edited) Am inteles asa partial ce vrei. Uite un exemplu care functioneaza: from ctypes import * PROCESS_ALL_ACCESS = 0x1F0FFF ADDRESS = 0x1000000 # Iau headerul de la .exe PID = 3648 # In cazul meu e Process ID de la PyCharm open_process = windll.kernel32.OpenProcess read_process_memory = windll.kernel32.ReadProcessMemory close_handle = windll.kernel32.CloseHandle buff = c_char_p('aici ceva string pointer') buff_size = len(buff.value) bytes_read = c_ulong(0) process_handle = open_process(PROCESS_ALL_ACCESS, False, PID) if read_process_memory(process_handle, ADDRESS, buff, buff_size, byref(bytes_read)): print("Success: {}".format(buff)) else: print("Failed.") close_handle(process_handle) BTW, `address = address + 0x14` nu cred ca face ceea ce te astepti tu sa faca Uite, un exemplu de pointer catre un chunk de memorie: >>> import ctypes >>> x = (ctypes.c_ulong*5)() >>> x <__main__.c_ulong_Array_5 object at 0x00C2DB20> >>> ctypes.cast(x, ctypes.POINTER(ctypes.c_ulong)) <__main__.LP_c_ulong object at 0x0119FD00> >>> Ai un exemplu pe git cu mai multe functionalitati: https://github.com/thezdi/scripts/blob/master/python_injector.py Sper sa te ajute. Edited April 28, 2017 by MrGrj 5 Quote
Active Members vatman32 Posted April 28, 2017 Author Active Members Report Posted April 28, 2017 E mai mult decat era necesar, multumesc mult! Quote