This commit is contained in:
overcuriousity 2025-09-14 18:02:15 +02:00
parent 7fe7ca41ba
commit 89ae06482e
3 changed files with 86 additions and 93 deletions

View File

@ -163,8 +163,11 @@ class GraphManager:
# Skip creating correlation node - would be redundant
continue
# STEP 2: Filter out node pairs that already have direct edges
eligible_nodes = self._filter_nodes_without_direct_edges(set(corr['nodes']))
# *** CHANGE START ***
# The overly aggressive filtering logic has been removed.
# All nodes involved in the correlation will now be used.
eligible_nodes = set(corr['nodes'])
# *** CHANGE END ***
if len(eligible_nodes) < 2:
# Need at least 2 nodes to create a correlation
@ -196,27 +199,10 @@ class GraphManager:
self.last_modified = datetime.now(timezone.utc).isoformat()
return is_new_node
def _filter_nodes_without_direct_edges(self, node_set: set) -> set:
"""
Filter out nodes that already have direct edges between them.
Returns set of nodes that should be included in correlation.
"""
nodes_list = list(node_set)
eligible_nodes = set(node_set) # Start with all nodes
# Check all pairs of nodes
for i in range(len(nodes_list)):
for j in range(i + 1, len(nodes_list)):
node_a = nodes_list[i]
node_b = nodes_list[j]
# Check if direct edge exists in either direction
if self._has_direct_edge_bidirectional(node_a, node_b):
# Remove both nodes from eligible set since they're already connected
eligible_nodes.discard(node_a)
eligible_nodes.discard(node_b)
return eligible_nodes
# *** CHANGE START ***
# The following function is no longer needed and has been removed to avoid confusion.
# def _filter_nodes_without_direct_edges(self, node_set: set) -> set:
# *** CHANGE END ***
def _has_direct_edge_bidirectional(self, node_a: str, node_b: str) -> bool:
"""

View File

@ -294,9 +294,6 @@ class CrtShProvider(BaseProvider):
except json.JSONDecodeError as e:
self.logger.logger.error(f"Failed to parse JSON response from crt.sh: {e}")
except requests.exceptions.RequestException as e:
self.logger.logger.error(f"HTTP request to crt.sh failed: {e}")
return relationships

View File

@ -64,7 +64,13 @@ class DNSProvider(BaseProvider):
# Query all record types
for record_type in ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT', 'SRV', 'CAA']:
relationships.extend(self._query_record(domain, record_type))
try:
relationships.extend(self._query_record(domain, record_type))
except Exception as e:
self.failed_requests += 1
self.logger.logger.debug(f"{record_type} record query failed for {domain}: {e}")
# Re-raise the exception so the scanner can handle it
raise e
return relationships
@ -121,6 +127,8 @@ class DNSProvider(BaseProvider):
except Exception as e:
self.failed_requests += 1
self.logger.logger.debug(f"Reverse DNS lookup failed for {ip}: {e}")
# Re-raise the exception so the scanner can handle the failure
raise e
return relationships
@ -184,5 +192,7 @@ class DNSProvider(BaseProvider):
except Exception as e:
self.failed_requests += 1
self.logger.logger.debug(f"{record_type} record query failed for {domain}: {e}")
# Re-raise the exception so the scanner can handle it
raise e
return relationships