mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-26 09:46:17 -04:00
Merge 20b2f56039
into 7c8be12d52
This commit is contained in:
commit
d05403ea40
6 changed files with 217 additions and 2 deletions
|
@ -85,6 +85,7 @@ import "./tests/Hex.mjs";
|
|||
import "./tests/Hexdump.mjs";
|
||||
import "./tests/HKDF.mjs";
|
||||
import "./tests/Image.mjs";
|
||||
import "./tests/InsertBytes.mjs";
|
||||
import "./tests/IndexOfCoincidence.mjs";
|
||||
import "./tests/JA3Fingerprint.mjs";
|
||||
import "./tests/JA4.mjs";
|
||||
|
|
|
@ -48,5 +48,45 @@ TestRegister.addTests([
|
|||
args: ["Octal", "Decimal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Decimal (Little Endian) to Dotted Decimal",
|
||||
input: "16885952",
|
||||
expectedOutput: "192.168.1.1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Decimal (Little Endian)", "Dotted Decimal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Dotted Decimal to Decimal (Little Endian)",
|
||||
input: "192.168.1.1",
|
||||
expectedOutput: "16885952",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Dotted Decimal", "Decimal (Little Endian)"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Octal (Little Endian) to Dotted Decimal",
|
||||
input: "0100324300",
|
||||
expectedOutput: "192.168.1.1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Octal (Little Endian)", "Dotted Decimal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Dotted Decimal to Octal (Little Endian)",
|
||||
input: "192.168.1.1",
|
||||
expectedOutput: "0100324300",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Dotted Decimal", "Octal (Little Endian)"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
78
tests/operations/tests/InsertBytes.mjs
Normal file
78
tests/operations/tests/InsertBytes.mjs
Normal file
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* InsertBytes test.
|
||||
*
|
||||
* @author Didier Stevens [didier.stevens@gmail.com]
|
||||
* @copyright Crown Copyright 2022
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Insert bytes - test 1",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "", "option": "Hex"}, 0, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 2",
|
||||
input: "This is a test",
|
||||
expectedOutput: "AThis is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 3",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a testA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 4",
|
||||
input: "This is a test",
|
||||
expectedOutput: "Ahis is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 5",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a tesA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 1, true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 6",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is not a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "not ", "option": "Latin1"}, 8, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue