Tidied up YARA operation

This commit is contained in:
n1474335 2019-01-18 15:34:56 +00:00
parent 4cabb849f3
commit ba04cac7ac
5 changed files with 118 additions and 89 deletions

View file

@ -35,25 +35,21 @@ class YARARules extends Operation {
{
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
},
{
name: "Show counts",
type: "boolean",
hint: "Show the number of matches per rule",
value: true
}
];
@ -66,7 +62,7 @@ class YARARules extends Operation {
*/
run(input, args) {
if (ENVIRONMENT_IS_WORKER())
self.sendStatusMessage("Instantiating YARA.");
self.sendStatusMessage("Instantiating YARA...");
const [rules, showStrings, showLengths, showMeta, showCounts] = args;
return new Promise((resolve, reject) => {
Yara().then(yara => {

View file

@ -376,6 +376,7 @@ class RecipeWaiter {
}
}
/**
* Adds the specified operation to the recipe.
*
@ -453,6 +454,7 @@ class RecipeWaiter {
window.dispatchEvent(this.manager.statechange);
}
/**
* Handler for text argument dragover events.
* Gives the user a visual cue to show that items can be dropped here.
@ -469,6 +471,7 @@ class RecipeWaiter {
e.target.closest("textarea.arg").classList.add("dropping-file");
}
/**
* Handler for text argument dragleave events.
* Removes the visual cue.
@ -481,6 +484,7 @@ class RecipeWaiter {
e.target.classList.remove("dropping-file");
}
/**
* Handler for text argument drop events.
* Loads the dragged data into the argument textarea.
@ -510,7 +514,10 @@ class RecipeWaiter {
const self = this;
reader.onload = function (e) {
targ.value = e.target.result;
self.ingChange();
// Trigger floating label move
const changeEvent = new Event('change');
targ.dispatchEvent(changeEvent);
window.dispatchEvent(self.manager.statechange);
};
reader.readAsText(file);
}
@ -542,6 +549,7 @@ class RecipeWaiter {
op.insertAdjacentHTML("beforeend", registerListEl);
}
/**
* Adjusts the number of ingredient columns as the width of the recipe changes.
*/

View file

@ -123,6 +123,7 @@
.dropping-file {
border: 5px dashed var(--drop-file-border-colour) !important;
margin: -5px;
}
#stale-indicator {