diff --git a/providers/crtsh_provider.py b/providers/crtsh_provider.py index 7b061a2..d34ba3a 100644 --- a/providers/crtsh_provider.py +++ b/providers/crtsh_provider.py @@ -514,7 +514,6 @@ class CrtShProvider(BaseProvider): shared = [] # Create a set of certificate IDs from the first list for quick lookup - # <<< FIX: Added robust type checking to handle potentially malformed API data cert1_ids = set() for cert in certs1: cert_id = cert.get('certificate_id') diff --git a/static/js/graph.js b/static/js/graph.js index 07e4609..f1c703f 100644 --- a/static/js/graph.js +++ b/static/js/graph.js @@ -65,7 +65,7 @@ class GraphManager { this.contextMenu = null; this.history = []; this.filterPanel = null; - this.trueRootIds = new Set(); + this.initialTargetIds = new Set(); // Track large entity members for proper hiding this.largeEntityMembers = new Set(); this.isScanning = false; @@ -442,8 +442,7 @@ class GraphManager { this.nodes.update(processedNodes); this.edges.update(processedEdges); - // After data is loaded, compute roots and apply filters - this.computeTrueRoots(); + // After data is loaded, apply filters this.updateFilterControls(); this.applyAllFilters(); @@ -983,6 +982,7 @@ class GraphManager { this.edges.clear(); this.history = []; this.largeEntityMembers.clear(); // Clear large entity tracking + this.clearInitialTargets(); // Show placeholder const placeholder = this.container.querySelector('.graph-placeholder'); @@ -1040,11 +1040,11 @@ class GraphManager { } }); - // BFS traversal from true roots + // BFS traversal from initial targets const traversalQueue = []; - // Start from true roots that aren't excluded - this.trueRootIds.forEach(rootId => { + // Start from initial targets that aren't excluded + this.initialTargetIds.forEach(rootId => { if (!excludedNodeIds.has(rootId)) { const node = this.nodes.get(rootId); if (node && !excludedNodeTypes.has(node.type)) { @@ -1151,33 +1151,20 @@ class GraphManager { forensicStatistics: { visibleNodes: visibleNodes.length, hiddenNodes: hiddenNodes.length, - trueRoots: this.trueRootIds.size, - integrityStatus: visibleNodes.length > 0 && this.trueRootIds.size > 0 ? 'INTACT' : 'COMPROMISED' + initialTargets: this.initialTargetIds.size, + integrityStatus: visibleNodes.length > 0 && this.initialTargetIds.size > 0 ? 'INTACT' : 'COMPROMISED' } }; } - computeTrueRoots() { - this.trueRootIds.clear(); - const allNodes = this.nodes.get({ returnType: 'Object' }); - const allEdges = this.edges.get(); - const inDegrees = {}; - - for (const nodeId in allNodes) { - inDegrees[nodeId] = 0; - } - allEdges.forEach(edge => { - if (inDegrees[edge.to] !== undefined) { - inDegrees[edge.to]++; - } - }); - - for (const nodeId in allNodes) { - if (inDegrees[nodeId] === 0) { - this.trueRootIds.add(nodeId); - } - } - console.log("Computed true roots:", this.trueRootIds); + addInitialTarget(targetId) { + this.initialTargetIds.add(targetId); + console.log("Initial targets:", this.initialTargetIds); + } + + clearInitialTargets() { + this.initialTargetIds.clear(); + console.log("Initial targets cleared."); } updateFilterControls() { diff --git a/static/js/main.js b/static/js/main.js index a2dcd41..7c7b920 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -297,6 +297,8 @@ class DNSReconApp { this.graphManager.clear(); } + this.graphManager.addInitialTarget(target); + console.log(`Scan started for ${target} with depth ${maxDepth}`); // Start polling immediately with faster interval for responsiveness @@ -481,7 +483,7 @@ class DNSReconApp { console.log('- Nodes:', graphData.nodes ? graphData.nodes.length : 0); console.log('- Edges:', graphData.edges ? graphData.edges.length : 0); - if (graphData.nodes) { + /*if (graphData.nodes) { graphData.nodes.forEach(node => { console.log(` Node: ${node.id} (${node.type})`); }); @@ -491,7 +493,7 @@ class DNSReconApp { graphData.edges.forEach(edge => { console.log(` Edge: ${edge.from} -> ${edge.to} (${edge.label})`); }); - } + }*/ // Only update if data has changed if (this.hasGraphChanged(graphData)) {