Skip to content

Commit f5cda91

Browse files
committed
feat(recon): Enhance Arjun parameter discovery with task progress logging
- Added logging and console output to track the progress of Arjun tasks during discovery. - Implemented checks for empty task lists and provided informative messages for task completion. - Updated the final logging to summarize the total discovered paths and parameters.
1 parent 1736774 commit f5cda91

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

src/secnodeapi/services/deep_recon.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,45 @@ async def run_arjun_discovery(
347347
"""
348348
discovered_by_path: Dict[str, List[str]] = {}
349349
semaphore = asyncio.Semaphore(concurrency)
350+
total = len(tasks)
351+
completed = 0
352+
353+
if not tasks:
354+
logger.info("No Arjun discovery tasks to run")
355+
return discovered_by_path
356+
357+
logger.info(
358+
"Starting Arjun parameter discovery",
359+
total_tasks=total,
360+
concurrency=concurrency,
361+
)
362+
console.print(
363+
f"[dim]🚀 Launching [cyan]{total}[/cyan] Arjun tasks "
364+
f"(concurrency={concurrency})...[/]"
365+
)
350366

351367
async def bounded(task: ArjunTask):
352368
async with semaphore:
353-
return await _run_arjun_task(task)
369+
nonlocal completed
370+
console.print(
371+
f"[dim]🔍 Arjun task started:[/] [bold]{task.method}[/bold] {task.endpoint_path}"
372+
)
373+
t, params = await _run_arjun_task(task)
374+
completed += 1
375+
logger.info(
376+
"Arjun task completed",
377+
path=t.endpoint_path,
378+
method=t.method,
379+
discovered_params=len(params),
380+
completed=completed,
381+
total=total,
382+
)
383+
console.print(
384+
f"[dim]✅ Arjun task finished:[/] [bold]{t.method}[/bold] {t.endpoint_path} "
385+
f"(params found: [green]{len(params)}[/green], "
386+
f"progress: {completed}/{total})"
387+
)
388+
return t, params
354389

355390
results = await asyncio.gather(
356391
*[bounded(t) for t in tasks],
@@ -367,6 +402,12 @@ async def bounded(task: ArjunTask):
367402
merged = list(dict.fromkeys(existing + params))
368403
discovered_by_path[task.endpoint_path] = merged
369404

405+
logger.info(
406+
"Arjun parameter discovery phase complete",
407+
total_paths=len(discovered_by_path),
408+
total_params=sum(len(v) for v in discovered_by_path.values()),
409+
)
410+
370411
return discovered_by_path
371412

372413

0 commit comments

Comments
 (0)