From c3d58f57d9f0164a4cc2d7c72337ffd887917c6e Mon Sep 17 00:00:00 2001 From: Akashdeep Dhar Date: Feb 03 2021 05:30:47 +0000 Subject: Fixed issue where API requests handling of processes above its privilege level Signed-off-by: Akashdeep Dhar --- diff --git a/base/back.py b/base/back.py index 7a5cb4b..88e0e98 100644 --- a/base/back.py +++ b/base/back.py @@ -83,27 +83,39 @@ class ProcessHandler: def process_killer(self): singproc = self.get_single_process() - if type(singproc) == psutil.Process: - singproc.kill() - return {"retnmesg": True} + try: + if type(singproc) == psutil.Process: + singproc.kill() + return {"retnmesg": True} + except: + return {"retnmesg": False} def process_terminator(self): singproc = self.get_single_process() - if type(singproc) == psutil.Process: - singproc.terminate() - return {"retnmesg": True} + try: + if type(singproc) == psutil.Process: + singproc.terminate() + return {"retnmesg": True} + except: + return {"retnmesg": False} def process_suspender(self): singproc = self.get_single_process() - if type(singproc) == psutil.Process: - singproc.suspend() - return {"retnmesg": True} + try: + if type(singproc) == psutil.Process: + singproc.suspend() + return {"retnmesg": True} + except: + return {"retnmesg": False} def process_resumer(self): singproc = self.get_single_process() - if type(singproc) == psutil.Process: - singproc.resume() - return {"retnmesg": True} + try: + if type(singproc) == psutil.Process: + singproc.resume() + return {"retnmesg": True} + except: + return {"retnmesg": False} class LiveUpdatingElements: