mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 17:26:17 -04:00
Merge pull request #1899 from c65722/strip_ipv4_header
Add Strip IPv4 header operation
This commit is contained in:
commit
13f94a23f8
4 changed files with 185 additions and 0 deletions
|
@ -143,6 +143,7 @@ import "./tests/SIGABA.mjs";
|
|||
import "./tests/SM4.mjs";
|
||||
// import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet
|
||||
import "./tests/StrUtils.mjs";
|
||||
import "./tests/StripIPv4Header.mjs";
|
||||
import "./tests/StripTCPHeader.mjs";
|
||||
import "./tests/StripUDPHeader.mjs";
|
||||
import "./tests/Subsection.mjs";
|
||||
|
|
126
tests/operations/tests/StripIPv4Header.mjs
Normal file
126
tests/operations/tests/StripIPv4Header.mjs
Normal file
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
* Strip IPv4 header tests.
|
||||
*
|
||||
* @author c65722 []
|
||||
* @copyright Crown Copyright 2024
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Strip IPv4 header: No options, No payload",
|
||||
input: "450000140005400080060000c0a80001c0a80002",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Strip IPv4 header: No options, Payload",
|
||||
input: "450000140005400080060000c0a80001c0a80002ffffffffffffffff",
|
||||
expectedOutput: "ffffffffffffffff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Strip IPv4 header: Options, No payload",
|
||||
input: "460000140005400080060000c0a80001c0a8000207000000",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Strip IPv4 header: Options, Payload",
|
||||
input: "460000140005400080060000c0a80001c0a8000207000000ffffffffffffffff",
|
||||
expectedOutput: "ffffffffffffffff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Strip IPv4 header: Input length lesss than minimum header length",
|
||||
input: "450000140005400080060000c0a80001c0a800",
|
||||
expectedOutput: "Input length is less than minimum IPv4 header length",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Strip IPv4 header: Input length less than IHL",
|
||||
input: "460000140005400080060000c0a80001c0a80000",
|
||||
expectedOutput: "Input length is less than IHL",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
{
|
||||
op: "Strip IPv4 header",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None", 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue