diff --git a/app.py b/app.py index 4e2f175..3f4f9e8 100644 --- a/app.py +++ b/app.py @@ -72,8 +72,9 @@ def start_scan(): target = data['target'].strip() max_depth = data.get('max_depth', config.default_recursion_depth) clear_graph = data.get('clear_graph', True) + force_rescan_target = data.get('force_rescan_target', None) # **FIX**: Get the new parameter - print(f"Parsed - target: '{target}', max_depth: {max_depth}, clear_graph: {clear_graph}") + print(f"Parsed - target: '{target}', max_depth: {max_depth}, clear_graph: {clear_graph}, force_rescan: {force_rescan_target}") # Validation if not target: @@ -104,7 +105,7 @@ def start_scan(): print(f"Using scanner {id(scanner)} in session {user_session_id}") - success = scanner.start_scan(target, max_depth, clear_graph=clear_graph) + success = scanner.start_scan(target, max_depth, clear_graph=clear_graph, force_rescan_target=force_rescan_target) # **FIX**: Pass the new parameter if success: return jsonify({ diff --git a/core/scanner.py b/core/scanner.py index 0f836c3..63b4543 100644 --- a/core/scanner.py +++ b/core/scanner.py @@ -204,7 +204,7 @@ class Scanner: self._initialize_providers() print("Session configuration updated") - def start_scan(self, target: str, max_depth: int = 2, clear_graph: bool = True) -> bool: + def start_scan(self, target: str, max_depth: int = 2, clear_graph: bool = True, force_rescan_target: Optional[str] = None) -> bool: """Start a new reconnaissance scan with proper cleanup of previous scans.""" print(f"=== STARTING SCAN IN SCANNER {id(self)} ===") print(f"Session ID: {self.session_id}") @@ -268,6 +268,13 @@ class Scanner: if clear_graph: self.graph.clear() + + if force_rescan_target and self.graph.graph.has_node(force_rescan_target): + print(f"Forcing rescan of {force_rescan_target}, clearing provider states.") + node_data = self.graph.graph.nodes[force_rescan_target] + if 'metadata' in node_data and 'provider_states' in node_data['metadata']: + node_data['metadata']['provider_states'] = {} + self.current_target = target.lower().strip() self.max_depth = max_depth self.current_depth = 0 diff --git a/static/js/main.js b/static/js/main.js index ab06ea0..0dec6ac 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -203,7 +203,7 @@ class DNSReconApp { const { nodeId } = e.detail; console.log(`Received iterateScan event for node: ${nodeId}`); this.elements.targetInput.value = nodeId; - this.startScan(false); // Start scan in "add to graph" mode + this.startScan(false, nodeId); // Pass nodeId to force rescan }); // Keyboard shortcuts @@ -246,7 +246,7 @@ class DNSReconApp { /** * Start scan with error handling */ - async startScan(clearGraph = true) { + async startScan(clearGraph = true, forceRescanTarget = null) { console.log('=== STARTING SCAN ==='); try { @@ -279,7 +279,8 @@ class DNSReconApp { const requestData = { target: target, max_depth: maxDepth, - clear_graph: clearGraph + clear_graph: clearGraph, + force_rescan_target: forceRescanTarget }; console.log('Request data:', requestData);