From d480886f7a3275be069dd10bc9c9b174d0b91a7b Mon Sep 17 00:00:00 2001 From: "Manuel Amador (Rudd-O)" Date: Tue, 12 Jul 2022 05:50:12 +0000 Subject: [PATCH] set proc name. --- bin/bombshell-client | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/bombshell-client b/bin/bombshell-client index 7a8ff12..0f521ee 100755 --- a/bin/bombshell-client +++ b/bin/bombshell-client @@ -32,6 +32,15 @@ PACKLEN = 8 PACKFORMAT = "!HbIx" +def set_proc_name(newname): + from ctypes import cdll, byref, create_string_buffer + + libc = cdll.LoadLibrary("libc.so.6") + buff = create_string_buffer(len(newname) + 1) + buff.value = newname + libc.prctl(15, byref(buff), 0, 0, 0) + + @contextlib.contextmanager def mutexfile(filepath): oldumask = os.umask(0o077) @@ -320,6 +329,12 @@ class DataDemultiplexer(MyThread): def main_master(): + set_proc_name( + "bombshell-client (master) %s" + % " ".join( + quote(x for x in sys.argv[1:]), + ) + ) global logging logging = LoggingEmu("master") @@ -413,6 +428,12 @@ def pairofpipes(): def main_remote(): + set_proc_name( + "bombshell-client (remote) %s" + % " ".join( + quote(x for x in sys.argv[1:]), + ) + ) global logging logging = LoggingEmu("remote")