diff --git a/.gitignore b/.gitignore index 6ad846b..79a8109 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ __pycache__ *.pyc *.egg-info/ -build/ dist/ diff --git a/MANIFEST.in b/MANIFEST.in index 2b8b271..c28ab72 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,2 @@ include README.md include LICENSE.md -include mem_edit/VERSION diff --git a/README.md b/README.md index 53789b7..66ecc88 100644 --- a/README.md +++ b/README.md @@ -19,18 +19,18 @@ **Dependencies:** * python 3 (written and tested with 3.7) -* ctypes -* typing (for type annotations) +* ctypes +* typing (for type annotations) Install with pip, from PyPI (preferred): ```bash -pip3 install mem_edit +pip install mem_edit ``` Install with pip from git repository ```bash -pip3 install git+https://mpxd.net/code/jan/mem_edit.git@release +pip install git+https://mpxd.net/code/jan/mem_edit.git@release ``` @@ -55,7 +55,7 @@ Increment a magic number (unsigned long 1234567890) found in 'magic.exe': pid = Process.get_pid_by_name('magic.exe') with Process.open_process(pid) as p: addrs = p.search_all_memory(magic_number) - + # We don't want to edit if there's more than one result... assert(len(addrs) == 1) @@ -104,7 +104,7 @@ Read and alter a structure: s = MyStruct() s.first_member = 1234567890 s.second_member = 0x1234 - + addrs = p.search_all_memory(s) print(addrs) diff --git a/mem_edit/VERSION b/mem_edit/VERSION deleted file mode 100644 index be58634..0000000 --- a/mem_edit/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.3 diff --git a/mem_edit/__init__.py b/mem_edit/__init__.py index 8947638..8391f4f 100644 --- a/mem_edit/__init__.py +++ b/mem_edit/__init__.py @@ -12,16 +12,12 @@ To get started, try: """ import platform -import pathlib from .utils import MemEditError __author__ = 'Jan Petykiewicz' - -with open(pathlib.Path(__file__).parent / 'VERSION', 'r') as f: - __version__ = f.read().strip() -version = __version__ +version = '0.2' system = platform.system() diff --git a/mem_edit/linux.py b/mem_edit/linux.py index ae8404d..4dafd1c 100644 --- a/mem_edit/linux.py +++ b/mem_edit/linux.py @@ -40,7 +40,7 @@ def ptrace(command: int, pid: int = 0, arg1: int = 0, arg2: int = 0) -> int: """ Call ptrace() with the provided pid and arguments. See the ```man ptrace```. """ - logger.debug('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2)) + logger.debug('ptrace({}, {}, {}, {})'.format(command, pid, arg1, arg2)) result = _ptrace(command, pid, arg1, arg2) if result == -1: err_no = ctypes.get_errno() @@ -58,7 +58,7 @@ class Process(AbstractProcess): self.pid = process_id def close(self): - os.kill(self.pid, signal.SIGSTOP) + os.kill(self.pid, signal.SIGSTOP) ptrace(ptrace_commands['PTRACE_DETACH'], self.pid, 0, 0) self.pid = None @@ -78,7 +78,7 @@ class Process(AbstractProcess): with open('/proc/{}/cmdline', 'rb') as f: return f.read().decode().split('\x00')[0] except FileNotFoundError: - return '' + return '' @staticmethod def list_available_pids() -> List[int]: diff --git a/setup.py b/setup.py index 5b53ab7..bec3d13 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,15 @@ #!/usr/bin/env python3 from setuptools import setup, find_packages +import mem_edit + with open('README.md', 'r') as f: long_description = f.read() -with open('mem_edit/VERSION', 'r') as f: - version = f.read().strip() setup(name='mem_edit', - version=version, + version=mem_edit.version, description='Multi-platform library for memory editing', long_description=long_description, long_description_content_type='text/markdown', @@ -34,6 +34,7 @@ setup(name='mem_edit', 'trainer', ], classifiers=[ + 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Development Status :: 4 - Beta', 'Environment :: Other Environment', @@ -49,9 +50,6 @@ setup(name='mem_edit', 'Topic :: Utilities', ], packages=find_packages(), - package_data={ - 'mem_edit': ['VERSION'] - }, install_requires=[ 'typing', ],