Style fixes

This commit is contained in:
Jan Petykiewicz 2017-06-21 01:44:57 -07:00
parent e962137950
commit b50b37c1c4
5 changed files with 22 additions and 22 deletions

View File

@ -11,14 +11,14 @@ To get started, try:
help(Process) help(Process)
""" """
__author__ = 'Jan Petykiewicz'
import platform import platform
from .utils import MemEditError from .utils import MemEditError
__author__ = 'Jan Petykiewicz'
system = platform.system() system = platform.system()
if system == 'Windows': if system == 'Windows':
from .windows import Process from .windows import Process

View File

@ -235,9 +235,9 @@ class Process(metaclass=ABCMeta):
:param targets: List of (offset, read_buffer) pairs which will be read from the struct. :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. :return: List of read values corresponding to the provided targets.
""" """
base = self.read_memory(base_address, ctypes.c_void_p()) base = self.read_memory(base_address, ctypes.c_void_p()).value
vals = [self.read_memory(base + offset, buffer) for offset, buffer in targets] values = [self.read_memory(base + offset, buffer) for offset, buffer in targets]
return vals return values
def search_addresses(self, addresses: List[int], needle_buffer: ctypes_buffer_t) -> List[int]: def search_addresses(self, addresses: List[int], needle_buffer: ctypes_buffer_t) -> List[int]:
""" """
@ -253,10 +253,10 @@ class Process(metaclass=ABCMeta):
found = [] found = []
read_buffer = copy.copy(needle_buffer) read_buffer = copy.copy(needle_buffer)
for addr in addresses: for address in addresses:
read = self.read_memory(addr, read_buffer) read = self.read_memory(address, read_buffer)
if ctypes_equal(needle_buffer, read): if ctypes_equal(needle_buffer, read):
found.append(addr) found.append(address)
return found return found
def search_all_memory(self, needle_buffer, writeable_only=True) -> List[int]: def search_all_memory(self, needle_buffer, writeable_only=True) -> List[int]:

View File

@ -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)) logger.debug('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2))
result = _ptrace(command, pid, arg1, arg2) result = _ptrace(command, pid, arg1, arg2)
if result == -1: if result == -1:
errno = ctypes.get_errno() err_no = ctypes.get_errno()
if errno: if err_no:
raise MemEditError('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2) + 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 return result

View File

@ -211,12 +211,12 @@ class Process(AbstractProcess):
return None return None
def list_mapped_regions(self, writeable_only: bool = True) -> List[Tuple[int, int]]: def list_mapped_regions(self, writeable_only: bool = True) -> List[Tuple[int, int]]:
sysinfo = SYSTEM_INFO() sys_info = SYSTEM_INFO()
sysinfo_ptr = ctypes.byref(sysinfo) sys_info_ptr = ctypes.byref(sys_info)
ctypes.windll.kernel32.GetSystemInfo(sysinfo_ptr) ctypes.windll.kernel32.GetSystemInfo(sys_info_ptr)
start = sysinfo.lpMinimumApplicationAddress start = sys_info.lpMinimumApplicationAddress
stop = sysinfo.lpMaximumApplicationAddress stop = sys_info.lpMaximumApplicationAddress
def get_mem_info(address): def get_mem_info(address):
""" """

View File

@ -8,7 +8,7 @@ setup(name='mem_edit',
author='Jan Petykiewicz', author='Jan Petykiewicz',
author_email='anewusername@gmail.com', author_email='anewusername@gmail.com',
url='https://mpxd.net/gogs/jan/mem_edit', url='https://mpxd.net/gogs/jan/mem_edit',
keywords = [ keywords=[
'memory', 'memory',
'edit', 'edit',
'editing', 'editing',
@ -25,7 +25,7 @@ setup(name='mem_edit',
'cheat', 'cheat',
'trainer', 'trainer',
], ],
classifiers = [ classifiers=[
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',