forked from jan/mem_edit
		
	Style fixes
This commit is contained in:
		
							parent
							
								
									e962137950
								
							
						
					
					
						commit
						b50b37c1c4
					
				@ -11,14 +11,14 @@ To get started, try:
 | 
			
		||||
    help(Process)
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
__author__ = 'Jan Petykiewicz'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import platform
 | 
			
		||||
 | 
			
		||||
from .utils import MemEditError
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
__author__ = 'Jan Petykiewicz'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
system = platform.system()
 | 
			
		||||
if system == 'Windows':
 | 
			
		||||
    from .windows import Process
 | 
			
		||||
 | 
			
		||||
@ -235,9 +235,9 @@ class Process(metaclass=ABCMeta):
 | 
			
		||||
        :param targets: List of (offset, read_buffer) pairs which will be read from the struct.
 | 
			
		||||
        :return: List of read values corresponding to the provided targets.
 | 
			
		||||
        """
 | 
			
		||||
        base = self.read_memory(base_address, ctypes.c_void_p())
 | 
			
		||||
        vals = [self.read_memory(base + offset, buffer) for offset, buffer in targets]
 | 
			
		||||
        return vals
 | 
			
		||||
        base = self.read_memory(base_address, ctypes.c_void_p()).value
 | 
			
		||||
        values = [self.read_memory(base + offset, buffer) for offset, buffer in targets]
 | 
			
		||||
        return values
 | 
			
		||||
 | 
			
		||||
    def search_addresses(self, addresses: List[int], needle_buffer: ctypes_buffer_t) -> List[int]:
 | 
			
		||||
        """
 | 
			
		||||
@ -253,10 +253,10 @@ class Process(metaclass=ABCMeta):
 | 
			
		||||
        found = []
 | 
			
		||||
        read_buffer = copy.copy(needle_buffer)
 | 
			
		||||
 | 
			
		||||
        for addr in addresses:
 | 
			
		||||
            read = self.read_memory(addr, read_buffer)
 | 
			
		||||
        for address in addresses:
 | 
			
		||||
            read = self.read_memory(address, read_buffer)
 | 
			
		||||
            if ctypes_equal(needle_buffer, read):
 | 
			
		||||
                found.append(addr)
 | 
			
		||||
                found.append(address)
 | 
			
		||||
        return found
 | 
			
		||||
 | 
			
		||||
    def search_all_memory(self, needle_buffer, writeable_only=True) -> List[int]:
 | 
			
		||||
 | 
			
		||||
@ -43,10 +43,10 @@ def ptrace(command: int, pid: int = 0, arg1: int = 0, arg2: int = 0) -> int:
 | 
			
		||||
    logger.debug('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2)) 
 | 
			
		||||
    result = _ptrace(command, pid, arg1, arg2)
 | 
			
		||||
    if result == -1:
 | 
			
		||||
        errno = ctypes.get_errno()
 | 
			
		||||
        if errno:
 | 
			
		||||
        err_no = ctypes.get_errno()
 | 
			
		||||
        if err_no:
 | 
			
		||||
            raise MemEditError('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2) +
 | 
			
		||||
                               ' failed with error {}: {}'.format(errno, strerror(errno)))
 | 
			
		||||
                               ' failed with error {}: {}'.format(err_no, strerror(err_no)))
 | 
			
		||||
    return result
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -75,8 +75,8 @@ class Process(AbstractProcess):
 | 
			
		||||
 | 
			
		||||
    def get_path(self) -> str:
 | 
			
		||||
        try:
 | 
			
		||||
           with open('/proc/{}/cmdline', 'rb') as f:
 | 
			
		||||
               return f.read().decode().split('\x00')[0]
 | 
			
		||||
            with open('/proc/{}/cmdline', 'rb') as f:
 | 
			
		||||
                return f.read().decode().split('\x00')[0]
 | 
			
		||||
        except FileNotFoundError:
 | 
			
		||||
            return '' 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -211,12 +211,12 @@ class Process(AbstractProcess):
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def list_mapped_regions(self, writeable_only: bool = True) -> List[Tuple[int, int]]:
 | 
			
		||||
        sysinfo = SYSTEM_INFO()
 | 
			
		||||
        sysinfo_ptr = ctypes.byref(sysinfo)
 | 
			
		||||
        ctypes.windll.kernel32.GetSystemInfo(sysinfo_ptr)
 | 
			
		||||
        sys_info = SYSTEM_INFO()
 | 
			
		||||
        sys_info_ptr = ctypes.byref(sys_info)
 | 
			
		||||
        ctypes.windll.kernel32.GetSystemInfo(sys_info_ptr)
 | 
			
		||||
 | 
			
		||||
        start = sysinfo.lpMinimumApplicationAddress
 | 
			
		||||
        stop = sysinfo.lpMaximumApplicationAddress
 | 
			
		||||
        start = sys_info.lpMinimumApplicationAddress
 | 
			
		||||
        stop = sys_info.lpMaximumApplicationAddress
 | 
			
		||||
 | 
			
		||||
        def get_mem_info(address):
 | 
			
		||||
            """
 | 
			
		||||
@ -236,7 +236,7 @@ class Process(AbstractProcess):
 | 
			
		||||
            if success != mbi_size:
 | 
			
		||||
                if success == 0:
 | 
			
		||||
                    raise MemEditError('Failed VirtualQueryEx with handle ' +
 | 
			
		||||
                                    '{}: {}'.format(self.process_handle, self._get_last_error()))
 | 
			
		||||
                                       '{}: {}'.format(self.process_handle, self._get_last_error()))
 | 
			
		||||
                else:
 | 
			
		||||
                    raise MemEditError('VirtualQueryEx output too short!')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								setup.py
									
									
									
									
									
								
							@ -8,7 +8,7 @@ setup(name='mem_edit',
 | 
			
		||||
      author='Jan Petykiewicz',
 | 
			
		||||
      author_email='anewusername@gmail.com',
 | 
			
		||||
      url='https://mpxd.net/gogs/jan/mem_edit',
 | 
			
		||||
      keywords = [
 | 
			
		||||
      keywords=[
 | 
			
		||||
            'memory',
 | 
			
		||||
            'edit',
 | 
			
		||||
            'editing',
 | 
			
		||||
@ -25,7 +25,7 @@ setup(name='mem_edit',
 | 
			
		||||
            'cheat',
 | 
			
		||||
            'trainer',
 | 
			
		||||
      ],
 | 
			
		||||
      classifiers = [
 | 
			
		||||
      classifiers=[
 | 
			
		||||
            'Programming Language :: Python',
 | 
			
		||||
            'Programming Language :: Python :: 3',
 | 
			
		||||
            'Development Status :: 4 - Beta',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user