mirror of
https://github.com/gchq/CyberChef
synced 2024-11-15 00:57:08 +00:00
Fixed problems flagged by n's review
This commit is contained in:
parent
ebb632e888
commit
dd9ba4d250
4 changed files with 19 additions and 22 deletions
|
@ -23,6 +23,7 @@ class Ingredient {
|
|||
this._value = null;
|
||||
this.disabled = false;
|
||||
this.hint = "";
|
||||
this.rows = 0;
|
||||
this.toggleValues = [];
|
||||
this.target = null;
|
||||
this.defaultIndex = 0;
|
||||
|
@ -45,6 +46,7 @@ class Ingredient {
|
|||
this.defaultValue = ingredientConfig.value;
|
||||
this.disabled = !!ingredientConfig.disabled;
|
||||
this.hint = ingredientConfig.hint || false;
|
||||
this.rows = ingredientConfig.rows || false;
|
||||
this.toggleValues = ingredientConfig.toggleValues;
|
||||
this.target = typeof ingredientConfig.target !== "undefined" ? ingredientConfig.target : null;
|
||||
this.defaultIndex = typeof ingredientConfig.defaultIndex !== "undefined" ? ingredientConfig.defaultIndex : 0;
|
||||
|
|
|
@ -179,6 +179,7 @@ class Operation {
|
|||
|
||||
if (ing.toggleValues) conf.toggleValues = ing.toggleValues;
|
||||
if (ing.hint) conf.hint = ing.hint;
|
||||
if (ing.rows) conf.rows = ing.rows;
|
||||
if (ing.disabled) conf.disabled = ing.disabled;
|
||||
if (ing.target) conf.target = ing.target;
|
||||
if (ing.defaultIndex) conf.defaultIndex = ing.defaultIndex;
|
||||
|
|
|
@ -9,41 +9,45 @@ import OperationError from "../errors/OperationError";
|
|||
import Yara from "libyara-wasm";
|
||||
|
||||
/**
|
||||
* Yara Rules operation
|
||||
* YARA Rules operation
|
||||
*/
|
||||
class YaraRules extends Operation {
|
||||
class YARARules extends Operation {
|
||||
|
||||
/**
|
||||
* YaraRules constructor
|
||||
* YARARules constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Yara Rules";
|
||||
this.name = "YARA Rules";
|
||||
this.module = "Yara";
|
||||
this.description = "Yara support";
|
||||
this.infoURL = "https://en.wikipedia.org/wiki/YARA";
|
||||
this.description = "YARA is a tool developed at VirusTotal, primarily aimed at helping malware researchers to identify and classify malware samples. It matches based on rules specified by the user containing textual or binary patterns and a boolean expression. For help on writing rules, see the <a href='https://yara.readthedocs.io/en/latest/writingrules.html'>YARA documentation.</a>";
|
||||
this.infoURL = "https://wikipedia.org/wiki/YARA";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
this.args = [
|
||||
{
|
||||
name: "Rules",
|
||||
type: "code",
|
||||
value: ""
|
||||
type: "text",
|
||||
value: "",
|
||||
rows: 5
|
||||
},
|
||||
{
|
||||
name: "Show strings",
|
||||
type: "boolean",
|
||||
hint: "Show each match's data",
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: "Show string lengths",
|
||||
type: "boolean",
|
||||
hint: "Show the length of each match's data",
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: "Show metadata",
|
||||
type: "boolean",
|
||||
hint: "Show the metadata of each rule",
|
||||
value: false
|
||||
}
|
||||
];
|
||||
|
@ -59,7 +63,7 @@ class YaraRules extends Operation {
|
|||
return new Promise((resolve, reject) => {
|
||||
Yara().then(yara => {
|
||||
let matchString = "";
|
||||
const inpArr = new Uint8Array(input); // I know this is garbage but it's like 1.5 times faster
|
||||
const inpArr = new Uint8Array(input);
|
||||
const inpVec = new yara.vectorChar();
|
||||
for (let i = 0; i < inpArr.length; i++) {
|
||||
inpVec.push_back(inpArr[i]);
|
||||
|
@ -107,4 +111,4 @@ class YaraRules extends Operation {
|
|||
|
||||
}
|
||||
|
||||
export default YaraRules;
|
||||
export default YARARules;
|
|
@ -25,6 +25,7 @@ class HTMLIngredient {
|
|||
this.value = config.value;
|
||||
this.disabled = config.disabled || false;
|
||||
this.hint = config.hint || false;
|
||||
this.rows = config.rows || false;
|
||||
this.target = config.target;
|
||||
this.defaultIndex = config.defaultIndex || 0;
|
||||
this.toggleValues = config.toggleValues;
|
||||
|
@ -42,18 +43,6 @@ class HTMLIngredient {
|
|||
i, m;
|
||||
|
||||
switch (this.type) {
|
||||
case "code":
|
||||
html+= `<div class="form-group">
|
||||
<label for="${this.id}" class="bmd-label-floating">${this.name}</label>
|
||||
<textarea class="form-control arg"
|
||||
id="${this.id}"
|
||||
arg-name="${this.name}"
|
||||
value="${this.value}"
|
||||
rows=5
|
||||
${this.disabled ? "disabled" : ""}></textarea>
|
||||
${this.hint ? "<span class='bmd-help'>" + this.hint + "</span>" : ""}
|
||||
</div>`;
|
||||
break;
|
||||
case "string":
|
||||
case "binaryString":
|
||||
case "byteArray":
|
||||
|
@ -241,6 +230,7 @@ class HTMLIngredient {
|
|||
class="form-control arg"
|
||||
id="${this.id}"
|
||||
arg-name="${this.name}"
|
||||
rows="${this.rows ? this.rows : 3}"
|
||||
${this.disabled ? "disabled" : ""}>${this.value}</textarea>
|
||||
${this.hint ? "<span class='bmd-help'>" + this.hint + "</span>" : ""}
|
||||
</div>`;
|
||||
|
|
Loading…
Reference in a new issue