mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Added 'Parse TCP' operation
This commit is contained in:
parent
477e4a7421
commit
a895d1d82a
14 changed files with 430 additions and 81 deletions
|
@ -96,6 +96,7 @@ import "./tests/Protobuf.mjs";
|
|||
import "./tests/ParseSSHHostKey.mjs";
|
||||
import "./tests/DefangIP.mjs";
|
||||
import "./tests/ParseUDP.mjs";
|
||||
import "./tests/ParseTCP.mjs";
|
||||
import "./tests/AvroToJSON.mjs";
|
||||
import "./tests/Lorenz.mjs";
|
||||
import "./tests/LuhnChecksum.mjs";
|
||||
|
|
44
tests/operations/tests/ParseTCP.mjs
Normal file
44
tests/operations/tests/ParseTCP.mjs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Parse TCP tests.
|
||||
*
|
||||
* @author n1474335
|
||||
* @copyright Crown Copyright 2022
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Parse TCP: No options",
|
||||
input: "c2eb0050a138132e70dc9fb9501804025ea70000",
|
||||
expectedMatch: /1026 \(Scaled: 1026\)/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse TCP",
|
||||
args: ["Hex"],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse TCP: Options",
|
||||
input: "c2eb0050a1380c1f000000008002faf080950000020405b40103030801010402",
|
||||
expectedMatch: /1460/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse TCP",
|
||||
args: ["Hex"],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse TCP: Timestamps",
|
||||
input: "9e90e11574d57b2c00000000a002ffffe5740000020405b40402080aa4e8c8f50000000001030308",
|
||||
expectedMatch: /2766719221/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse TCP",
|
||||
args: ["Hex"],
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -2,7 +2,6 @@
|
|||
* Parse UDP tests.
|
||||
*
|
||||
* @author h345983745
|
||||
*
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
@ -12,15 +11,11 @@ TestRegister.addTests([
|
|||
{
|
||||
name: "Parse UDP: No Data - JSON",
|
||||
input: "04 89 00 35 00 2c 01 01",
|
||||
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0101\"}",
|
||||
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0x0101\"}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Auto"],
|
||||
},
|
||||
{
|
||||
op: "Parse UDP",
|
||||
args: [],
|
||||
args: ["Hex"],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
@ -30,15 +25,11 @@ TestRegister.addTests([
|
|||
}, {
|
||||
name: "Parse UDP: With Data - JSON",
|
||||
input: "04 89 00 35 00 2c 01 01 02 02",
|
||||
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0101\",\"Data\":\"0202\"}",
|
||||
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0x0101\",\"Data\":\"0x0202\"}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Auto"],
|
||||
},
|
||||
{
|
||||
op: "Parse UDP",
|
||||
args: [],
|
||||
args: ["Hex"],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
@ -51,13 +42,9 @@ TestRegister.addTests([
|
|||
input: "04 89 00",
|
||||
expectedOutput: "Need 8 bytes for a UDP Header",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Auto"],
|
||||
},
|
||||
{
|
||||
op: "Parse UDP",
|
||||
args: [],
|
||||
args: ["Hex"],
|
||||
},
|
||||
{
|
||||
op: "JSON Minify",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue