Merge branch 'master' into fix-ipv4-uint8array-concat
This commit is contained in:
commit
8129e61923
@ -144,7 +144,8 @@ module.exports = function (grunt) {
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: "static",
|
||||
reportFilename: "BundleAnalyzerReport.html",
|
||||
openAnalyzer: false
|
||||
openAnalyzer: false,
|
||||
excludeAssets: /.*Worker.js/
|
||||
}),
|
||||
]
|
||||
};
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@ -16373,9 +16373,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/shell-quote": {
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",
|
||||
"integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",
|
||||
"version": "1.8.4",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.4.tgz",
|
||||
"integrity": "sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
"GOST Verify",
|
||||
"GOST Key Wrap",
|
||||
"GOST Key Unwrap",
|
||||
"ROR13",
|
||||
"ROT13",
|
||||
"ROT13 Brute Force",
|
||||
"ROT47",
|
||||
@ -240,6 +241,7 @@
|
||||
"Bit shift right",
|
||||
"Rotate left",
|
||||
"Rotate right",
|
||||
"ROR13",
|
||||
"ROT13",
|
||||
"ROT8000"
|
||||
]
|
||||
|
||||
83
src/core/operations/ROR13.mjs
Normal file
83
src/core/operations/ROR13.mjs
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* ROR13 Hash operation (Windows API hashing convention)
|
||||
* @author fufu_btw
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
|
||||
/**
|
||||
* Implements a ROR13 hash used for API name hashing techniques.
|
||||
*/
|
||||
class ROR13 extends Operation {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "ROR13";
|
||||
this.module = "Default";
|
||||
this.description = "Computes a ROR13 hash used in API hashing techniques.";
|
||||
this.infoURL = "";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "string";
|
||||
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate right (32-bit)
|
||||
*
|
||||
* @param {number} value - input value
|
||||
* @param {number} bits - rotation bits
|
||||
* @returns {number} rotated value
|
||||
*/
|
||||
ror(value, bits) {
|
||||
return ((value >>> bits) | (value << (32 - bits))) >>> 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute ROR13 hash
|
||||
*
|
||||
* @param {byteArray} input - input bytes
|
||||
* @param {Object[]} args - operation arguments
|
||||
* @returns {string} hex hash
|
||||
*/
|
||||
run(input, args) {
|
||||
let hash = 0;
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const chr = input[i] & 0xFF;
|
||||
hash = this.ror(hash, 13);
|
||||
hash = (hash + chr) >>> 0;
|
||||
}
|
||||
|
||||
return "0x" + hash.toString(16).padStart(8, "0").toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight input
|
||||
*
|
||||
* @param {Object[]} pos
|
||||
* @param {Object[]} args
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
highlight(pos, args) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse highlight
|
||||
*
|
||||
* @param {Object[]} pos
|
||||
* @param {Object[]} args
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
highlightReverse(pos, args) {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
export default ROR13;
|
||||
45
tests/operations/tests/ROR13.mjs
Normal file
45
tests/operations/tests/ROR13.mjs
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* ROR13 tests.
|
||||
*
|
||||
* @author fufu_btw [contact@fufu.red]
|
||||
* @copyright Crown Copyright 2026
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "ROR13: AddConsoleAliasW",
|
||||
input: "AddConsoleAliasW",
|
||||
expectedOutput: "0x9916128C",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROR13",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROR13 Hash: LoadLibraryA",
|
||||
input: "LoadLibraryA",
|
||||
expectedOutput: "0xEC0E4E8E",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROR13",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROR13 Hash: CloseHandle",
|
||||
input: "CloseHandle",
|
||||
expectedOutput: "0x0FFD97FB",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROR13",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
Loading…
x
Reference in New Issue
Block a user