scheduler fixes

This commit is contained in:
overcuriousity 2025-09-17 00:31:12 +02:00
parent f2db739fa1
commit b984189e08
2 changed files with 17 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class GraphManager:
self.correlation_index = {} self.correlation_index = {}
# Compile regex for date filtering for efficiency # Compile regex for date filtering for efficiency
self.date_pattern = re.compile(r'^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}') self.date_pattern = re.compile(r'^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}')
self.EXCLUDED_KEYS = ['confidence', 'provider', 'timestamp', 'type','crtsh_cert_validity_period_days','crtsh_cert_source'] self.EXCLUDED_KEYS = ['confidence', 'provider', 'timestamp', 'type','cert_validity_period_days','cert_source']
def __getstate__(self): def __getstate__(self):
"""Prepare GraphManager for pickling, excluding compiled regex.""" """Prepare GraphManager for pickling, excluding compiled regex."""
@ -73,7 +73,7 @@ class GraphManager:
attr_provider = attr.get('provider', 'unknown') attr_provider = attr.get('provider', 'unknown')
# Skip excluded attributes and invalid values # Skip excluded attributes and invalid values
if attr_name in self.EXCLUDED_KEYS or not isinstance(attr_value, (str, int, float, bool)) or attr_value is None: if any(excluded_key in attr_name for excluded_key in self.EXCLUDED_KEYS) or not isinstance(attr_value, (str, int, float, bool)) or attr_value is None:
continue continue
if isinstance(attr_value, bool): if isinstance(attr_value, bool):

View File

@ -373,6 +373,7 @@ class Scanner:
task_tuple = (provider_name, target_item) task_tuple = (provider_name, target_item)
if task_tuple in processed_tasks: if task_tuple in processed_tasks:
self.indicators_completed += 1
continue continue
if depth > max_depth: if depth > max_depth:
@ -661,7 +662,7 @@ class Scanner:
target_node_type = NodeType.DOMAIN if node_type == 'domain' else NodeType.IP target_node_type = NodeType.DOMAIN if node_type == 'domain' else NodeType.IP
self.graph.add_node(target, target_node_type) self.graph.add_node(target, target_node_type)
attributes = { attributes_dict = {
'count': len(targets), 'count': len(targets),
'nodes': targets, 'nodes': targets,
'node_type': node_type, 'node_type': node_type,
@ -669,9 +670,21 @@ class Scanner:
'discovery_depth': current_depth, 'discovery_depth': current_depth,
'threshold_exceeded': self.config.large_entity_threshold, 'threshold_exceeded': self.config.large_entity_threshold,
} }
attributes_list = []
for key, value in attributes_dict.items():
attributes_list.append({
"name": key,
"value": value,
"type": "large_entity_info",
"provider": provider_name,
"confidence": 0.9,
"metadata": {}
})
description = f'Large entity created due to {len(targets)} relationships from {provider_name}' description = f'Large entity created due to {len(targets)} relationships from {provider_name}'
self.graph.add_node(entity_id, NodeType.LARGE_ENTITY, attributes=attributes, description=description) self.graph.add_node(entity_id, NodeType.LARGE_ENTITY, attributes=attributes_list, description=description)
# Create edge from source to large entity # Create edge from source to large entity
if provider_result.relationships: if provider_result.relationships: