Fix unicode issues on Python2, and strip the SELinux context

pull/23/merge
Zach Riggle 10 years ago
parent 95459a24be
commit 783191c293

@ -85,7 +85,7 @@ class Process():
def selinux(self): def selinux(self):
path = '/proc/%i/task/%i/attr/current' % (self.pid, self.tid) path = '/proc/%i/task/%i/attr/current' % (self.pid, self.tid)
raw = pwndbg.file.get(path) raw = pwndbg.file.get(path)
return raw.decode().rstrip('\x00') return raw.decode().rstrip('\x00').strip()
@property @property
@pwndbg.memoize.reset_on_stop @pwndbg.memoize.reset_on_stop
@ -124,11 +124,11 @@ class Process():
v = int(v.split()[0]) * (1<<20) v = int(v.split()[0]) * (1<<20)
# misc integers like pid and ppid # misc integers like pid and ppid
elif v.isdigit(): elif str(v).isdigit():
v = int(v) v = int(v)
# uid and gid and groups # uid and gid and groups
elif all(map(str.isdigit, v.split())): elif all((s.isdigit() for s in v.split())):
v = list(map(int, v.split())) v = list(map(int, v.split()))
# capability sets # capability sets

Loading…
Cancel
Save