diff --git a/monkey/monkey_island/cc/services/config_schema/basic.py b/monkey/monkey_island/cc/services/config_schema/basic.py index aba80e08a..27b8f1d6f 100644 --- a/monkey/monkey_island/cc/services/config_schema/basic.py +++ b/monkey/monkey_island/cc/services/config_schema/basic.py @@ -48,7 +48,9 @@ BASIC = { "title": "Exploit password list", "type": "array", "uniqueItems": True, - "items": {"type": "string"}, + "items": { + "type": "string", + }, "default": [ "root", "123456", diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js index 38e7ad244..9263ba772 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js @@ -3,6 +3,7 @@ import PbaInput from './PbaInput'; import {API_PBA_LINUX, API_PBA_WINDOWS} from '../pages/ConfigurePage'; import InfoBox from './InfoBox'; import TextBox from './TextBox'; +import HideInput from '../ui-components/HideInput'; export default function UiSchema(props) { const UiSchema = { @@ -13,6 +14,13 @@ export default function UiSchema(props) { classNames: 'config-template-no-header', 'ui:widget': AdvancedMultiSelect } + }, + credentials : { + exploit_password_list: { + items: { + 'ui:widget': HideInput + } + } } }, basic_network: { diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/HideInput.js b/monkey/monkey_island/cc/ui/src/components/ui-components/HideInput.js new file mode 100644 index 000000000..148e9dac3 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/HideInput.js @@ -0,0 +1,44 @@ +import React from 'react'; +import {InputGroup, FormControl} from 'react-bootstrap'; +import '../../styles/components/HideInput.scss' + +class HideInput extends React.PureComponent { + constructor(props) { + super(props); + + this.state = { + hidden: false + }; + this.toggleShow = this.toggleShow.bind(this); + } + + toggleShow() { + this.setState({hidden: ! this.state.hidden}); + } + + onChange(e) { + var value = e.target.value; + return this.props.onChange(value === '' ? this.props.options.emptyValue : value); + } + + render() { + return ( +