Skip to content

Commit

Permalink
feat(doip-discover): Add responsive targets to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdinandjarisch committed Oct 10, 2023
1 parent 6edb0ab commit 9cc4e91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gallia/commands/discover/doip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit 9cc4e91

Please sign in to comment.