Compare commits
	
		
			2 Commits
		
	
	
		
			bcd79ae2f5
			...
			71a05f5b32
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					71a05f5b32 | ||
| 
						 | 
					1b0c630667 | 
@ -664,9 +664,6 @@ class Scanner:
 | 
				
			|||||||
        print(f"Enqueueing correlation tasks for {len(all_nodes)} nodes")
 | 
					        print(f"Enqueueing correlation tasks for {len(all_nodes)} nodes")
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        for node_id in all_nodes:
 | 
					        for node_id in all_nodes:
 | 
				
			||||||
            if self._is_stop_requested():
 | 
					 | 
				
			||||||
                break
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
            # Determine appropriate depth for correlation (use 0 for simplicity)
 | 
					            # Determine appropriate depth for correlation (use 0 for simplicity)
 | 
				
			||||||
            correlation_depth = 0
 | 
					            correlation_depth = 0
 | 
				
			||||||
            task_tuple = ('correlation', node_id, correlation_depth)
 | 
					            task_tuple = ('correlation', node_id, correlation_depth)
 | 
				
			||||||
@ -684,7 +681,7 @@ class Scanner:
 | 
				
			|||||||
        consecutive_empty_iterations = 0
 | 
					        consecutive_empty_iterations = 0
 | 
				
			||||||
        max_empty_iterations = 20  # Shorter timeout for correlation phase
 | 
					        max_empty_iterations = 20  # Shorter timeout for correlation phase
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        while not self._is_stop_requested() and correlation_tasks:
 | 
					        while correlation_tasks:
 | 
				
			||||||
            queue_empty = self.task_queue.empty()
 | 
					            queue_empty = self.task_queue.empty()
 | 
				
			||||||
            with self.processing_lock:
 | 
					            with self.processing_lock:
 | 
				
			||||||
                no_active_processing = len(self.currently_processing) == 0
 | 
					                no_active_processing = len(self.currently_processing) == 0
 | 
				
			||||||
@ -720,8 +717,6 @@ class Scanner:
 | 
				
			|||||||
                continue
 | 
					                continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            with self.processing_lock:
 | 
					            with self.processing_lock:
 | 
				
			||||||
                if self._is_stop_requested():
 | 
					 | 
				
			||||||
                    break
 | 
					 | 
				
			||||||
                processing_key = (provider_name, target_item)
 | 
					                processing_key = (provider_name, target_item)
 | 
				
			||||||
                if processing_key in self.currently_processing:
 | 
					                if processing_key in self.currently_processing:
 | 
				
			||||||
                    self.tasks_skipped += 1
 | 
					                    self.tasks_skipped += 1
 | 
				
			||||||
@ -733,9 +728,6 @@ class Scanner:
 | 
				
			|||||||
                self.current_indicator = target_item
 | 
					                self.current_indicator = target_item
 | 
				
			||||||
                self._update_session_state()
 | 
					                self._update_session_state()
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                if self._is_stop_requested():
 | 
					 | 
				
			||||||
                    break
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                # Process correlation task
 | 
					                # Process correlation task
 | 
				
			||||||
                new_targets, _, success = self._process_provider_task(correlation_provider, target_item, depth)
 | 
					                new_targets, _, success = self._process_provider_task(correlation_provider, target_item, depth)
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
@ -762,7 +754,7 @@ class Scanner:
 | 
				
			|||||||
        Manages the entire process for a given target and provider.
 | 
					        Manages the entire process for a given target and provider.
 | 
				
			||||||
        This version is generalized to handle all relationships dynamically.
 | 
					        This version is generalized to handle all relationships dynamically.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if self._is_stop_requested():
 | 
					        if self._is_stop_requested() and not isinstance(provider, CorrelationProvider):
 | 
				
			||||||
            return set(), set(), False
 | 
					            return set(), set(), False
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        is_ip = _is_valid_ip(target)
 | 
					        is_ip = _is_valid_ip(target)
 | 
				
			||||||
@ -779,7 +771,8 @@ class Scanner:
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
            if provider_result is None:
 | 
					            if provider_result is None:
 | 
				
			||||||
                provider_successful = False
 | 
					                provider_successful = False
 | 
				
			||||||
            elif not self._is_stop_requested():
 | 
					            # Allow correlation provider to process results even if scan is stopped
 | 
				
			||||||
 | 
					            elif not self._is_stop_requested() or isinstance(provider, CorrelationProvider):
 | 
				
			||||||
                # Pass all relationships to be processed
 | 
					                # Pass all relationships to be processed
 | 
				
			||||||
                discovered, is_large_entity = self._process_provider_result_unified(
 | 
					                discovered, is_large_entity = self._process_provider_result_unified(
 | 
				
			||||||
                    target, provider, provider_result, depth
 | 
					                    target, provider, provider_result, depth
 | 
				
			||||||
@ -799,7 +792,7 @@ class Scanner:
 | 
				
			|||||||
        provider_name = provider.get_name()
 | 
					        provider_name = provider.get_name()
 | 
				
			||||||
        start_time = datetime.now(timezone.utc)
 | 
					        start_time = datetime.now(timezone.utc)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if self._is_stop_requested():
 | 
					        if self._is_stop_requested() and not isinstance(provider, CorrelationProvider):
 | 
				
			||||||
            return None
 | 
					            return None
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
@ -808,7 +801,7 @@ class Scanner:
 | 
				
			|||||||
            else:
 | 
					            else:
 | 
				
			||||||
                result = provider.query_domain(target)
 | 
					                result = provider.query_domain(target)
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if self._is_stop_requested():
 | 
					            if self._is_stop_requested() and not isinstance(provider, CorrelationProvider):
 | 
				
			||||||
                return None
 | 
					                return None
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            relationship_count = result.get_relationship_count() if result else 0
 | 
					            relationship_count = result.get_relationship_count() if result else 0
 | 
				
			||||||
@ -902,7 +895,8 @@ class Scanner:
 | 
				
			|||||||
        large_entity_id = ""
 | 
					        large_entity_id = ""
 | 
				
			||||||
        large_entity_members = set()
 | 
					        large_entity_members = set()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self._is_stop_requested():
 | 
					        # Stop processing for non-correlation providers if requested
 | 
				
			||||||
 | 
					        if self._is_stop_requested() and not isinstance(provider, CorrelationProvider):
 | 
				
			||||||
            return discovered_targets, False
 | 
					            return discovered_targets, False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        eligible_rel_count = sum(
 | 
					        eligible_rel_count = sum(
 | 
				
			||||||
@ -916,7 +910,8 @@ class Scanner:
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for i, relationship in enumerate(provider_result.relationships):
 | 
					        for i, relationship in enumerate(provider_result.relationships):
 | 
				
			||||||
            if i % 5 == 0 and self._is_stop_requested():
 | 
					            # Stop processing for non-correlation providers if requested
 | 
				
			||||||
 | 
					            if i % 5 == 0 and self._is_stop_requested() and not isinstance(provider, CorrelationProvider):
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            source_node_id = relationship.source_node
 | 
					            source_node_id = relationship.source_node
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user