Skip to content

Commit

Permalink
feat(scan-sessions): add fast search option, which only searches once…
Browse files Browse the repository at this point in the history
… from each session, ignoring the remaining stack
  • Loading branch information
fkglr committed Jun 28, 2022
1 parent f15be9d commit 41d96d4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gallia/udscan/scanner/scan_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def add_parser(self) -> None:
self.parser.add_argument(
"--reset", action="store_true", help="Reset the ECU after each iteration"
)
self.parser.add_argument(
"--fast",
action="store_true",
help="Only search for new sessions once in a particular session, i.e. ignore different stacks",
)

async def set_session_with_hooks_handling(
self, session: int, use_hooks: bool
Expand Down Expand Up @@ -105,6 +110,7 @@ async def main(self, args: Namespace) -> None:
positive_results: list[dict] = []
negative_results: list[dict] = []
activated_sessions: set[int] = set()
search_sessions: list[int] = []

sessions = list(range(1, 0x80))
depth = 0
Expand All @@ -117,6 +123,11 @@ async def main(self, args: Namespace) -> None:
self.logger.log_summary(f"Depth: {depth}")

for stack in found[depth - 1]:
if args.fast and stack[-1] in search_sessions:
continue

search_sessions.append(stack[-1])

if stack:
self.logger.log_summary(
f"Starting from session: {g_repr(stack[-1])}"
Expand Down

0 comments on commit 41d96d4

Please sign in to comment.