1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-24 01:25:37 +01:00

Correctly catch errors while probing init system. Should fix #16

This commit is contained in:
Caleb Stewart 2020-06-02 21:27:17 -04:00
parent 67e3744d5e
commit 74f7c11344

View File

@ -512,8 +512,11 @@ class Victim:
""" """
util.progress("identifying init system") util.progress("identifying init system")
with self.open("/proc/1/comm", "r") as filp: try:
init = filp.read() with self.open("/proc/1/comm", "r") as filp:
init = filp.read()
except (FileNotFoundError, PermissionError):
init = None
if "systemd" in init: if "systemd" in init:
self.host.init = util.Init.SYSTEMD self.host.init = util.Init.SYSTEMD
@ -521,6 +524,8 @@ class Victim:
self.host.init = util.Init.UPSTART self.host.init = util.Init.UPSTART
elif "sysv" in init: elif "sysv" in init:
self.host.init = util.Init.SYSV self.host.init = util.Init.SYSV
else:
self.host.init = util.Init.UNKNOWN
util.progress("identifying remote kernel version") util.progress("identifying remote kernel version")
try: try: