guardicore / guardicore/monkey

Write a custom widget for comma separated input field

Open
#3,886 1 comment 0 reactions 0 assignees View on GitHub
Complexity: Medium Feature Payloads Plugins
Dominant language
Python
Stars
7.1k
Forks
830
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
We need a custom widget that will be used in a schema for Data Exfiltration payload. That widget should be a comma separated input field that will be used as file extension option in the payload. We need it in order to provide an option to set which file extensions will be selected during Data Exfiltration.

**Describe the solution you'd like**
I have found a pretty cool [sandbox](https://codesandbox.io/p/sandbox/material-demo-xb3zm?file=%2Fdemo.js%3A3%2C8-3%2C20) that will kind of do that. From the sandbox we can see that if we enter `.exe,` it will make it is own badge.

![image](https://github.com/guardicore/monkey/assets/15820737/626bed34-917b-4849-9077-75d112c1023f)

**Describe alternatives you've considered**
Maybe something better then this.

The actual component code from the sandbox:

```javascript
/* eslint-disable no-use-before-define */
import React from "react";
import Autocomplete from "@material-ui/lab/Autocomplete";
import TextField from "@material-ui/core/TextField";

export default function Tags() {
const [value, setValue] = React.useState([]);
const [inputValue, setInputValue] = React.useState("");

return (
{
setValue(newValue);
}}
onInputChange={(event, newInputValue) => {
const options = newInputValue.split(",");

if (options.length > 1) {
setValue(
value
.concat(options)
.map(x => x.trim())
.filter(x => x)
);
} else {
setInputValue(newInputValue);
}
}}
renderInput={params => (

)}
/>
);
}

```

## Tasks

- [ ] Create a component that will be doing exactly what we have in the sandbox
- [ ] Use the Data Exfiltration config schema and change the `File Extension` option to use that component.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.