executive summary

This commit is contained in:
overcuriousity
2025-09-18 00:13:37 +02:00
parent 140ef54674
commit fdc26dcf15
4 changed files with 222 additions and 11 deletions

View File

@@ -62,6 +62,8 @@ class DNSReconApp {
exportModal: document.getElementById('export-modal'),
exportModalClose: document.getElementById('export-modal-close'),
exportGraphJson: document.getElementById('export-graph-json'),
exportTargetsTxt: document.getElementById('export-targets-txt'),
exportExecutiveSummary: document.getElementById('export-executive-summary'),
configureSettings: document.getElementById('configure-settings'),
// Status elements
@@ -165,6 +167,12 @@ class DNSReconApp {
if (this.elements.exportGraphJson) {
this.elements.exportGraphJson.addEventListener('click', () => this.exportGraphJson());
}
if (this.elements.exportTargetsTxt) {
this.elements.exportTargetsTxt.addEventListener('click', () => this.exportTargetsTxt());
}
if (this.elements.exportExecutiveSummary) {
this.elements.exportExecutiveSummary.addEventListener('click', () => this.exportExecutiveSummary());
}
this.elements.configureSettings.addEventListener('click', () => this.showSettingsModal());
@@ -485,6 +493,60 @@ class DNSReconApp {
}
}
}
async exportTargetsTxt() {
await this.exportFile('/api/export/targets', this.elements.exportTargetsTxt, 'Exporting Targets...');
}
async exportExecutiveSummary() {
await this.exportFile('/api/export/summary', this.elements.exportExecutiveSummary, 'Generating Summary...');
}
async exportFile(endpoint, buttonElement, loadingMessage) {
try {
console.log(`Exporting from ${endpoint}...`);
const originalContent = buttonElement.innerHTML;
buttonElement.innerHTML = `<span class="btn-icon">[...]</span><span>${loadingMessage}</span>`;
buttonElement.disabled = true;
const response = await fetch(endpoint, { method: 'GET' });
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
}
const contentDisposition = response.headers.get('content-disposition');
let filename = 'export.txt';
if (contentDisposition) {
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
if (filenameMatch) {
filename = filenameMatch[1].replace(/['"]/g, '');
}
}
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
this.showSuccess('File exported successfully');
this.hideExportModal();
} catch (error) {
console.error(`Failed to export from ${endpoint}:`, error);
this.showError(`Export failed: ${error.message}`);
} finally {
const originalContent = buttonElement._originalContent || buttonElement.innerHTML;
buttonElement.innerHTML = originalContent;
buttonElement.disabled = false;
}
}
/**
* Start polling for scan updates with configurable interval