Monitor - Target Results Callback¶
-
class
katana.monitor.
Monitor
¶ A monitor object recieves notifications from units whenever data, artifacts or flags are found while processing a target. The default monitor simply saves all artifacts to the artifact directory, and recurses on all data. It will also print flags to the console via it’s logger.
-
on_artifact
(manager: katana.manager.Manager, unit: katana.unit.Unit, path: str = None) → None¶ Notify the monitor that an artifact was found and may be of interest to store in a file. This may be a temporary file already open (which will be lost after the unit ends) or some data which appears to be a file. By default, this file is saved under the outdir directory of the Manager. The return value indicates whether a new target should be queued for recursion with this artifact as an upstream
-
on_completion
(manager: katana.manager.Manager, timed_out: bool) → None¶ This is called upon completion of evaluation (after manager.join() is complete). timed_out indicates if we reached a timeout.
-
on_data
(manager: katana.manager.Manager, unit: katana.unit.Unit, data: Any) → None¶ Notify the monitor of arbitrary data returned by a unit. The data could be of any type, but is likely bytes and should never be str (for complient units). The return value should indicate whether the given data should be recursed on (or re-evaluated for further unit processing). By default, all data is recursed on
-
on_depth_limit
(manager: katana.manager.Manager, target: katana.target.Target, unit: katana.unit.Unit) → None¶ This means we reached the manager[‘manager’][‘max-depth’] limit during recursion.
-
on_download_update
(manager: katana.manager.Manager, download: katana.manager.Download) → None¶ Called at most once per second while downloading files for targets
-
on_exception
(manager: katana.manager.Manager, unit: katana.unit.Unit, exc: Exception) → None¶ Notify the monitor that an exception occurred while processing a given unit. The exception is passed as the exc parameter
-
on_flag
(manager: katana.manager.Manager, unit: katana.unit.Unit, flag: str) → None¶ Notify the monitor that a flag was found
-
on_manager_exception
(manager: katana.manager.Manager, exc: Exception) → None¶ Called when the manager catches an exception. By default, we do nothing. This is most likely a KeyboardInterrupt or some other signal that was sent to the main thread.
-
on_work
(manager: katana.manager.Manager, threadid: int, unit: katana.unit.Unit, case: Any)¶ Keep track of the thread statuses for asynchronous status updates
-
-
class
katana.monitor.
LoggingMonitor
(*args, **kwargs)¶ -
on_artifact
(manager: katana.manager.Manager, unit: katana.unit.Unit, path: str = None) → None¶ Log a new artifact
-
on_exception
(manager: katana.manager.Manager, unit: katana.unit.Unit, exception: Exception) → None¶ Notify the monitor that an exception occurred while processing a given unit. The exception is passed as the exc parameter
-
on_flag
(manager: katana.manager.Manager, unit: katana.unit.Unit, flag: str)¶ Log the solution chain of units which resulted in the given flag
-