diff --git a/src/controller.js b/src/controller.js index 3924d61..24ffebe 100644 --- a/src/controller.js +++ b/src/controller.js @@ -175,6 +175,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_timeline) + break; + + case 'export': + export_csv(w2ui.grd_timeline) + break; } } @@ -222,6 +230,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_investigated_systems) + break; + + case 'export': + export_csv(w2ui.grd_investigated_systems) + break; } } @@ -286,6 +302,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_malware) + break; + + case 'export': + export_csv(w2ui.grd_malware) + break; } } @@ -395,6 +419,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_accounts) + break; + + case 'export': + export_csv(w2ui.grd_accounts) + break; } } @@ -438,6 +470,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_network) + break; + + case 'export': + export_csv(w2ui.grd_network) + break; } } @@ -492,6 +532,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_exfiltration) + break; + + case 'export': + export_csv(w2ui.grd_exfiltration) + break; } } @@ -568,6 +616,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_systems) + break; + + case 'export': + export_csv(w2ui.grd_systems) + break; } } @@ -589,6 +645,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_investigators) + break; + + case 'export': + export_csv(w2ui.grd_investigators) + break; } } @@ -607,7 +671,17 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_evidence) + break; + + case 'export': + export_csv(w2ui.grd_evidence) + break; } + + } w2ui.grd_evidence.onMenuClick = function(event){ @@ -654,6 +728,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_actions) + break; + + case 'export': + export_csv(w2ui.grd_actions) + break; } } @@ -674,6 +756,14 @@ registerComponents = function(){ case 'remove': currentgrid.remove(currentgrid.getSelection()) break; + + case 'import': + show_import_dialog(w2ui.grd_casenotes) + break; + + case 'export': + export_csv(w2ui.grd_casenotes) + break; } } @@ -693,6 +783,17 @@ registerComponents = function(){ } } + w2ui.grd_import_mapping.toolbar.onClick = function(event){ + + + switch(event.target) { + case 'import': + import_data() + break; + + } + } + diff --git a/src/data.js b/src/data.js index 3f90eaf..32efd1c 100644 --- a/src/data.js +++ b/src/data.js @@ -78,11 +78,12 @@ function updateSOD(){ function updateSODFile() { //TODO: need to write that in a way that it also works when you don0t have the lock. currently all calls to editable will fail when they are not set var fs = require('fs'); - + w2utils.lock($( "#main" ),"Loading file...",true) var filebuffer = fs.readFileSync(currentfile.toString()); case_data = JSON.parse(filebuffer); + w2utils.unlock($( "#main" )) if(case_data.hasOwnProperty(storage_format_version) && case_data.storage_format_version < storage_format_version){ w2alert("You are opening a file created with a newer version of Aurora IR. Please upgrade to the newest version of Aurora IR and try again") return false @@ -143,7 +144,7 @@ function newSOD() { w2confirm('Are you sure you want to create a new SOD? All unsaved data will be lost.', function btn(answer) { if (answer == "Yes") { - case_data = case_template + case_data = data_template w2ui.grd_timeline.clear() w2ui.grd_timeline.render() w2ui.grd_investigated_systems.clear() @@ -312,9 +313,10 @@ function saveSODFile(){ var fs = require("fs"); + w2utils.lock($( "#main" ),"Saving file...",true) var buffer = new Buffer.from(JSON.stringify(case_data,null, "\t")); fs.writeFileSync(currentfile.toString(), buffer); - + w2utils.unlock($( "#main" )) var today = new Date(); var time=('0' + today.getHours()).slice(-2)+':'+('0' + today.getMinutes()).slice(-2)+':'+('0' + today.getSeconds()).slice(-2); @@ -558,7 +560,7 @@ function getNextRECID(grid){ var highest = 1; - for(i=0; i< grid.records.length;i++){ + for(var i=0; i< grid.records.length;i++){ var recid = grid.records[i].recid if(recid>highest) highest=recid @@ -618,7 +620,7 @@ function updateSystems(event){ //check timeline records = w2ui.grd_timeline.records - for(i=0;i -

Aurora 0.6.3

+

Aurora 0.6.4

(c) 2020 Mathias Fuchs (https://cyberfox.blog)

Released under Apache 2.0 License

Supported and used by InfoGuard

diff --git a/src/gui_functions.js b/src/gui_functions.js index 54b4cbb..fb87ee7 100644 --- a/src/gui_functions.js +++ b/src/gui_functions.js @@ -238,9 +238,12 @@ function openMispAddMalwarePopup(recid) { notes = w2ui.grd_malware.get(recid).notes //check what type of hash it is - hashtype = "md5" - if (hash.length == 40) hashtype = "sha1" - if (hash.length == 64) hashtype = "sha256" + hashtype = "none" + if(hash) { + hashtype = "md5" + if (hash.length == 40) hashtype = "sha1" + if (hash.length == 64) hashtype = "sha256" + } records = [ {recid:1, aurora_field_type:"Filename",misp_field_type:"filename",value:filename,comment:notes}, @@ -835,6 +838,53 @@ function showActivityPlot(){ }) } +////////////////////////////////////// +//////// Import GUI Functions //////// +////////////////////////////////////// + +/** + * Prepare and open the popup for import column mapping + * @param recid -record id of right clicked record. + */ +function openImportPopup(fields,content) { + + records = [] + + firstline = CSVtoArray(content[0]) + + for(var i=0; i', + onOpen: function (event) { + event.onComplete = function () { + $('#w2ui-popup #main').w2render('popup_layout') + //render grid into form + w2ui.popup_layout.content('main', w2ui.grd_import_mapping); + }; + }, + onToggle: function (event) { + event.onComplete = function () { + w2ui.popup_layout.resize(); + } + } + }); +} + + + ////////////////////////////////// //////// Helper Functions //////// @@ -884,3 +934,7 @@ function activate_all_context_items(menu){ menu[i].disabled = false } } + + + + diff --git a/src/helper_functions.js b/src/helper_functions.js index f4fa168..83e25f2 100644 --- a/src/helper_functions.js +++ b/src/helper_functions.js @@ -8,3 +8,36 @@ browser_open =function(url){ shell.openExternal(url) } + + + + +/** + * + * Return array of string values, or NULL if CSV string not well formed. + * @param {string} text - csv line + */ +function CSVtoArray(text) { + var re_valid = /^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/; + var re_value = /(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g; + + // Return NULL if input string is not well formed CSV string. + if (!re_valid.test(text)) return null; + + var a = []; // Initialize array to receive values. + text.replace(re_value, // "Walk" the string using replace with callback. + function(m0, m1, m2, m3) { + + // Remove backslash from \' in single quoted values. + if (m1 !== undefined) a.push(m1.replace(/\\'/g, "'")); + + // Remove backslash from \" in double quoted values. + else if (m2 !== undefined) a.push(m2.replace(/\\"/g, '"')); + else if (m3 !== undefined) a.push(m3); + return ''; // Return empty string. + }); + + // Handle special case of empty last value. + if (/,\s*$/.test(text)) a.push(''); + return a; +}; \ No newline at end of file diff --git a/src/import.js b/src/import.js new file mode 100644 index 0000000..af921b9 --- /dev/null +++ b/src/import.js @@ -0,0 +1,61 @@ + +import_lines = [] +import_fieldset = [] +import_grid = null + +function show_import_dialog(grid){ + + // open file + const {remote} = require('electron') + const {dialog} = remote + const path = dialog.showOpenDialog({filters:[{name:"CSV File"}]}); + + if(path == undefined) return; + + var fs = require('fs'); + + w2utils.lock($( "#main" ),"Loading File...",true) + + var filebuffer = fs.readFileSync(path.toString()); + + fieldset = [] + import_fieldset = [] + import_grid = grid + + for(var i=0;i - Aurora Incident Response 0.6.3 + Aurora Incident Response 0.6.4 @@ -42,6 +42,8 @@ + + @@ -81,6 +83,7 @@ $().w2grid(config.grd_actions); $().w2grid(config.grd_casenotes); $().w2grid(config.grd_add_misp); + $().w2grid(config.grd_import_mapping); $().w2layout(config.popup_layout); $().w2layout(config.webdav_popup_layout); $().w2form(config.case_form); diff --git a/src/main.js b/src/main.js index 3a048a5..f2d5cbe 100644 --- a/src/main.js +++ b/src/main.js @@ -38,7 +38,7 @@ function createWindow () { // Open the DevTools - //win.webContents.openDevTools() + win.webContents.openDevTools() // Emitted when the window is closed. win.on('closed', () => {