it
This commit is contained in:
parent
7fe7ca41ba
commit
89ae06482e
@ -163,8 +163,11 @@ class GraphManager:
|
|||||||
# Skip creating correlation node - would be redundant
|
# Skip creating correlation node - would be redundant
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# STEP 2: Filter out node pairs that already have direct edges
|
# *** CHANGE START ***
|
||||||
eligible_nodes = self._filter_nodes_without_direct_edges(set(corr['nodes']))
|
# 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:
|
if len(eligible_nodes) < 2:
|
||||||
# Need at least 2 nodes to create a correlation
|
# Need at least 2 nodes to create a correlation
|
||||||
@ -196,27 +199,10 @@ class GraphManager:
|
|||||||
self.last_modified = datetime.now(timezone.utc).isoformat()
|
self.last_modified = datetime.now(timezone.utc).isoformat()
|
||||||
return is_new_node
|
return is_new_node
|
||||||
|
|
||||||
def _filter_nodes_without_direct_edges(self, node_set: set) -> set:
|
# *** CHANGE START ***
|
||||||
"""
|
# The following function is no longer needed and has been removed to avoid confusion.
|
||||||
Filter out nodes that already have direct edges between them.
|
# def _filter_nodes_without_direct_edges(self, node_set: set) -> set:
|
||||||
Returns set of nodes that should be included in correlation.
|
# *** CHANGE END ***
|
||||||
"""
|
|
||||||
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
|
|
||||||
|
|
||||||
def _has_direct_edge_bidirectional(self, node_a: str, node_b: str) -> bool:
|
def _has_direct_edge_bidirectional(self, node_a: str, node_b: str) -> bool:
|
||||||
"""
|
"""
|
||||||
|
@ -294,9 +294,6 @@ class CrtShProvider(BaseProvider):
|
|||||||
|
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
self.logger.logger.error(f"Failed to parse JSON response from crt.sh: {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
|
return relationships
|
||||||
|
|
||||||
|
@ -64,7 +64,13 @@ class DNSProvider(BaseProvider):
|
|||||||
|
|
||||||
# Query all record types
|
# Query all record types
|
||||||
for record_type in ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT', 'SRV', 'CAA']:
|
for record_type in ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT', 'SRV', 'CAA']:
|
||||||
|
try:
|
||||||
relationships.extend(self._query_record(domain, record_type))
|
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
|
return relationships
|
||||||
|
|
||||||
@ -121,6 +127,8 @@ class DNSProvider(BaseProvider):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.failed_requests += 1
|
self.failed_requests += 1
|
||||||
self.logger.logger.debug(f"Reverse DNS lookup failed for {ip}: {e}")
|
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
|
return relationships
|
||||||
|
|
||||||
@ -184,5 +192,7 @@ class DNSProvider(BaseProvider):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.failed_requests += 1
|
self.failed_requests += 1
|
||||||
self.logger.logger.debug(f"{record_type} record query failed for {domain}: {e}")
|
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
|
return relationships
|
Loading…
x
Reference in New Issue
Block a user