mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
added GootLoader decoder
This commit is contained in:
parent
1bc88728f0
commit
ef3e8eb3b0
5 changed files with 2341 additions and 10661 deletions
44
tests/operations/tests/GootLoaderDecode.mjs
Normal file
44
tests/operations/tests/GootLoaderDecode.mjs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* @author drole [rodelm@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import Operation from "../Operation.mjs";
|
||||
/**
|
||||
* Gootloader decode operation
|
||||
*/
|
||||
class GootLoaderDecode extends Operation {
|
||||
/**
|
||||
* GootLoader constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
this.name = "GootLoader Decode";
|
||||
this.module = "Code";
|
||||
this.description = "Decodes GootLoader JScript code block obfuscation";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
if (!input) return "";
|
||||
let decoded = "";
|
||||
let decodedReversed = "";
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
if (i%2) {
|
||||
decoded += input.charAt(i);
|
||||
} else {
|
||||
decodedReversed += input.charAt(i);
|
||||
}
|
||||
}
|
||||
return decodedReversed.split("").reverse().join("") + decoded;
|
||||
}
|
||||
}
|
||||
|
||||
export default GootLoaderDecode;
|
Loading…
Add table
Add a link
Reference in a new issue