diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx b/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx
new file mode 100644
index 000000000..68f2bdea9
--- /dev/null
+++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx
@@ -0,0 +1,104 @@
+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 ConfigImportModal = (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 import
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+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 might contain stolen credentials or sensitive data.
+ It is advised to use password encryption option.
+
+
+ )
+}
+
+
+export default ConfigImportModal;
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 9b2251cd8..55484b175 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
@@ -15,6 +15,7 @@ import UnsafeOptionsConfirmationModal from '../configuration-components/UnsafeOp
import UnsafeOptionsWarningModal from '../configuration-components/UnsafeOptionsWarningModal.js';
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js';
import ConfigExportModal from '../configuration-components/ExportConfigModal';
+import ConfigImportModal from '../configuration-components/ImportConfigModal';
const ATTACK_URL = '/api/attack';
const CONFIG_URL = '/api/configuration/island';
@@ -42,7 +43,8 @@ class ConfigurePageComponent extends AuthComponent {
showAttackAlert: false,
showUnsafeOptionsConfirmation: false,
showUnsafeAttackOptionsWarning: false,
- showConfigExportModal: false
+ showConfigExportModal: false,
+ showConfigImportModal: false
};
}
@@ -230,6 +232,14 @@ class ConfigurePageComponent extends AuthComponent {
this.setState({showConfigExportModal: false})
}
+ renderConfigImportModal = () => {
+ return ()}
+
+ onImport = () => {
+ this.setState({showConfigImportModal: false})
+ }
+
renderAttackAlertModal = () => {
return ( {
this.setState({showAttackAlert: false})
@@ -499,6 +509,7 @@ class ConfigurePageComponent extends AuthComponent {
lg={{offset: 3, span: 8}} xl={{offset: 2, span: 8}}
className={'main'}>
{this.renderConfigExportModal()}
+ {this.renderConfigImportModal()}
{this.renderAttackAlertModal()}
{this.renderUnsafeOptionsConfirmationModal()}
{this.renderUnsafeAttackOptionsWarningModal()}
@@ -514,12 +525,10 @@ class ConfigurePageComponent extends AuthComponent {
-