Agent: Add @wraps to WmiTools decorators

This commit is contained in:
Mike Salvatore 2022-03-09 15:21:46 -05:00
parent 720768e25d
commit 27e3cc6b4c
1 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import logging import logging
import threading import threading
from functools import wraps
from impacket.dcerpc.v5.dcom import wmi from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dcom.wmi import DCERPCSessionError from impacket.dcerpc.v5.dcom.wmi import DCERPCSessionError
@ -26,6 +27,7 @@ class AccessDeniedException(Exception):
class WmiTools(object): class WmiTools(object):
@staticmethod @staticmethod
def impacket_user(func): def impacket_user(func):
@wraps(func)
def _wrapper(*args, **kwarg): def _wrapper(*args, **kwarg):
logger.debug("Waiting for impacket lock") logger.debug("Waiting for impacket lock")
with lock: with lock:
@ -92,6 +94,7 @@ class WmiTools(object):
@staticmethod @staticmethod
def dcom_wrap(func): def dcom_wrap(func):
@wraps(func)
def _wrapper(*args, **kwarg): def _wrapper(*args, **kwarg):
try: try:
logger.debug("Running function from dcom_wrap") logger.debug("Running function from dcom_wrap")