mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-18 15:14:10 +01:00
Add debug logfile to Python Meterpreter
This commit is contained in:
parent
d0e0b52f0d
commit
2217886374
@ -59,6 +59,7 @@ random.seed()
|
|||||||
|
|
||||||
# these values will be patched, DO NOT CHANGE THEM
|
# these values will be patched, DO NOT CHANGE THEM
|
||||||
DEBUGGING = False
|
DEBUGGING = False
|
||||||
|
DEBUGGING_LOG_FILE_PATH = None
|
||||||
TRY_TO_FORK = True
|
TRY_TO_FORK = True
|
||||||
HTTP_CONNECTION_URL = None
|
HTTP_CONNECTION_URL = None
|
||||||
HTTP_PROXY = None
|
HTTP_PROXY = None
|
||||||
@ -352,6 +353,14 @@ COMMAND_IDS = (
|
|||||||
)
|
)
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
if DEBUGGING:
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
if DEBUGGING_LOG_FILE_PATH:
|
||||||
|
file_handler = logging.FileHandler(DEBUGGING_LOG_FILE_PATH)
|
||||||
|
file_handler.setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger().addHandler(file_handler)
|
||||||
|
|
||||||
class SYSTEM_INFO(ctypes.Structure):
|
class SYSTEM_INFO(ctypes.Structure):
|
||||||
_fields_ = [("wProcessorArchitecture", ctypes.c_uint16),
|
_fields_ = [("wProcessorArchitecture", ctypes.c_uint16),
|
||||||
("wReserved", ctypes.c_uint16),
|
("wReserved", ctypes.c_uint16),
|
||||||
@ -427,14 +436,14 @@ def crc16(data):
|
|||||||
@export
|
@export
|
||||||
def debug_print(msg):
|
def debug_print(msg):
|
||||||
if DEBUGGING:
|
if DEBUGGING:
|
||||||
print(msg)
|
logging.debug(msg)
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def debug_traceback(msg=None):
|
def debug_traceback(msg=None):
|
||||||
if DEBUGGING:
|
if DEBUGGING:
|
||||||
if msg:
|
if msg:
|
||||||
print(msg)
|
debug_print(msg)
|
||||||
traceback.print_exc(file=sys.stderr)
|
debug_print(traceback.format_exc())
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def error_result(exception=None):
|
def error_result(exception=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user