mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 09:16:17 -04:00
Add octal support to Change IP Format.
Also add test cases covering interchanging between all four formats.
This commit is contained in:
parent
d3e3e6e6fc
commit
6c9ce15b26
3 changed files with 79 additions and 8 deletions
52
tests/operations/tests/ChangeIPFormat.mjs
Normal file
52
tests/operations/tests/ChangeIPFormat.mjs
Normal file
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* Change IP format tests.
|
||||
*
|
||||
* @author Chris Smith
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Change IP format: Dotted Decimal to Hex",
|
||||
input: "192.168.1.1",
|
||||
expectedOutput: "c0a80101",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Dotted Decimal", "Hex"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Decimal to Dotted Decimal",
|
||||
input: "3232235777",
|
||||
expectedOutput: "192.168.1.1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Decimal", "Dotted Decimal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Hex to Octal",
|
||||
input: "c0a80101",
|
||||
expectedOutput: "030052000401",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Hex", "Octal"],
|
||||
},
|
||||
],
|
||||
}, {
|
||||
name: "Change IP format: Octal to Decimal",
|
||||
input: "030052000401",
|
||||
expectedOutput: "3232235777",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Change IP format",
|
||||
args: ["Octal", "Decimal"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue