This commit is contained in:
overcuriousity
2025-09-13 23:45:36 +02:00
parent 41d556e2ce
commit b7a57f1552
11 changed files with 125 additions and 150 deletions

View File

@@ -1,6 +1,6 @@
/**
* Graph visualization module for DNSRecon
* Handles network graph rendering using vis.js with enhanced Phase 2 features
* Handles network graph rendering using vis.js
*/
class GraphManager {
@@ -130,7 +130,7 @@ class GraphManager {
}
/**
* Initialize the network graph with enhanced features
* Initialize the network graph
*/
initialize() {
if (this.isInitialized) {
@@ -156,7 +156,7 @@ class GraphManager {
// Add graph controls
this.addGraphControls();
console.log('Enhanced graph initialized successfully');
console.log('Graph initialized successfully');
} catch (error) {
console.error('Failed to initialize graph:', error);
this.showError('Failed to initialize visualization');
@@ -184,12 +184,12 @@ class GraphManager {
}
/**
* Setup enhanced network event handlers
* Setup network event handlers
*/
setupNetworkEvents() {
if (!this.network) return;
// Node click event with enhanced details
// Node click event with details
this.network.on('click', (params) => {
if (params.nodes.length > 0) {
const nodeId = params.nodes[0];
@@ -207,7 +207,7 @@ class GraphManager {
}
});
// Enhanced hover events
// Hover events
this.network.on('hoverNode', (params) => {
const nodeId = params.node;
const node = this.nodes.get(nodeId);
@@ -242,7 +242,6 @@ class GraphManager {
}
/**
* Update graph with new data and enhanced processing
* @param {Object} graphData - Graph data from backend
*/
updateGraph(graphData) {
@@ -326,15 +325,15 @@ class GraphManager {
setTimeout(() => this.fitView(), 800);
}
console.log(`Enhanced graph updated: ${processedNodes.length} nodes, ${processedEdges.length} edges (${newNodes.length} new nodes, ${newEdges.length} new edges)`);
console.log(`Graph updated: ${processedNodes.length} nodes, ${processedEdges.length} edges (${newNodes.length} new nodes, ${newEdges.length} new edges)`);
} catch (error) {
console.error('Failed to update enhanced graph:', error);
console.error('Failed to update graph:', error);
this.showError('Failed to update visualization');
}
}
/**
* Process node data with enhanced styling and metadata
* Process node data with styling and metadata
* @param {Object} node - Raw node data
* @returns {Object} Processed node data
*/
@@ -367,14 +366,17 @@ class GraphManager {
}
if (node.type === 'correlation_object') {
processedNode.label = this.formatNodeLabel(node.metadata.value, node.type);
const value = node.metadata.value;
const label = Array.isArray(value) ? `Correlated (${value.length})` : String(value);
processedNode.label = this.formatNodeLabel(label, node.type);
processedNode.title = Array.isArray(value) ? value.join(', ') : value;
}
return processedNode;
}
/**
* Process edge data with enhanced styling and metadata
* Process edge data with styling and metadata
* @param {Object} edge - Raw edge data
* @returns {Object} Processed edge data
*/
@@ -478,7 +480,7 @@ class GraphManager {
}
/**
* Get enhanced node shape based on type
* Get node shape based on type
* @param {string} nodeType - Node type
* @returns {string} Shape name
*/

View File

@@ -243,7 +243,7 @@ class DNSReconApp {
}
/**
* Enhanced start scan with better error handling
* Start scan with error handling
*/
async startScan(clearGraph = true) {
console.log('=== STARTING SCAN ===');
@@ -318,7 +318,7 @@ class DNSReconApp {
}
}
/**
* Enhanced scan stop with immediate UI feedback
* Scan stop with immediate UI feedback
*/
async stopScan() {
try {
@@ -427,7 +427,7 @@ class DNSReconApp {
}
/**
* Enhanced status update with better error handling
* Status update with better error handling
*/
async updateStatus() {
try {
@@ -668,7 +668,7 @@ class DNSReconApp {
}
/**
* Enhanced UI state management with immediate button updates
* UI state management with immediate button updates
*/
setUIState(state) {
console.log(`Setting UI state to: ${state}`);
@@ -823,7 +823,7 @@ class DNSReconApp {
});
detailsHtml += '</ul></div>';
}
// Section for Attributes
detailsHtml += '<div class="modal-section">';
detailsHtml += '<h4>Attributes</h4>';