mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Merge branch 'mattnotmitt-chores/yara-update'
This commit is contained in:
commit
3c165dd7e8
4 changed files with 21 additions and 6 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -8586,9 +8586,9 @@
|
||||||
"integrity": "sha512-RqscTx95+RTKhFAyjedsboR0Lmo3zd8//EuRwQXkdWmsCwYlzarVRaiYg6kS1O8m10MCQkGdrnlK9L4eAmZUwA=="
|
"integrity": "sha512-RqscTx95+RTKhFAyjedsboR0Lmo3zd8//EuRwQXkdWmsCwYlzarVRaiYg6kS1O8m10MCQkGdrnlK9L4eAmZUwA=="
|
||||||
},
|
},
|
||||||
"libyara-wasm": {
|
"libyara-wasm": {
|
||||||
"version": "0.0.12",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/libyara-wasm/-/libyara-wasm-0.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/libyara-wasm/-/libyara-wasm-1.0.1.tgz",
|
||||||
"integrity": "sha512-AjTe4FiBuH4F7HwGT/3UxoRenczXtrbM6oWGrifxb44LrkDh5VxRNg9zwfPpDA5Fcc1iYcXS0WVA/b3DGtD8cQ=="
|
"integrity": "sha512-Vq0EcQ3HRJinFxxb00JZpjyX8NCerazVhSf3+TVt1c21T3pcEJJ3RkanAwT71lW6CCmmmKuNU4QwqsinmR6pKQ=="
|
||||||
},
|
},
|
||||||
"linkify-it": {
|
"linkify-it": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
"jsrsasign": "8.0.12",
|
"jsrsasign": "8.0.12",
|
||||||
"kbpgp": "2.1.3",
|
"kbpgp": "2.1.3",
|
||||||
"libbzip2-wasm": "0.0.4",
|
"libbzip2-wasm": "0.0.4",
|
||||||
"libyara-wasm": "0.0.12",
|
"libyara-wasm": "^1.0.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"loglevel": "^1.6.3",
|
"loglevel": "^1.6.3",
|
||||||
"loglevel-message-prefix": "^3.0.0",
|
"loglevel-message-prefix": "^3.0.0",
|
||||||
|
|
|
@ -61,7 +61,7 @@ class YARARules extends Operation {
|
||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
async run(input, args) {
|
||||||
if (isWorkerEnvironment())
|
if (isWorkerEnvironment())
|
||||||
self.sendStatusMessage("Instantiating YARA...");
|
self.sendStatusMessage("Instantiating YARA...");
|
||||||
const [rules, showStrings, showLengths, showMeta, showCounts] = args;
|
const [rules, showStrings, showLengths, showMeta, showCounts] = args;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import {
|
||||||
cartesianProduct,
|
cartesianProduct,
|
||||||
CSSMinify,
|
CSSMinify,
|
||||||
toBase64,
|
toBase64,
|
||||||
toHex,
|
toHex
|
||||||
} from "../../../src/node/index";
|
} from "../../../src/node/index";
|
||||||
import chef from "../../../src/node/index.mjs";
|
import chef from "../../../src/node/index.mjs";
|
||||||
import TestRegister from "../../lib/TestRegister.mjs";
|
import TestRegister from "../../lib/TestRegister.mjs";
|
||||||
|
@ -1059,5 +1059,20 @@ ExifImageHeight: 57`);
|
||||||
assert.equal(unzipped.value[0].data, "some content");
|
assert.equal(unzipped.value[0].data, "some content");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("YARA Rule Matching", async () => {
|
||||||
|
const input = "foobar foobar bar foo foobar";
|
||||||
|
const output = "Rule \"foo\" matches (4 times):\nPos 0, length 3, identifier $re1, data: \"foo\"\nPos 7, length 3, identifier $re1, data: \"foo\"\nPos 18, length 3, identifier $re1, data: \"foo\"\nPos 22, length 3, identifier $re1, data: \"foo\"\nRule \"bar\" matches (4 times):\nPos 3, length 3, identifier $re1, data: \"bar\"\nPos 10, length 3, identifier $re1, data: \"bar\"\nPos 14, length 3, identifier $re1, data: \"bar\"\nPos 25, length 3, identifier $re1, data: \"bar\"\n";
|
||||||
|
|
||||||
|
const res = await chef.YARARules(input, {
|
||||||
|
rules: "rule foo {strings: $re1 = /foo/ condition: $re1} rule bar {strings: $re1 = /bar/ condition: $re1}",
|
||||||
|
showStrings: true,
|
||||||
|
showStringLengths: true,
|
||||||
|
showMetadata: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(output, res.value);
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue