Use build in exception traceback instead of traceback.format_exc

This commit is contained in:
Alexander Neff
2025-07-05 10:50:25 -04:00
parent ed4e4a1e3e
commit c1dfefd2a1
+5 -6
View File
@@ -981,12 +981,12 @@ class smb(connection):
if self.args.taskkill.isdigit():
pidList = [int(self.args.taskkill)]
else:
r = legacy.hRpcWinStationGetAllProcesses(handle)
if not r:
res = legacy.hRpcWinStationGetAllProcesses(handle)
if not res:
self.logger.error("Could not get process list")
return
pidList = [i["UniqueProcessId"] for i in r if i["ImageName"].lower() == self.args.taskkill.lower()]
pidList = [i["UniqueProcessId"] for i in res if i["ImageName"].lower() == self.args.taskkill.lower()]
if not pidList:
self.logger.fail(f"Could not find process named {self.args.taskkill}")
return
@@ -997,9 +997,8 @@ class smb(connection):
self.logger.highlight(f"Terminated PID {pid} ({self.args.taskkill})")
else:
self.logger.fail(f"Failed terminating PID {pid}")
except Exception:
import traceback
self.logger.error(f"Error terminating PID {pid}: {traceback.format_exc()}")
except Exception as e:
self.logger.exception(f"Error terminating PID {pid}: {e}")
@requires_admin
def qwinsta(self):