mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
ESM: Ported Tidy operations. Updated portOperation script to attempt to find the run function and list related constants.
This commit is contained in:
parent
037e2f3771
commit
66c768fe31
6 changed files with 409 additions and 6 deletions
43
src/core/operations/RemoveNullBytes.mjs
Normal file
43
src/core/operations/RemoveNullBytes.mjs
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
||||
/**
|
||||
* Remove null bytes operation
|
||||
*/
|
||||
class RemoveNullBytes extends Operation {
|
||||
|
||||
/**
|
||||
* RemoveNullBytes constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Remove null bytes";
|
||||
this.module = "Default";
|
||||
this.description = "Removes all null bytes (<code>0x00</code>) from the input.";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "byteArray";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
run(input, args) {
|
||||
const output = [];
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
if (input[i] !== 0) output.push(input[i]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default RemoveNullBytes;
|
Loading…
Add table
Add a link
Reference in a new issue