From a74a14b01e724f0b226a62b14cd748c5f7627eea Mon Sep 17 00:00:00 2001 From: Robin David Date: Sat, 1 Jul 2023 15:57:12 +0200 Subject: [PATCH] update tritondse engine to comply with new logging mechanism --- engines/pastis-triton/bin/pastis-triton | 8 +++----- engines/pastis-triton/pastisdse/pastisdse.py | 5 ++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/pastis-triton/bin/pastis-triton b/engines/pastis-triton/bin/pastis-triton index a04f432..58fea87 100755 --- a/engines/pastis-triton/bin/pastis-triton +++ b/engines/pastis-triton/bin/pastis-triton @@ -21,11 +21,13 @@ from libpastis.types import ExecMode, CoverageMode, SeedInjectLoc, CheckMode, Fu from pastisdse import PastisDSE, __version__ from tritondse import CoverageStrategy, ProbeInterface, Config, SmtSolver from tritondse.probes.basic_trace import BasicDebugTrace +import tritondse.logging pastis = None def configure_logs(level: int): + tritondse.logging.enable(level) # Enable tritondse to print logging information coloredlogs.install(level=level, fmt="%(asctime)s %(threadName)s [%(levelname)s] %(message)s", level_styles={'debug': {'color': 'blue'}, 'info': {'color': 'white'}, 'warning': {'color': 'yellow'}, @@ -170,11 +172,7 @@ def offline(program: str, else: config = Config() - if debug: - configure_logs(logging.DEBUG) - config.debug = True - else: - configure_logs(logging.INFO) + configure_logs(logging.DEBUG if debug else logging.INFO) if trace: pastis.add_probe(BasicDebugTrace()) diff --git a/engines/pastis-triton/pastisdse/pastisdse.py b/engines/pastis-triton/pastisdse/pastisdse.py index 7183dac..ece102b 100644 --- a/engines/pastis-triton/pastisdse/pastisdse.py +++ b/engines/pastis-triton/pastisdse/pastisdse.py @@ -38,7 +38,7 @@ def __init__(self, agent: ClientAgent): self.agent = agent self._init_callbacks() # register callbacks on the given agent - self.config = Config(debug=False) + self.config = Config() self.config.workspace = "" # Reset workspace so that it will computed in start_received self.dse = None self.program = None @@ -100,7 +100,7 @@ def start(self): def reset(self): """ Reset the current DSE to be able to restart from fresh settings """ self.dse = None # remove DSE object - self.config = Config(debug=False) + self.config = Config() self.config.workspace = "" # Reset workspace so that it will computed in start_received self._last_id_pc = None self._last_id = None @@ -312,7 +312,6 @@ def start_received(self, fname: str, binary: bytes, engine: FuzzingEngineInfo, e # ------- Create the TritonDSE configuration file --------- if engine_args: self.config = Config.from_json(engine_args) - logging.root.level = logging.DEBUG if self.config.debug else logging.INFO # dynamically change level else: self.config = Config() # Empty configuration