Merge branch '1183/hide-input-component' into develop

PR #1417
This commit is contained in:
Ilija Lazoroski 2021-08-20 13:59:45 +02:00
commit 9f194f3417
4 changed files with 61 additions and 3 deletions

View File

@ -6,10 +6,10 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Misaligned buttons and input fields on exploiter and network configuration
pages. #1353
- Credentials shown in plain text on configuration screens. #1183
## [1.11.0] - 2021-08-13
### Added

View File

@ -48,7 +48,9 @@ BASIC = {
"title": "Exploit password list",
"type": "array",
"uniqueItems": True,
"items": {"type": "string"},
"items": {
"type": "string",
},
"default": [
"root",
"123456",

View File

@ -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 SensitiveTextInput from '../ui-components/SensitiveTextInput';
export default function UiSchema(props) {
const UiSchema = {
@ -22,7 +23,8 @@ export default function UiSchema(props) {
},
exploit_password_list: {
items: {
classNames: 'config-template-no-header'
classNames: 'config-template-no-header',
'ui:widget': SensitiveTextInput
}
}
}
@ -131,6 +133,18 @@ export default function UiSchema(props) {
aws_keys: {
classNames: 'config-field-hidden'
}
},
exploits: {
exploit_lm_hash_list:{
items: {
'ui:widget': SensitiveTextInput
}
},
exploit_ntlm_hash_list: {
items: {
'ui:widget': SensitiveTextInput
}
}
}
}
};

View File

@ -0,0 +1,42 @@
import React from 'react';
import {InputGroup, FormControl} from 'react-bootstrap';
class SensitiveTextInput extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
hidden: false
};
}
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 (
<div>
<InputGroup>
<FormControl
value={this.props.value || ''}
type={this.state.hidden ? 'text' : 'password'}
onChange={(event) => this.onChange(event)}
/>
<InputGroup.Append>
<InputGroup.Text onClick={this.toggleShow} >
<i className={this.state.hidden ? 'fas fa-eye-slash' : 'fas fa-eye'}></i>
</InputGroup.Text>
</InputGroup.Append>
</InputGroup>
</div>
);
}
}
export default SensitiveTextInput;