Compare commits

...

2 commits

Author SHA1 Message Date
260d67bf81 update gitignore 2019-10-27 13:54:43 -07:00
4deaa41d7e whitespace fixes 2019-10-27 13:05:27 -07:00
2 changed files with 4 additions and 3 deletions

1
.gitignore vendored
View file

@ -4,4 +4,5 @@ __pycache__
*.pyc *.pyc
*.egg-info/ *.egg-info/
build/
dist/ dist/

View file

@ -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```. 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) result = _ptrace(command, pid, arg1, arg2)
if result == -1: if result == -1:
err_no = ctypes.get_errno() err_no = ctypes.get_errno()
@ -58,7 +58,7 @@ class Process(AbstractProcess):
self.pid = process_id self.pid = process_id
def close(self): def close(self):
os.kill(self.pid, signal.SIGSTOP) os.kill(self.pid, signal.SIGSTOP)
ptrace(ptrace_commands['PTRACE_DETACH'], self.pid, 0, 0) ptrace(ptrace_commands['PTRACE_DETACH'], self.pid, 0, 0)
self.pid = None self.pid = None
@ -78,7 +78,7 @@ class Process(AbstractProcess):
with open('/proc/{}/cmdline', 'rb') as f: with open('/proc/{}/cmdline', 'rb') as f:
return f.read().decode().split('\x00')[0] return f.read().decode().split('\x00')[0]
except FileNotFoundError: except FileNotFoundError:
return '' return ''
@staticmethod @staticmethod
def list_available_pids() -> List[int]: def list_available_pids() -> List[int]: