From 9cc4e91e1167b1c68bcc966545dae3c65e880a2b Mon Sep 17 00:00:00 2001 From: "Jarisch, Ferdinand" Date: Tue, 10 Oct 2023 14:23:33 +0200 Subject: [PATCH] feat(doip-discover): Add responsive targets to DB --- src/gallia/commands/discover/doip.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallia/commands/discover/doip.py b/src/gallia/commands/discover/doip.py index 704acc512..fb8e0f5c5 100644 --- a/src/gallia/commands/discover/doip.py +++ b/src/gallia/commands/discover/doip.py @@ -88,6 +88,14 @@ async def main2(self, args: Namespace) -> int: logger.error("[🫣] --target must be doip://…") return 2 + if self.db_handler is not None: + try: + await self.db_handler.insert_discovery_run("doip") + except Exception as e: + logger.warning( + f"Could not write the discovery run to the database: {e!r}" + ) + # Discover Hostname and Port tgt_hostname: str tgt_port: int @@ -313,6 +321,8 @@ async def enumerate_target_addresses( # noqa: PLR0913 self.artifacts_dir.joinpath("4_responsive_targets.txt"), "a" ) as f: await f.write(f"{known_targets[-1]}\n") + if self.db_handler is not None: + await self.db_handler.insert_discovery_result(known_targets[-1]) except DoIPNegativeAckError as e: if (