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
new file mode 100644
index 000000000..48a4d3df5
--- /dev/null
+++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ExportConfigModal.tsx
@@ -0,0 +1,115 @@
+import {Button, Modal, Form} from 'react-bootstrap';
+import React, {useState} from 'react';
+
+import AuthComponent from '../AuthComponent';
+import '../../styles/components/configuration-components/ExportConfigModal.scss';
+
+
+type Props = {
+ show: boolean,
+ onClick: () => void
+}
+
+const ConfigExportModal = (props: Props) => {
+ // TODO implement the back end
+ const configExportEndpoint = '/api/configuration/export';
+
+ const [pass, setPass] = useState('');
+ const [radioValue, setRadioValue] = useState('password');
+ const authComponent = new AuthComponent({});
+
+ function isExportBtnDisabled() {
+ return pass === '' && radioValue === 'password';
+ }
+
+ function onSubmit() {
+ authComponent.authFetch(configExportEndpoint,
+ {
+ method: 'POST',
+ headers: {'Content-Type': 'application/json'},
+ body: JSON.stringify({
+ should_encrypt: (radioValue === 'password'),
+ password: pass
+ })
+ }
+ )
+ }
+
+ return (
+
+
+ Configuration export
+
+
+
+
}
+ name={'export-choice'}
+ value={'password'}
+ onChange={evt => {
+ setRadioValue(evt.target.value)
+ }}
+ checked={radioValue === 'password'}
+ />
+
+
+
+
+
+
+
+
+ )
+}
+
+const PasswordInput = (props: {
+ onChange: (passValue) => void
+}) => {
+ return (
+
+
Encrypt with a password:
+
(props.onChange(evt.target.value))}/>
+
+ )
+}
+
+const ExportPlaintextChoiceField = (props: {
+ radioValue: string,
+ onChange: (radioValue) => void
+}) => {
+ return (
+
+
{
+ props.onChange(evt.target.value);
+ }}
+ />
+
+ Configuration may contain stolen credentials or sensitive data.
+ It is advised to use password encryption.
+
+
+ )
+}
+
+
+export default ConfigExportModal;
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 4cae9b2bf..9b2251cd8 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
@@ -14,6 +14,7 @@ import InternalConfig from '../configuration-components/InternalConfig';
import UnsafeOptionsConfirmationModal from '../configuration-components/UnsafeOptionsConfirmationModal.js';
import UnsafeOptionsWarningModal from '../configuration-components/UnsafeOptionsWarningModal.js';
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js';
+import ConfigExportModal from '../configuration-components/ExportConfigModal';
const ATTACK_URL = '/api/attack';
const CONFIG_URL = '/api/configuration/island';
@@ -40,7 +41,8 @@ class ConfigurePageComponent extends AuthComponent {
selectedSection: 'attack',
showAttackAlert: false,
showUnsafeOptionsConfirmation: false,
- showUnsafeAttackOptionsWarning: false
+ showUnsafeAttackOptionsWarning: false,
+ showConfigExportModal: false
};
}
@@ -220,6 +222,14 @@ class ConfigurePageComponent extends AuthComponent {
this.setState({configuration: newConfig, lastAction: 'none'});
};
+ renderConfigExportModal = () => {
+ return ()}
+
+ onExport = () => {
+ this.setState({showConfigExportModal: false})
+ }
+
renderAttackAlertModal = () => {
return ( {
this.setState({showAttackAlert: false})
@@ -488,6 +498,7 @@ class ConfigurePageComponent extends AuthComponent {
+ {this.renderConfigExportModal()}
{this.renderAttackAlertModal()}
{this.renderUnsafeOptionsConfirmationModal()}
{this.renderUnsafeAttackOptionsWarningModal()}
@@ -509,7 +520,9 @@ class ConfigurePageComponent extends AuthComponent {
-