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:
parent
67e3744d5e
commit
74f7c11344
@ -512,8 +512,11 @@ class Victim:
|
||||
"""
|
||||
|
||||
util.progress("identifying init system")
|
||||
with self.open("/proc/1/comm", "r") as filp:
|
||||
init = filp.read()
|
||||
try:
|
||||
with self.open("/proc/1/comm", "r") as filp:
|
||||
init = filp.read()
|
||||
except (FileNotFoundError, PermissionError):
|
||||
init = None
|
||||
|
||||
if "systemd" in init:
|
||||
self.host.init = util.Init.SYSTEMD
|
||||
@ -521,6 +524,8 @@ class Victim:
|
||||
self.host.init = util.Init.UPSTART
|
||||
elif "sysv" in init:
|
||||
self.host.init = util.Init.SYSV
|
||||
else:
|
||||
self.host.init = util.Init.UNKNOWN
|
||||
|
||||
util.progress("identifying remote kernel version")
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user