Merge branch 'master' into jwt-decode-verify
This commit is contained in:
commit
a09772b5f5
@ -725,7 +725,7 @@ Breaking changes:
|
||||
[10.11.0]: https://github.com/gchq/CyberChef/releases/tag/v10.11.0
|
||||
[10.10.0]: https://github.com/gchq/CyberChef/releases/tag/v10.10.0
|
||||
[10.9.0]: https://github.com/gchq/CyberChef/releases/tag/v10.9.0
|
||||
[10.8.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0
|
||||
[10.8.0]: https://github.com/gchq/CyberChef/releases/tag/v10.8.0
|
||||
[10.7.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0
|
||||
[10.6.0]: https://github.com/gchq/CyberChef/releases/tag/v10.6.0
|
||||
[10.5.0]: https://github.com/gchq/CyberChef/releases/tag/v10.5.0
|
||||
|
||||
@ -138,6 +138,8 @@ class Chef {
|
||||
|
||||
if (!highlights) return false;
|
||||
|
||||
if (direction === "reverse") highlights.reverse();
|
||||
|
||||
for (let i = 0; i < highlights.length; i++) {
|
||||
// Remove multiple highlights before processing again
|
||||
pos = [pos[0]];
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
class DishType {
|
||||
|
||||
/**
|
||||
* Warn translations dont work without value from bind
|
||||
* Warn translations don't work without value from bind
|
||||
*/
|
||||
static checkForValue(value) {
|
||||
if (value === undefined) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Custom error type for handling operation that isnt included in node.js API
|
||||
* Custom error type for handling operation that isn't included in node.js API
|
||||
*
|
||||
* @author d98762625 [d98762625@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
|
||||
@ -50,6 +50,14 @@ class GenerateDeBruijnSequence extends Operation {
|
||||
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
|
||||
}
|
||||
|
||||
if (!Number.isInteger(k)) {
|
||||
throw new OperationError("Invalid alphabet size, required to be integer.");
|
||||
}
|
||||
|
||||
if (!Number.isInteger(n)) {
|
||||
throw new OperationError("Invalid key length, required to be integer.");
|
||||
}
|
||||
|
||||
if (n < 2) {
|
||||
throw new OperationError("Invalid key length, required to be at least 2.");
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ class ParityBit extends Operation {
|
||||
|
||||
this.name = "Parity Bit";
|
||||
this.module = "Default";
|
||||
this.description = "A parity bit, or check bit, is the simplest form of error detection. It is a bit which is added to a string of bits and represents if the number of 1's in the binary string is an even number or odd number.<br><br>If a delimiter is specified, the parity bit calculation will be performed on each 'block' of the input data, where the blocks are created by slicing the input at each occurence of the delimiter character";
|
||||
this.description = "A parity bit, or check bit, is the simplest form of error detection. It is a bit which is added to a string of bits and represents if the number of 1's in the binary string is an even number or odd number.<br><br>If a delimiter is specified, the parity bit calculation will be performed on each 'block' of the input data, where the blocks are created by slicing the input at each occurrence of the delimiter character";
|
||||
this.infoURL = "https://wikipedia.org/wiki/Parity_bit";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
|
||||
@ -74,7 +74,7 @@ class ParseIPv4Header extends Operation {
|
||||
checksum = input[10] << 8 | input[11],
|
||||
srcIP = input[12] << 24 | input[13] << 16 | input[14] << 8 | input[15],
|
||||
dstIP = input[16] << 24 | input[17] << 16 | input[18] << 8 | input[19],
|
||||
checksumHeader = input.slice(0, 10).concat([0, 0]).concat(input.slice(12, 20));
|
||||
checksumHeader = [...input.slice(0, 10), 0, 0, ...input.slice(12, 20)];
|
||||
let version = (input[0] >>> 4) & 0x0f,
|
||||
options = [];
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class SHA2 extends Operation {
|
||||
|
||||
this.name = "SHA2";
|
||||
this.module = "Crypto";
|
||||
this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.<br><br><ul><li>SHA-512 operates on 64-bit words.</li><li>SHA-256 operates on 32-bit words.</li><li>SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.</li><li>SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.</li><li>SHA-512/224 and SHA-512/256 are truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.</li></ul> The message digest algorithm for SHA256 variants consists, by default, of 64 rounds, and for SHA512 variants, it is, by default, 160.";
|
||||
this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.<br><br><ul><li>SHA-512 operates on 64-bit words.</li><li>SHA-256 operates on 32-bit words.</li><li>SHA-384 is largely identical to SHA-512 but is truncated to 384 bits.</li><li>SHA-224 is largely identical to SHA-256 but is truncated to 224 bits.</li><li>SHA-512/224 and SHA-512/256 are truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.</li></ul> The message digest algorithm for SHA256 variants consists, by default, of 64 rounds, and for SHA512 variants, it is, by default, 160.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/SHA-2";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
|
||||
@ -8,6 +8,8 @@ import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
const MAX_WIDTH = 65536;
|
||||
|
||||
/**
|
||||
* To Hexdump operation
|
||||
*/
|
||||
@ -30,7 +32,8 @@ class ToHexdump extends Operation {
|
||||
"name": "Width",
|
||||
"type": "number",
|
||||
"value": 16,
|
||||
"min": 1
|
||||
"min": 1,
|
||||
"max": MAX_WIDTH
|
||||
},
|
||||
{
|
||||
"name": "Upper case hex",
|
||||
@ -63,6 +66,9 @@ class ToHexdump extends Operation {
|
||||
if (length < 1 || Math.round(length) !== length)
|
||||
throw new OperationError("Width must be a positive integer");
|
||||
|
||||
if (length > MAX_WIDTH)
|
||||
throw new OperationError(`Width must be no more than ${MAX_WIDTH}`);
|
||||
|
||||
const lines = [];
|
||||
for (let i = 0; i < data.length; i += length) {
|
||||
let lineNo = Utils.hex(i, 8);
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
import Operation from "../Operation.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import { toHex } from "../lib/Hex.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
* XOR Checksum operation
|
||||
*/
|
||||
class XORChecksum extends Operation {
|
||||
|
||||
/**
|
||||
* XORChecksum constructor
|
||||
*/
|
||||
@ -21,7 +21,8 @@ class XORChecksum extends Operation {
|
||||
|
||||
this.name = "XOR Checksum";
|
||||
this.module = "Crypto";
|
||||
this.description = "XOR Checksum splits the input into blocks of a configurable size and performs the XOR operation on these blocks.";
|
||||
this.description =
|
||||
"XOR Checksum splits the input into blocks of a configurable size and performs the XOR operation on these blocks.";
|
||||
this.infoURL = "https://wikipedia.org/wiki/XOR";
|
||||
this.inputType = "ArrayBuffer";
|
||||
this.outputType = "string";
|
||||
@ -29,7 +30,7 @@ class XORChecksum extends Operation {
|
||||
{
|
||||
name: "Blocksize",
|
||||
type: "number",
|
||||
value: 4
|
||||
value: 4,
|
||||
},
|
||||
];
|
||||
}
|
||||
@ -41,6 +42,12 @@ class XORChecksum extends Operation {
|
||||
*/
|
||||
run(input, args) {
|
||||
const blocksize = args[0];
|
||||
|
||||
|
||||
if (!Number.isInteger(blocksize) || blocksize <= 0) {
|
||||
throw new OperationError("Blocksize must be a positive integer.");
|
||||
}
|
||||
|
||||
input = new Uint8Array(input);
|
||||
|
||||
const res = Array(blocksize);
|
||||
|
||||
@ -126,6 +126,17 @@ TestRegister.addTests([
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hexdump: Width too large",
|
||||
input: "H",
|
||||
expectedOutput: "Width must be no more than 65536",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [155555555555555, false, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: xxd",
|
||||
input: `00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................
|
||||
|
||||
@ -19,5 +19,16 @@ TestRegister.addTests([
|
||||
args: ["Hex", "Data (raw)"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Parse IPv4 header: regression for Uint8Array.concat crash on truncated raw input",
|
||||
input: "\x45\x00\x00\x14\x00\x00\x00\x00\x40\x06\x00\x00",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse IPv4 header",
|
||||
args: ["Raw", "Data (raw)"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user