1
0
mirror of synced 2024-12-21 03:05:52 +01:00
CyberChef/tests/operations/tests/ParseUDP.mjs

69 lines
1.7 KiB
JavaScript
Raw Normal View History

/**
* Parse UDP tests.
*
* @author h345983745
*
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Parse UDP: No Data - JSON",
input: "04 89 00 35 00 2c 01 01",
2019-08-23 11:56:13 +02:00
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0101\"}",
recipeConfig: [
{
op: "From Hex",
args: ["Auto"],
},
{
op: "Parse UDP",
args: [],
},
{
op: "JSON Minify",
args: [],
},
],
}, {
name: "Parse UDP: With Data - JSON",
input: "04 89 00 35 00 2c 01 01 02 02",
2019-08-23 11:56:13 +02:00
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0101\",\"Data\":\"0202\"}",
recipeConfig: [
{
op: "From Hex",
args: ["Auto"],
},
{
op: "Parse UDP",
args: [],
},
{
op: "JSON Minify",
args: [],
},
],
},
{
name: "Parse UDP: Not Enough Bytes",
input: "04 89 00",
expectedOutput: "Need 8 bytes for a UDP Header",
recipeConfig: [
{
op: "From Hex",
args: ["Auto"],
},
{
op: "Parse UDP",
args: [],
},
{
op: "JSON Minify",
args: [],
},
],
}
]);