diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ExportConfigModal.tsx b/monkey/monkey_island/cc/ui/src/components/configuration-components/ExportConfigModal.tsx index c12208170..a6dc47c2d 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ExportConfigModal.tsx +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ExportConfigModal.tsx @@ -38,7 +38,8 @@ const ConfigExportModal = (props: Props) => { .then(res => { let configToExport = res['to_export']; if (res['is_plaintext'] === true) { - const configAsBinary = new Blob([configToExport], {type: 'text/plain;charset=utf-8'}); + const configAsBinary = new Blob([JSON.stringify(configToExport, null, 2)], + {type: 'text/plain;charset=utf-8'}); FileSaver.saveAs(configAsBinary, 'monkey.conf'); } else { diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 251aa12fa..0aae3f356 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -369,6 +369,11 @@ class ConfigurePageComponent extends AuthComponent { this.authFetch(apiEndpoint, request_options); } + exportConfig = () => { + this.updateConfigSection(); + this.setState({showConfigExportModal: true}); + }; + sendConfig() { return ( this.authFetch('/api/configuration/island', @@ -500,9 +505,7 @@ class ConfigurePageComponent extends AuthComponent { Import config