mirror of
https://github.com/gchq/CyberChef
synced 2024-11-15 09:07:06 +00:00
Add tests for PHP deserialization
This commit is contained in:
parent
4be7f89fd8
commit
f596fe8404
2 changed files with 69 additions and 0 deletions
|
@ -27,6 +27,7 @@ import "./tests/operations/MorseCode.js";
|
|||
import "./tests/operations/MS.js";
|
||||
import "./tests/operations/StrUtils.js";
|
||||
import "./tests/operations/SeqUtils.js";
|
||||
import "./tests/operations/PhpSerialization.js";
|
||||
|
||||
|
||||
let allTestsPassing = true;
|
||||
|
|
68
test/tests/operations/PhpSerialization.js
Normal file
68
test/tests/operations/PhpSerialization.js
Normal file
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* PHP Serialization tests.
|
||||
*
|
||||
* @author Jarmo van Lenthe
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license BSD-3-Clause
|
||||
*/
|
||||
|
||||
import TestRegister from "../../TestRegister.js";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "PHP Deserialize empty array",
|
||||
input: "a:0:{}",
|
||||
expectedOutput: "{}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "PHP Deserialize",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "PHP Deserialize integer",
|
||||
input: "i:10;",
|
||||
expectedOutput: "10",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "PHP Deserialize",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "PHP Deserialize string",
|
||||
input: "s:17:\"PHP Serialization\";",
|
||||
expectedOutput: "\"PHP Serialization\"",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "PHP Deserialize",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "PHP Deserialize array (JSON)",
|
||||
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
|
||||
expectedOutput: "{\"a\": 10,\"0\": {\"ab\": true}}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "PHP Deserialize",
|
||||
args: [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "PHP Deserialize array (non-JSON)",
|
||||
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
|
||||
expectedOutput: "{\"a\": 10,0: {\"ab\": true}}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "PHP Deserialize",
|
||||
args: [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
Loading…
Reference in a new issue