mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 08:15:00 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3357cad52c
209 changed files with 10848 additions and 3438 deletions
|
@ -1,96 +0,0 @@
|
|||
/**
|
||||
* TestRegister.js
|
||||
*
|
||||
* This is so individual files can register their tests in one place, and
|
||||
* ensure that they will get run by the frontend.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import Chef from "../src/core/Chef";
|
||||
|
||||
(function() {
|
||||
/**
|
||||
* Object to store and run the list of tests.
|
||||
*
|
||||
* @class
|
||||
* @constructor
|
||||
*/
|
||||
function TestRegister() {
|
||||
this.tests = [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a list of tests to the register.
|
||||
*
|
||||
* @param {Object[]} tests
|
||||
*/
|
||||
TestRegister.prototype.addTests = function(tests) {
|
||||
this.tests = this.tests.concat(tests);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Runs all the tests in the register.
|
||||
*/
|
||||
TestRegister.prototype.runTests = function() {
|
||||
return Promise.all(
|
||||
this.tests.map(function(test, i) {
|
||||
const chef = new Chef();
|
||||
|
||||
return chef.bake(
|
||||
test.input,
|
||||
test.recipeConfig,
|
||||
{},
|
||||
0,
|
||||
false
|
||||
).then(function(result) {
|
||||
const ret = {
|
||||
test: test,
|
||||
status: null,
|
||||
output: null,
|
||||
};
|
||||
|
||||
if (result.error) {
|
||||
if (test.expectedError) {
|
||||
ret.status = "passing";
|
||||
} else {
|
||||
ret.status = "erroring";
|
||||
ret.output = result.error.displayStr;
|
||||
}
|
||||
} else {
|
||||
if (test.expectedError) {
|
||||
ret.status = "failing";
|
||||
ret.output = "Expected an error but did not receive one.";
|
||||
} else if (result.result === test.expectedOutput) {
|
||||
ret.status = "passing";
|
||||
} else if (test.hasOwnProperty("expectedMatch") && test.expectedMatch.test(result.result)) {
|
||||
ret.status = "passing";
|
||||
} else {
|
||||
ret.status = "failing";
|
||||
const expected = test.expectedOutput ? test.expectedOutput :
|
||||
test.expectedMatch ? test.expectedMatch.toString() : "unknown";
|
||||
ret.output = [
|
||||
"Expected",
|
||||
"\t" + expected.replace(/\n/g, "\n\t"),
|
||||
"Received",
|
||||
"\t" + result.result.replace(/\n/g, "\n\t"),
|
||||
].join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// Singleton TestRegister, keeping things simple and obvious.
|
||||
global.TestRegister = global.TestRegister || new TestRegister();
|
||||
})();
|
||||
|
||||
export default global.TestRegister;
|
||||
|
152
test/index.mjs
152
test/index.mjs
|
@ -1,152 +0,0 @@
|
|||
/* eslint no-console: 0 */
|
||||
|
||||
/**
|
||||
* Test Runner
|
||||
*
|
||||
* For running the tests in the test register.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import "babel-polyfill";
|
||||
|
||||
// Define global environment functions
|
||||
global.ENVIRONMENT_IS_WORKER = function() {
|
||||
return typeof importScripts === "function";
|
||||
};
|
||||
global.ENVIRONMENT_IS_NODE = function() {
|
||||
return typeof process === "object" && typeof require === "function";
|
||||
};
|
||||
global.ENVIRONMENT_IS_WEB = function() {
|
||||
return typeof window === "object";
|
||||
};
|
||||
|
||||
import TestRegister from "./TestRegister";
|
||||
import "./tests/operations/BCD";
|
||||
import "./tests/operations/BSON";
|
||||
import "./tests/operations/Base58";
|
||||
import "./tests/operations/Base64";
|
||||
import "./tests/operations/BitwiseOp";
|
||||
import "./tests/operations/ByteRepr";
|
||||
import "./tests/operations/CartesianProduct";
|
||||
import "./tests/operations/CharEnc";
|
||||
import "./tests/operations/Checksum";
|
||||
import "./tests/operations/Ciphers";
|
||||
import "./tests/operations/Code";
|
||||
import "./tests/operations/Comment";
|
||||
import "./tests/operations/Compress";
|
||||
import "./tests/operations/ConditionalJump";
|
||||
import "./tests/operations/Crypt";
|
||||
import "./tests/operations/DateTime";
|
||||
import "./tests/operations/Fork";
|
||||
import "./tests/operations/FromGeohash.mjs";
|
||||
import "./tests/operations/Hash";
|
||||
import "./tests/operations/HaversineDistance";
|
||||
import "./tests/operations/Hexdump";
|
||||
import "./tests/operations/Image";
|
||||
import "./tests/operations/Jump";
|
||||
import "./tests/operations/JWTDecode";
|
||||
import "./tests/operations/JWTSign";
|
||||
import "./tests/operations/JWTVerify";
|
||||
import "./tests/operations/MS";
|
||||
import "./tests/operations/Magic";
|
||||
import "./tests/operations/MorseCode";
|
||||
import "./tests/operations/NetBIOS";
|
||||
import "./tests/operations/OTP";
|
||||
import "./tests/operations/PGP";
|
||||
import "./tests/operations/PHP";
|
||||
import "./tests/operations/ParseIPRange";
|
||||
import "./tests/operations/PowerSet";
|
||||
import "./tests/operations/Regex";
|
||||
import "./tests/operations/Register";
|
||||
import "./tests/operations/Rotate";
|
||||
import "./tests/operations/SeqUtils";
|
||||
import "./tests/operations/SetDifference";
|
||||
import "./tests/operations/SetIntersection";
|
||||
import "./tests/operations/SetUnion";
|
||||
import "./tests/operations/StrUtils";
|
||||
import "./tests/operations/SymmetricDifference";
|
||||
import "./tests/operations/ToGeohash.mjs";
|
||||
import "./tests/operations/TranslateDateTimeFormat";
|
||||
import "./tests/operations/Magic";
|
||||
import "./tests/operations/ByteStringLiteral";
|
||||
|
||||
let allTestsPassing = true;
|
||||
const testStatusCounts = {
|
||||
total: 0,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to convert a status to an icon.
|
||||
*
|
||||
* @param {string} status
|
||||
* @returns {string}
|
||||
*/
|
||||
function statusToIcon(status) {
|
||||
const icons = {
|
||||
erroring: "🔥",
|
||||
failing: "❌",
|
||||
passing: "✔️️",
|
||||
};
|
||||
return icons[status] || "?";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a given test result in the console.
|
||||
*
|
||||
* @param {Object} testResult
|
||||
*/
|
||||
function handleTestResult(testResult) {
|
||||
allTestsPassing = allTestsPassing && testResult.status === "passing";
|
||||
const newCount = (testStatusCounts[testResult.status] || 0) + 1;
|
||||
testStatusCounts[testResult.status] = newCount;
|
||||
testStatusCounts.total += 1;
|
||||
|
||||
console.log([
|
||||
statusToIcon(testResult.status),
|
||||
testResult.test.name
|
||||
].join(" "));
|
||||
|
||||
if (testResult.output) {
|
||||
console.log(
|
||||
testResult.output
|
||||
.trim()
|
||||
.replace(/^/, "\t")
|
||||
.replace(/\n/g, "\n\t")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fail if the process takes longer than 10 seconds.
|
||||
*/
|
||||
setTimeout(function() {
|
||||
console.log("Tests took longer than 10 seconds to run, returning.");
|
||||
process.exit(1);
|
||||
}, 10 * 1000);
|
||||
|
||||
|
||||
TestRegister.runTests()
|
||||
.then(function(results) {
|
||||
results.forEach(handleTestResult);
|
||||
|
||||
console.log("\n");
|
||||
|
||||
for (const testStatus in testStatusCounts) {
|
||||
const count = testStatusCounts[testStatus];
|
||||
if (count > 0) {
|
||||
console.log(testStatus.toUpperCase(), count);
|
||||
}
|
||||
}
|
||||
|
||||
if (!allTestsPassing) {
|
||||
console.log("\nNot all tests are passing");
|
||||
}
|
||||
|
||||
process.exit(allTestsPassing ? 0 : 1);
|
||||
});
|
|
@ -1,103 +0,0 @@
|
|||
/**
|
||||
* BCD tests
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To BCD: default 0",
|
||||
input: "0",
|
||||
expectedOutput: "0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", true, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To BCD: unpacked nibbles",
|
||||
input: "1234567890",
|
||||
expectedOutput: "0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", false, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To BCD: packed, signed bytes",
|
||||
input: "1234567890",
|
||||
expectedOutput: "00000001 00100011 01000101 01100111 10001001 00001100",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 2 1", true, true, "Bytes"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To BCD: packed, signed nibbles, 8 4 -2 -1",
|
||||
input: "-1234567890",
|
||||
expectedOutput: "0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["8 4 -2 -1", true, true, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From BCD: default 0",
|
||||
input: "0000",
|
||||
expectedOutput: "0",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["8 4 2 1", true, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From BCD: packed, signed bytes",
|
||||
input: "00000001 00100011 01000101 01100111 10001001 00001101",
|
||||
expectedOutput: "-1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["8 4 2 1", true, true, "Bytes"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From BCD: Excess-3, unpacked, unsigned",
|
||||
input: "00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00000011",
|
||||
expectedOutput: "1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["Excess-3", false, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "BCD: raw 4 2 2 1, packed, signed",
|
||||
input: "1234567890",
|
||||
expectedOutput: "1234567890",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["4 2 2 1", true, true, "Raw"]
|
||||
},
|
||||
{
|
||||
"op": "From BCD",
|
||||
"args": ["4 2 2 1", true, true, "Raw"]
|
||||
}
|
||||
]
|
||||
},
|
||||
]);
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* BSON tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "BSON serialise: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON serialise",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BSON serialise: basic",
|
||||
input: "{\"hello\":\"world\"}",
|
||||
expectedOutput: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON serialise",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BSON deserialise: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON deserialise",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "BSON deserialise: basic",
|
||||
input: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
||||
expectedOutput: "{\n \"hello\": \"world\"\n}",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "BSON deserialise",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,78 +0,0 @@
|
|||
/**
|
||||
* Base58 tests.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Base58 (Bitcoin): nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base58 (Ripple): nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base58 (Bitcoin): 'hello world'",
|
||||
input: "hello world",
|
||||
expectedOutput: "StV1DL6CwTryKyV",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base58 (Ripple): 'hello world'",
|
||||
input: "hello world",
|
||||
expectedOutput: "StVrDLaUATiyKyV",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base58 (Bitcoin): 'StV1DL6CwTryKyV'",
|
||||
input: "StV1DL6CwTryKyV",
|
||||
expectedOutput: "hello world",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base58",
|
||||
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base58 (Ripple): 'StVrDLaUATiyKyV'",
|
||||
input: "StVrDLaUATiyKyV",
|
||||
expectedOutput: "hello world",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base58",
|
||||
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,119 +0,0 @@
|
|||
/**
|
||||
* Base64 tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Base64: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base64: Hello, World!",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "SGVsbG8sIFdvcmxkIQ==",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base64: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "4YOc4YOjIOGDnuGDkOGDnOGDmOGDmeGDkOGDoQ==",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Base64: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base64: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base64",
|
||||
args: ["A-Za-z0-9+/=", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base64: Hello, World!",
|
||||
input: "SGVsbG8sIFdvcmxkIQ==",
|
||||
expectedOutput: "Hello, World!",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base64",
|
||||
args: ["A-Za-z0-9+/=", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base64: UTF-8",
|
||||
input: "4YOc4YOjIOGDnuGDkOGDnOGDmOGDmeGDkOGDoQ==",
|
||||
expectedOutput: "ნუ პანიკას",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base64",
|
||||
args: ["A-Za-z0-9+/=", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Base64: All bytes",
|
||||
input: "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Base64",
|
||||
args: ["A-Za-z0-9+/=", true],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* BitwiseOp tests
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Bit shift left",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "10101010 01010100 11111110 00000000 11100000 00011110 01100110 10011000",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift left",
|
||||
"args": [1] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Bit shift right: Logical shift",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "00101010 01010101 01111111 00000000 01111000 00000111 00011001 01100110",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift right",
|
||||
"args": [1, "Logical shift"] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Bit shift right: Arithmetic shift",
|
||||
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
|
||||
expectedOutput: "00101010 11010101 11111111 00000000 11111000 00000111 00011001 11100110",
|
||||
recipeConfig: [
|
||||
{ "op": "From Binary",
|
||||
"args": ["Space"] },
|
||||
{ "op": "Bit shift right",
|
||||
"args": [1, "Arithmetic shift"] },
|
||||
{ "op": "To Binary",
|
||||
"args": ["Space"] }
|
||||
]
|
||||
},
|
||||
]);
|
|
@ -1,228 +0,0 @@
|
|||
/**
|
||||
* ByteRepr tests.
|
||||
*
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Octal: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Octal: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Octal: hello world",
|
||||
input: "hello world", // [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100],
|
||||
expectedOutput: "150 145 154 154 157 40 167 157 162 154 144",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Octal: hello world",
|
||||
input: "150 145 154 154 157 40 167 157 162 154 144",
|
||||
expectedOutput: "hello world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Octal: Γειά σου",
|
||||
input: "Γειά σου", //[206,147,206,181,206,185,206,172,32,207,131,206,191,207,133],
|
||||
expectedOutput: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Octal: Γειά σου",
|
||||
input: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
|
||||
expectedOutput: "Γειά σου",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Octal",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Hex: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Hex: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Hex: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["None"]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Hex: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Hex: All bytes",
|
||||
input: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Hex: UTF-8",
|
||||
input: "e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
|
||||
expectedOutput: "ნუ პანიკას",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["None"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Charcode: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Charcode: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To Charcode: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "10dc 10e3 20 10de 10d0 10dc 10d8 10d9 10d0 10e1",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Charcode",
|
||||
args: ["Space", 16]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Charcode: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Charcode: All bytes",
|
||||
input: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From Charcode: UTF-8",
|
||||
input: "10dc 10e3 20 10de 10d0 10dc 10d8 10d9 10d0 10e1",
|
||||
expectedOutput: "ნუ პანიკას",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Charcode",
|
||||
args: ["Space", 16]
|
||||
}
|
||||
]
|
||||
},
|
||||
]);
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
* Cartesian Product tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Cartesian Product",
|
||||
input: "1 2 3 4 5\n\na b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cartesian Product: too many on left",
|
||||
input: "1 2 3 4 5 6\n\na b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cartesian Product: too many on right",
|
||||
input: "1 2 3 4 5\n\na b c d e f",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cartesian Product: item delimiter",
|
||||
input: "1-2-3-4-5\n\na-b-c-d-e",
|
||||
expectedOutput: "(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
args: ["\n\n", "-"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cartesian Product: sample delimiter",
|
||||
input: "1 2 3 4 5_a b c d e",
|
||||
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Cartesian Product",
|
||||
args: ["_", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,90 +0,0 @@
|
|||
/**
|
||||
* CharEnc tests.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Encode text, Decode text: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Encode text, Decode text: hello",
|
||||
input: "hello",
|
||||
expectedOutput: "hello",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Encode text (EBCDIC): hello",
|
||||
input: "hello",
|
||||
expectedOutput: "88 85 93 93 96",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["IBM EBCDIC International (500)"]
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Decode text (EBCDIC): 88 85 93 93 96",
|
||||
input: "88 85 93 93 96",
|
||||
expectedOutput: "hello",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["IBM EBCDIC International (500)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Generate Base64 Windows Powershell",
|
||||
input: "ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==",
|
||||
expectedOutput: "dir \"c:\\program files\" ",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Base64",
|
||||
"args": ["A-Za-z0-9+/=", true]
|
||||
},
|
||||
{
|
||||
"op": "Decode text",
|
||||
"args": ["UTF16LE (1200)"]
|
||||
},
|
||||
{
|
||||
"op": "Encode text",
|
||||
"args": ["UTF-8 (65001)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,120 +0,0 @@
|
|||
/**
|
||||
* Checksum tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
|
||||
const UTF8_STR = "ნუ პანიკას";
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "CRC-16: nothing",
|
||||
input: "",
|
||||
expectedOutput: "0000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-16: basic string",
|
||||
input: BASIC_STRING,
|
||||
expectedOutput: "0c70",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-16: UTF-8",
|
||||
input: UTF8_STR,
|
||||
expectedOutput: "dcf6",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-16: all bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "bad3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-16 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-32: nothing",
|
||||
input: "",
|
||||
expectedOutput: "00000000",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-32: basic string",
|
||||
input: BASIC_STRING,
|
||||
expectedOutput: "bf4b739c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-32: UTF-8",
|
||||
input: UTF8_STR,
|
||||
expectedOutput: "87553290",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "CRC-32: all bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: "29058c73",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CRC-32 Checksum",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
]);
|
|
@ -1,355 +0,0 @@
|
|||
/**
|
||||
* Cipher tests.
|
||||
*
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Affine Encode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [1, 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Encode: invalid a & b (non-integer)",
|
||||
input: "some keys are shaped as locks. index[me]",
|
||||
expectedOutput: "The values of a and b can only be integers.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [0.1, 0.00001]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Encode: no effect",
|
||||
input: "some keys are shaped as locks. index[me]",
|
||||
expectedOutput: "some keys are shaped as locks. index[me]",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [1, 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Encode: normal",
|
||||
input: "some keys are shaped as locks. index[me]",
|
||||
expectedOutput: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Encode",
|
||||
args: [23, 23]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Decode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [1, 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Decode: invalid a & b (non-integer)",
|
||||
input: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
expectedOutput: "The values of a and b can only be integers.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [0.1, 0.00001]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Decode: invalid a (coprime)",
|
||||
input: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
expectedOutput: "The value of `a` must be coprime to 26.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [8, 23]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Decode: no effect",
|
||||
input: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
expectedOutput: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [1, 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Affine Decode: normal",
|
||||
input: "vhnl tldv xyl vcxelo xv qhrtv. zkolg[nl]",
|
||||
expectedOutput: "some keys are shaped as locks. index[me]",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Affine Cipher Decode",
|
||||
args: [23, 23]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Atbash: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Atbash Cipher",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Atbash: normal",
|
||||
input: "old slow slim horn",
|
||||
expectedOutput: "low hold horn slim",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Atbash Cipher",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: no key",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": [""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: invalid key (non-alphabetic)",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "The key must consist only of letters in the English alphabet",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Encode: normal",
|
||||
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
expectedOutput: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Encode",
|
||||
"args": ["Schrodinger"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: no key",
|
||||
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": [""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: invalid key (non-alphabetic)",
|
||||
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
|
||||
expectedOutput: "The key must consist only of letters in the English alphabet",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Bifid Cipher Decode: normal",
|
||||
input: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
|
||||
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Bifid Cipher Decode",
|
||||
"args": ["Schrodinger"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Encode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Encode: no key",
|
||||
input: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
expectedOutput: "No key entered",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": [""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Encode: invalid key",
|
||||
input: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
expectedOutput: "The key must consist only of letters",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Encode: normal",
|
||||
input: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
expectedOutput: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Encode",
|
||||
"args": ["Edward"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Decode: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["nothing"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Decode: no key",
|
||||
input: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
expectedOutput: "No key entered",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": [""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Decode: invalid key",
|
||||
input: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
expectedOutput: "The key must consist only of letters",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["abc123"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Vigenère Decode: normal",
|
||||
input: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
|
||||
expectedOutput: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Vigenère Decode",
|
||||
"args": ["Edward"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: no pt/ct",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "flee at once. we are discovered!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["", ""]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: no input",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: uneven pt/ct",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwx"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Substitute: normal",
|
||||
input: "flee at once. we are discovered!",
|
||||
expectedOutput: "siaa zq lkba. va zoa rfpbluaoar!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Substitute",
|
||||
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,395 +0,0 @@
|
|||
/**
|
||||
* Code tests.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const JSON_TEST_DATA = {
|
||||
"store": {
|
||||
"book": [{
|
||||
"category": "reference",
|
||||
"author": "Nigel Rees",
|
||||
"title": "Sayings of the Century",
|
||||
"price": 8.95
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Evelyn Waugh",
|
||||
"title": "Sword of Honour",
|
||||
"price": 12.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Herman Melville",
|
||||
"title": "Moby Dick",
|
||||
"isbn": "0-553-21311-3",
|
||||
"price": 8.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "J. R. R. Tolkien",
|
||||
"title": "The Lord of the Rings",
|
||||
"isbn": "0-395-19395-8",
|
||||
"price": 22.99
|
||||
}],
|
||||
"bicycle": {
|
||||
"color": "red",
|
||||
"price": 19.95
|
||||
},
|
||||
"newspaper": [{
|
||||
"format": "broadsheet",
|
||||
"title": "Financial Times",
|
||||
"price": 2.75
|
||||
}, {
|
||||
"format": "tabloid",
|
||||
"title": "The Guardian",
|
||||
"price": 2.00
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Camel case (dumb)",
|
||||
input: "hello world",
|
||||
expectedOutput: "helloWorld",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Camel case",
|
||||
"args": [false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Snake case (dumb)",
|
||||
input: "hello world",
|
||||
expectedOutput: "hello_world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Snake case",
|
||||
"args": [false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Kebab case (dumb)",
|
||||
input: "hello world",
|
||||
expectedOutput: "hello-world",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Kebab case",
|
||||
"args": [false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Camel case (smart)",
|
||||
input: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"a_camel_case_function",
|
||||
"$a_camel_case_variable;",
|
||||
"function function_name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"aCamelCaseFunction",
|
||||
"$aCamelCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Camel case",
|
||||
"args": [true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Snake case (smart)",
|
||||
input: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"aSnakeCaseFunction",
|
||||
"$aSnakeCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"a_snake_case_function",
|
||||
"$a_snake_case_variable;",
|
||||
"function function_name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Snake case",
|
||||
"args": [true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Kebab case (smart)",
|
||||
input: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"aKebabCaseFunction",
|
||||
"$aKebabCaseVariable;",
|
||||
"function functionName() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"test='hello'",
|
||||
"echo $test",
|
||||
"a-kebab-case-function",
|
||||
"$a-kebab-case-variable;",
|
||||
"function function-name() {",
|
||||
" console.log('things inside quotes do not get broken');",
|
||||
" console.log(\"things inside quotes do not get broken\");",
|
||||
"}",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To Kebab case",
|
||||
"args": [true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Empty JSON",
|
||||
input: "",
|
||||
expectedOutput: "Invalid input JSON: Unexpected end of JSON input",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Empty expression",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: "Invalid JPath expression: we need a path",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Fetch of values from specific object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"\"Nigel Rees\"",
|
||||
"\"Evelyn Waugh\"",
|
||||
"\"Herman Melville\"",
|
||||
"\"J. R. R. Tolkien\""
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$.store.book[*].author", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Fetch of all values with matching key",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"\"Sayings of the Century\"",
|
||||
"\"Sword of Honour\"",
|
||||
"\"Moby Dick\"",
|
||||
"\"The Lord of the Rings\"",
|
||||
"\"Financial Times\"",
|
||||
"\"The Guardian\""
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..title", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All data in object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}]",
|
||||
"{\"color\":\"red\",\"price\":19.95}",
|
||||
"[{\"format\":\"broadsheet\",\"title\":\"Financial Times\",\"price\":2.75},{\"format\":\"tabloid\",\"title\":\"The Guardian\",\"price\":2}]"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$.store.*", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: Last element in array",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[-1:]", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: First 2 elements in array",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[:2]", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in array with property",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.isbn)]", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in array which meet condition",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
|
||||
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.price<30 && @.category==\"fiction\")]", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JPath Expression: All elements in object",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: [
|
||||
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
|
||||
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "JPath expression",
|
||||
"args": ["$..book[?(@.price<10)]", "\n"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CSS selector",
|
||||
input: '<div id="test">\n<p class="a">hello</p>\n<p>world</p>\n<p class="a">again</p>\n</div>',
|
||||
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "CSS selector",
|
||||
"args": ["#test p.a", "\\n"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "XPath expression",
|
||||
input: '<div id="test">\n<p class="a">hello</p>\n<p>world</p>\n<p class="a">again</p>\n</div>',
|
||||
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "XPath expression",
|
||||
"args": ["/div/p[@class=\"a\"]", "\\n"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To MessagePack: no content",
|
||||
input: "",
|
||||
expectedError: true,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To MessagePack",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From MessagePack: no content",
|
||||
input: "",
|
||||
expectedOutput: "Could not decode MessagePack to JSON: Error: Could not parse",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
},
|
||||
{
|
||||
"op": "From MessagePack",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To MessagePack: valid json",
|
||||
input: JSON.stringify(JSON_TEST_DATA),
|
||||
expectedOutput: "81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To MessagePack",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"op": "To Hex",
|
||||
"args": ["Space"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From MessagePack: valid msgpack",
|
||||
input: "81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
|
||||
expectedOutput: JSON.stringify(JSON_TEST_DATA, null, 4),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
},
|
||||
{
|
||||
"op": "From MessagePack",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* Flow Control tests.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Comment: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Comment",
|
||||
"args": [""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Fork, Comment, Base64",
|
||||
input: "cat\nsat\nmat",
|
||||
expectedOutput: "Y2F0\nc2F0\nbWF0\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Fork",
|
||||
"args": ["\\n", "\\n", false]
|
||||
},
|
||||
{
|
||||
"op": "Comment",
|
||||
"args": ["Testing 123"]
|
||||
},
|
||||
{
|
||||
"op": "To Base64",
|
||||
"args": ["A-Za-z0-9+/="]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Label, Comment: Complex content",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Label",
|
||||
args: [""]
|
||||
},
|
||||
{
|
||||
op: "Comment",
|
||||
args: [""]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Compress tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Bzip2 decompress",
|
||||
input: "425a6839314159265359b218ed630000031380400104002a438c00200021a9ea601a10003202185d5ed68ca6442f1e177245385090b218ed63",
|
||||
expectedOutput: "The cat sat on the mat.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Space"]
|
||||
},
|
||||
{
|
||||
"op": "Bzip2 Decompress",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
* Conditional Jump tests
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Conditional Jump: Skips 0",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"YzJodmRXeGtJR0psSUdOb1lXNW5aV1E9"
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Conditional Jump",
|
||||
args: ["match", false, "", 0],
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Conditional Jump: Skips 1",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
// Expecting base32, not base64 output
|
||||
expectedOutput: [
|
||||
"ONUG65LMMQQGEZJAMNUGC3THMVSA====",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Conditional Jump",
|
||||
args: ["should", false, "skip match", 10],
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
{
|
||||
op: "Label", args: ["skip match"],
|
||||
},
|
||||
{
|
||||
op: "To Base32",
|
||||
args: ["A-Z2-7="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Conditional Jump: Skips backwards",
|
||||
input: [
|
||||
"match",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"f7cf556f7f4fc6635db8c314f7a81f2a",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Label",
|
||||
args: ["back to the beginning"],
|
||||
},
|
||||
{
|
||||
op: "Jump",
|
||||
args: ["skip replace"],
|
||||
},
|
||||
{
|
||||
op: "MD2",
|
||||
args: [],
|
||||
},
|
||||
{
|
||||
op: "Label",
|
||||
args: ["skip replace"],
|
||||
},
|
||||
{
|
||||
op: "Conditional Jump",
|
||||
args: ["match", false, "back to the beginning", 10],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* DateTime tests.
|
||||
*
|
||||
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Filetime to Unix",
|
||||
input: "129207366395297693",
|
||||
expectedOutput: "1276263039529769300",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Windows Filetime to UNIX Timestamp",
|
||||
args: ["Nanoseconds (ns)", "Decimal"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unix to Filetime",
|
||||
input: "1276263039529769300",
|
||||
expectedOutput: "129207366395297693",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "UNIX Timestamp to Windows Filetime",
|
||||
args: ["Nanoseconds (ns)", "Decimal"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* Fork tests
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Fork: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, Merge: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
{
|
||||
op: "Merge",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, (expect) Error, Merge",
|
||||
input: "1,2,3,4\n\n3,4,5,6",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n\n", "\n\n", false],
|
||||
},
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["\n\n", ","],
|
||||
},
|
||||
{
|
||||
op: "Merge",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, Conditional Jump, Encodings",
|
||||
input: "Some data with a 1 in it\nSome data with a 2 in it",
|
||||
expectedOutput: "U29tZSBkYXRhIHdpdGggYSAxIGluIGl0\n53 6f 6d 65 20 64 61 74 61 20 77 69 74 68 20 61 20 32 20 69 6e 20 69 74\n",
|
||||
recipeConfig: [
|
||||
{"op": "Fork", "args": ["\\n", "\\n", false]},
|
||||
{"op": "Conditional Jump", "args": ["1", false, "skipReturn", "10"]},
|
||||
{"op": "To Hex", "args": ["Space"]},
|
||||
{"op": "Return", "args": []},
|
||||
{"op": "Label", "args": ["skipReturn"]},
|
||||
{"op": "To Base64", "args": ["A-Za-z0-9+/="]}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* To Geohash tests
|
||||
*
|
||||
* @author gchq77703
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "From Geohash",
|
||||
input: "ww8p1r4t8",
|
||||
expectedOutput: "37.83238649368286,112.55838632583618",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Geohash",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Geohash",
|
||||
input: "ww8p1r",
|
||||
expectedOutput: "37.83416748046875,112.5604248046875",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Geohash",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Geohash",
|
||||
input: "ww8",
|
||||
expectedOutput: "37.265625,113.203125",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Geohash",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Geohash",
|
||||
input: "w",
|
||||
expectedOutput: "22.5,112.5",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Geohash",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,757 +0,0 @@
|
|||
/**
|
||||
* Hash tests.
|
||||
*
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "MD2",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "1c8f1e6a94aaa7145210bf90bb52871a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MD2",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "MD4",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "94e3cb0fa9aa7a5ee3db74b79e915989",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MD4",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "MD5",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "65a8e27d8879283831b664bd8b7f0ad4",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MD5",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "MD6",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "ce5effce32637e6b8edaacc9284b873c3fd4e66f9779a79df67eb4a82dda8230",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MD6",
|
||||
"args": [256, 64, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA0",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "5a5588f0407c6ae9a988758e76965f841b299229",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA0",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA1",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "0a0a9f2a6772942557ab5355d76af442f8f65e01",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA1",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 224",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "72a23dfa411ba6fde01dbfabf3b00a709c93ebf273dc29e2d8b261ff",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 384",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "5485cc9b3365b4305dfb4e8337e0a598a574f8242bf17289e0dd6c20a3cd44a089de16ab4ab308f63e44b1170eb5f515",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 512",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 512/224",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "766745f058e8a0438f19de48ae56ea5f123fe738af39bca050a7547a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["512/224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 512/256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "0686f0a605973dc1bf035d1e2b9bad1985a0bff712ddd88abd8d2593e5f99030",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["512/256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 224",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "853048fb8b11462b6100385633c0cc8dcdc6e2b8e376c28102bc84f2",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 384",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "aa9ad8a49f31d2ddcabbb7010a1566417cff803fef50eba239558826f872e468c5743e7f026b0a8e5b2d7a1cc465cdbe",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "1af17a664e3fa8e419b8ba05c2a173169df76162a5a286e0c405b460d478f7ef",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 512",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "38e05c33d7b067127f217d8c856e554fcff09c9320b8a5979ce2ff5d95dd27ba35d1fba50c562dfd1d6cc48bc9c5baa4390894418cc942d968f97bcb659419ed",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Keccak 224",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "4eaaf0e7a1e400efba71130722e1cb4d59b32afb400e654afec4f8ce",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Keccak",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Keccak 384",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "4d60892fde7f967bcabdc47c73122ae6311fa1f9be90d721da32030f7467a2e3db3f9ccb3c746483f9d2b876e39def17",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Keccak",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Keccak 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Keccak",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Keccak 512",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "eda765576c84c600ed7f5d97510e92703b61f5215def2a161037fd9dd1f5b6ed4f86ce46073c0e3f34b52de0289e9c618798fff9dd4b1bfe035bdb8645fc6e37",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Keccak",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Shake 128",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "2bf5e6dee6079fad604f573194ba8426bd4d30eb13e8ba2edae70e529b570cbd",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Shake",
|
||||
"args": ["128", 256]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Shake 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "b3be97bfd978833a65588ceae8a34cf59e95585af62063e6b89d0789f372424e8b0d1be4f21b40ce5a83a438473271e0661854f02d431db74e6904d6c347d757",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Shake",
|
||||
"args": ["256", 512]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "RIPEMD 128",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "67f9fe75ca2886dc76ad00f7276bdeba",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "RIPEMD",
|
||||
"args": ["128"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "RIPEMD 160",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "527a6a4b9a6da75607546842e0e00105350b1aaf",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "RIPEMD",
|
||||
"args": ["160"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "RIPEMD 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "567750c6d34dcba7ae038a80016f3ca3260ec25bfdb0b68bbb8e730b00b2447d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "RIPEMD",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "RIPEMD 320",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "f9832e5bb00576fc56c2221f404eb77addeafe49843c773f0df3fc5a996d5934f3c96e94aeb80e89",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "RIPEMD",
|
||||
"args": ["320"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HAS-160",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "8f6dd8d7c8a04b1cb3831adc358b1e4ac2ed5984",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "HAS-160",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Whirlpool-0",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "1c327026f565a0105a827efbfb3d3635cdb042c0aabb8416e96deb128e6c5c8684b13541cf31c26c1488949df050311c6999a12eb0e7002ad716350f5c7700ca",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Whirlpool",
|
||||
"args": ["Whirlpool-0"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Whirlpool-T",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "16c581089b6a6f356ae56e16a63a4c613eecd82a2a894b293f5ee45c37a31d09d7a8b60bfa7e414bd4a7166662cea882b5cf8c96b7d583fc610ad202591bcdb1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Whirlpool",
|
||||
"args": ["Whirlpool-T"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Whirlpool",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "3d837c9ef7bb291bd1dcfc05d3004af2eeb8c631dd6a6c4ba35159b8889de4b1ec44076ce7a8f7bfa497e4d9dcb7c29337173f78d06791f3c3d9e00cc6017f0b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Whirlpool",
|
||||
"args": ["Whirlpool"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 2 128",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "a4ad2b8848580511d0884fb4233a7e7a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["2", "128"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 4 128",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "d154eae2c9ffbcd2e1bdaf0b84736126",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["4", "128"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 8 128",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "6f3d55b69557abb0a3c4e9de9d29ba5d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["8", "128"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 2 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "65736daba648de28ef4c4a316b4684584ecf9f22ddb5c457729e6bf0f40113c4",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["2", "256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 4 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "71b0ea4b3e33f2e58bcc67c8a8de060b99ec0107355bbfdc18d8f65f0194ffcc",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["4", "256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Snefru 8 256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "255cd401414c79588cf689e8d5ff0536a2cfab83fcae36e654f202b09bc4b8a7",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Snefru",
|
||||
"args": ["8", "256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HMAC SHA256",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "52589bd80ccfa4acbb3f9512dfaf4f700fa5195008aae0b77a9e47dcca75beac",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "HMAC",
|
||||
"args": ["test", "SHA256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "MD5: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "4f4f02e2646545aa8fc42f613c9aa068",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "MD5",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA1: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "2c5400aaee7e8ad4cad29bfbdf8d566924e5442c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA1",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 224: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "66c166eba2529ecc44a7b7b218a64a8e3892f873c8d231e8e3c1ef3d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 256: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "186ffd22c3af83995afa4a0316023f81a7f8834fd16bd2ed358c7b1b8182ba41",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 384: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "2a6369ffec550ea0bfb810b3b8246b7d6b7f060edfae88441f0f242b98b91549aa4ff407de38c6d03b5f377434ad2f36",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 512: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "544ae686522c05b70d12b460b5b39ea0a758eb4027333edbded7e2b3f467aa605804f71f54db61a7bbe50e6e7898510635efd6721fd418a9ea4d05b286d12806",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 224: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "e2c07562ee8c2d73e3dd309efea257159abd0948ebc14619bab9ffb3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 256: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "55a55275387586afd1ed64757c9ee7ad1d96ca81a5b7b742c40127856ee78a2d",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 384: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "39f8796dd697dc39e5a943817833793f2c29dc0d1adc7037854c0fb51e135c6bd26b113240c4fb1e3fcc16ff8690c91a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 512: Complex bytes",
|
||||
input: "10dc10e32010de10d010dc10d810d910d010e12e",
|
||||
expectedOutput: "ee9061bed83b1ad1e2fc4a4bac72a5a65a23a0fa55193b808af0a3e2013b718a5a3e40474765b4f93d1b2747401058a5b58099cc890a159db92b2ea816287add",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["None"]
|
||||
},
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "MD5: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "2e93ee2b5b2a337ccb678c7db12eff1b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MD5",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA1: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "87f483b1515dce672be044bf183ae8103e3b2d4b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA1",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 224: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "563ca57b500157717961a5fa87ce42c6db76a488c98ea9c28d620770",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 256: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "36abbb4622ffff06aa3e3cea266765601b21457bb3755a0a2cf0a206422863c1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 384: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "140b929391a66c9a943bcd60e6964f0d19526d3bc9ba020fbb29aae51cddb8e63a78784d8770f1d36335bf4efff8c131",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA2 512: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "04a7887c400bf647b7c67b9a0f1ada70d176348b5afdfebea184f7e62748849828669c7b5160be99455fdbf625589bd1689c003bc06ef60c39607d825a2f8838",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA2",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 224: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "b3ffc9620949f879cb561fb240452494e2566cb4e4f701a85715e14f",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["224"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 256: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "b5f247d725b46546c832502cd07bccb5d4de0c41a6665d3944ed2cc55cd9d156",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 384: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "93e87b9aa8c9c47eba146adac357c525b418b71677f6db01d1c760d87b058682e639c8d43a8bfe91529cecd9800700e3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["384"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SHA3 512: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "1fbc484b5184982561795162757717474eebc846ca9f10029a75a54cdd897a7b48d1db42f2478fa1d5d213a0dd7de71c809cb19c60581ba57e7289d29408fb36",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "SHA3",
|
||||
"args": ["512"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Bcrypt compare: dolphin",
|
||||
input: "dolphin",
|
||||
expectedOutput: "Match: dolphin",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Bcrypt compare",
|
||||
args: ["$2a$10$qyon0LQCmMxpFFjwWH6Qh.dDdhqntQh./IN0RXCc3XIMILuOYZKgK"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Scrypt: RFC test vector 1",
|
||||
input: "",
|
||||
expectedOutput: "77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Scrypt",
|
||||
args: [
|
||||
{
|
||||
"option": "Latin1",
|
||||
"string": ""
|
||||
},
|
||||
16, 1, 1, 64
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Scrypt: RFC test vector 2",
|
||||
input: "password",
|
||||
expectedOutput: "fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Scrypt",
|
||||
args: [
|
||||
{
|
||||
"option": "Latin1",
|
||||
"string": "NaCl"
|
||||
},
|
||||
1024, 8, 16, 64
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Scrypt: RFC test vector 3",
|
||||
input: "pleaseletmein",
|
||||
expectedOutput: "7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Scrypt",
|
||||
args: [
|
||||
{
|
||||
"option": "Latin1",
|
||||
"string": "SodiumChloride"
|
||||
},
|
||||
16384, 8, 1, 64
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
/*{ // This takes a LONG time to run (over a minute usually).
|
||||
name: "Scrypt: RFC test vector 4",
|
||||
input: "pleaseletmein",
|
||||
expectedOutput: "2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Scrypt",
|
||||
args: [
|
||||
{
|
||||
"option": "Latin1",
|
||||
"string": "SodiumChloride"
|
||||
},
|
||||
1048576, 8, 1, 64
|
||||
]
|
||||
}
|
||||
]
|
||||
},*/
|
||||
]);
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Haversine distance tests.
|
||||
*
|
||||
* @author Dachande663 [dachande663@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Haversine distance",
|
||||
input: "51.487263,-0.124323, 38.9517,-77.1467",
|
||||
expectedOutput: "5619355.701829259",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Haversine distance",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,261 +0,0 @@
|
|||
/**
|
||||
* Hexdump tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Hexdump: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hexdump: Hello, World!",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "Hello, World!",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hexdump: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: "ნუ პანიკას",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hexdump: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
},
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hexdump: UTF-8",
|
||||
input: "ნუ პანიკას",
|
||||
expectedOutput: `00000000 e1 83 9c e1 83 a3 20 e1 83 9e e1 83 90 e1 83 9c |á..á.£ á..á..á..|
|
||||
00000010 e1 83 98 e1 83 99 e1 83 90 e1 83 a1 |á..á..á..á.¡|`,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Hexdump: All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: `00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
|
||||
00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
|
||||
00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./|
|
||||
00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?|
|
||||
00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO|
|
||||
00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\\]^_|
|
||||
00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |\`abcdefghijklmno|
|
||||
00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.|
|
||||
00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................|
|
||||
00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................|
|
||||
000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |\xa0¡¢£¤¥¦§¨©ª«¬.®¯|
|
||||
000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |°±²³´µ¶·¸¹º»¼½¾¿|
|
||||
000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ|
|
||||
000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |ÐÑÒÓÔÕÖרÙÚÛÜÝÞß|
|
||||
000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |àáâãäåæçèéêëìíîï|
|
||||
000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |ðñòóôõö÷øùúûüýþÿ|`,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Hexdump",
|
||||
args: [16, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: xxd",
|
||||
input: `00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................
|
||||
00000010: 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f ................
|
||||
00000020: 2021 2223 2425 2627 2829 2a2b 2c2d 2e2f !"#$%&'()*+,-./
|
||||
00000030: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>?
|
||||
00000040: 4041 4243 4445 4647 4849 4a4b 4c4d 4e4f @ABCDEFGHIJKLMNO
|
||||
00000050: 5051 5253 5455 5657 5859 5a5b 5c5d 5e5f PQRSTUVWXYZ[\\]^_
|
||||
00000060: 6061 6263 6465 6667 6869 6a6b 6c6d 6e6f \`abcdefghijklmno
|
||||
00000070: 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f pqrstuvwxyz{|}~.
|
||||
00000080: 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f ................
|
||||
00000090: 9091 9293 9495 9697 9899 9a9b 9c9d 9e9f ................
|
||||
000000a0: a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf ................
|
||||
000000b0: b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf ................
|
||||
000000c0: c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf ................
|
||||
000000d0: d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf ................
|
||||
000000e0: e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef ................
|
||||
000000f0: f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff ................`,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: Wireshark",
|
||||
input: `00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ........ ........
|
||||
00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ........ ........
|
||||
00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !"#$%&' ()*+,-./
|
||||
00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 01234567 89:;<=>?
|
||||
00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFG HIJKLMNO
|
||||
00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVW XYZ[\\]^_
|
||||
00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f \`abcdefg hijklmno
|
||||
00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvw xyz{|}~.
|
||||
00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f ........ ........
|
||||
00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f ........ ........
|
||||
000000A0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af ........ ........
|
||||
000000B0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf ........ ........
|
||||
000000C0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf ........ ........
|
||||
000000D0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df ........ ........
|
||||
000000E0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ........ ........
|
||||
000000F0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ........ ........
|
||||
`,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: Wireshark alt",
|
||||
input: `0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
|
||||
0010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
|
||||
0020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
|
||||
0030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
|
||||
0040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
|
||||
0050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
|
||||
0060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
|
||||
0070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f
|
||||
0080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f
|
||||
0090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f
|
||||
00a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af
|
||||
00b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf
|
||||
00c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf
|
||||
00d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df
|
||||
00e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef
|
||||
00f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff`,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: 010",
|
||||
input: `0000h: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................
|
||||
0010h: 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................
|
||||
0020h: 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./
|
||||
0030h: 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>?
|
||||
0040h: 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO
|
||||
0050h: 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\\]^_
|
||||
0060h: 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F \`abcdefghijklmno
|
||||
0070h: 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F pqrstuvwxyz{|}~
|
||||
0080h: 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F €.‚ƒ„…†‡ˆ‰Š‹Œ...
|
||||
0090h: 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F .‘’“”•–—˜™š›œ.žŸ
|
||||
00A0h: A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF \xa0¡¢£¤¥¦§¨©ª«¬®¯
|
||||
00B0h: B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF °±²³´µ¶·¸¹º»¼½¾¿
|
||||
00C0h: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
|
||||
00D0h: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF ÐÑÒÓÔÕÖרÙÚÛÜÝÞß
|
||||
00E0h: E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF àáâãäåæçèéêëìíîï
|
||||
00F0h: F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF ðñòóôõö÷øùúûüýþÿ`,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: Linux hexdump",
|
||||
input: `00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
|
||||
00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
|
||||
00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./|
|
||||
00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?|
|
||||
00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO|
|
||||
00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\\]^_|
|
||||
00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |\`abcdefghijklmno|
|
||||
00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.|
|
||||
00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................|
|
||||
00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................|
|
||||
000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................|
|
||||
000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................|
|
||||
000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................|
|
||||
000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................|
|
||||
000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................|
|
||||
000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |................|
|
||||
00000100`,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
File diff suppressed because one or more lines are too long
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* JWT Decode tests
|
||||
*
|
||||
* @author gchq77703 []
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const outputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "JWT Decode: HS",
|
||||
input: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
|
||||
expectedOutput: outputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Decode: RS",
|
||||
input: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.MjEJhtZk2nXzigi24piMzANmrj3mILHJcDl0xOjl5a8EgdKVL1oaMEjTkMQp5RA8YrqeRBFaX-BGGCKOXn5zPY1DJwWsBUyN9C-wGR2Qye0eogH_3b4M9EW00TPCUPXm2rx8URFj7Wg9VlsmrGzLV2oKkPgkVxuFSxnpO3yjn1Y",
|
||||
expectedOutput: outputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Decode: ES",
|
||||
input: "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.WkECT51jSfpRkcpQ4x0h5Dwe7CFBI6u6Et2gWp91HC7mpN_qCFadRpsvJLtKubm6cJTLa68xtei0YrDD8fxIUA",
|
||||
expectedOutput: outputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: [],
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,163 +0,0 @@
|
|||
/**
|
||||
* JWT Sign tests
|
||||
*
|
||||
* @author gchq77703 []
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const inputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
|
||||
const hsKey = "secret_cat";
|
||||
const rsKey = `-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICWwIBAAKBgQDdlatRjRjogo3WojgGHFHYLugdUWAY9iR3fy4arWNA1KoS8kVw
|
||||
33cJibXr8bvwUAUparCwlvdbH6dvEOfou0/gCFQsHUfQrSDv+MuSUMAe8jzKE4qW
|
||||
+jK+xQU9a03GUnKHkkle+Q0pX/g6jXZ7r1/xAK5Do2kQ+X5xK9cipRgEKwIDAQAB
|
||||
AoGAD+onAtVye4ic7VR7V50DF9bOnwRwNXrARcDhq9LWNRrRGElESYYTQ6EbatXS
|
||||
3MCyjjX2eMhu/aF5YhXBwkppwxg+EOmXeh+MzL7Zh284OuPbkglAaGhV9bb6/5Cp
|
||||
uGb1esyPbYW+Ty2PC0GSZfIXkXs76jXAu9TOBvD0ybc2YlkCQQDywg2R/7t3Q2OE
|
||||
2+yo382CLJdrlSLVROWKwb4tb2PjhY4XAwV8d1vy0RenxTB+K5Mu57uVSTHtrMK0
|
||||
GAtFr833AkEA6avx20OHo61Yela/4k5kQDtjEf1N0LfI+BcWZtxsS3jDM3i1Hp0K
|
||||
Su5rsCPb8acJo5RO26gGVrfAsDcIXKC+bQJAZZ2XIpsitLyPpuiMOvBbzPavd4gY
|
||||
6Z8KWrfYzJoI/Q9FuBo6rKwl4BFoToD7WIUS+hpkagwWiz+6zLoX1dbOZwJACmH5
|
||||
fSSjAkLRi54PKJ8TFUeOP15h9sQzydI8zJU+upvDEKZsZc/UhT/SySDOxQ4G/523
|
||||
Y0sz/OZtSWcol/UMgQJALesy++GdvoIDLfJX5GBQpuFgFenRiRDabxrE9MNUZ2aP
|
||||
FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==
|
||||
-----END RSA PRIVATE KEY-----`;
|
||||
const esKey = `-----BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgevZzL1gdAFr88hb2
|
||||
OF/2NxApJCzGCEDdfSp6VQO30hyhRANCAAQRWz+jn65BtOMvdyHKcvjBeBSDZH2r
|
||||
1RTwjmYSi9R/zpBnuQ4EiMnCqfMPWiZqB4QdbAd0E7oH50VpuZ1P087G
|
||||
-----END PRIVATE KEY-----`;
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "JWT Sign: HS256",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS256"],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: HS384",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS384"],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: HS512",
|
||||
input: inputObject,
|
||||
expectedOutput: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [hsKey, "HS512"],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: ES256",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [esKey, "ES256"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: ES384",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [esKey, "ES384"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: ES512",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [esKey, "ES512"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: RS256",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [rsKey, "RS256"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: RS384",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [rsKey, "RS384"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Sign: RS512",
|
||||
input: inputObject,
|
||||
expectedOutput: inputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Sign",
|
||||
args: [esKey, "RS512"],
|
||||
},
|
||||
{
|
||||
op: "JWT Decode",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,75 +0,0 @@
|
|||
/**
|
||||
* JWT Verify tests
|
||||
*
|
||||
* @author gchq77703 []
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const outputObject = JSON.stringify({
|
||||
String: "SomeString",
|
||||
Number: 42,
|
||||
iat: 1
|
||||
}, null, 4);
|
||||
|
||||
const invalidAlgorithm = "JsonWebTokenError: invalid algorithm";
|
||||
|
||||
const hsKey = "secret_cat";
|
||||
const rsKey = `-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICWwIBAAKBgQDdlatRjRjogo3WojgGHFHYLugdUWAY9iR3fy4arWNA1KoS8kVw
|
||||
33cJibXr8bvwUAUparCwlvdbH6dvEOfou0/gCFQsHUfQrSDv+MuSUMAe8jzKE4qW
|
||||
+jK+xQU9a03GUnKHkkle+Q0pX/g6jXZ7r1/xAK5Do2kQ+X5xK9cipRgEKwIDAQAB
|
||||
AoGAD+onAtVye4ic7VR7V50DF9bOnwRwNXrARcDhq9LWNRrRGElESYYTQ6EbatXS
|
||||
3MCyjjX2eMhu/aF5YhXBwkppwxg+EOmXeh+MzL7Zh284OuPbkglAaGhV9bb6/5Cp
|
||||
uGb1esyPbYW+Ty2PC0GSZfIXkXs76jXAu9TOBvD0ybc2YlkCQQDywg2R/7t3Q2OE
|
||||
2+yo382CLJdrlSLVROWKwb4tb2PjhY4XAwV8d1vy0RenxTB+K5Mu57uVSTHtrMK0
|
||||
GAtFr833AkEA6avx20OHo61Yela/4k5kQDtjEf1N0LfI+BcWZtxsS3jDM3i1Hp0K
|
||||
Su5rsCPb8acJo5RO26gGVrfAsDcIXKC+bQJAZZ2XIpsitLyPpuiMOvBbzPavd4gY
|
||||
6Z8KWrfYzJoI/Q9FuBo6rKwl4BFoToD7WIUS+hpkagwWiz+6zLoX1dbOZwJACmH5
|
||||
fSSjAkLRi54PKJ8TFUeOP15h9sQzydI8zJU+upvDEKZsZc/UhT/SySDOxQ4G/523
|
||||
Y0sz/OZtSWcol/UMgQJALesy++GdvoIDLfJX5GBQpuFgFenRiRDabxrE9MNUZ2aP
|
||||
FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==
|
||||
-----END RSA PRIVATE KEY-----`;
|
||||
const esKey = `-----BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgevZzL1gdAFr88hb2
|
||||
OF/2NxApJCzGCEDdfSp6VQO30hyhRANCAAQRWz+jn65BtOMvdyHKcvjBeBSDZH2r
|
||||
1RTwjmYSi9R/zpBnuQ4EiMnCqfMPWiZqB4QdbAd0E7oH50VpuZ1P087G
|
||||
-----END PRIVATE KEY-----`;
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "JWT Verify: HS",
|
||||
input: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
|
||||
expectedOutput: outputObject,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Verify",
|
||||
args: [hsKey],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Verify: RS",
|
||||
input: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.MjEJhtZk2nXzigi24piMzANmrj3mILHJcDl0xOjl5a8EgdKVL1oaMEjTkMQp5RA8YrqeRBFaX-BGGCKOXn5zPY1DJwWsBUyN9C-wGR2Qye0eogH_3b4M9EW00TPCUPXm2rx8URFj7Wg9VlsmrGzLV2oKkPgkVxuFSxnpO3yjn1Y",
|
||||
expectedOutput: invalidAlgorithm,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Verify",
|
||||
args: [rsKey],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "JWT Verify: ES",
|
||||
input: "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.WkECT51jSfpRkcpQ4x0h5Dwe7CFBI6u6Et2gWp91HC7mpN_qCFadRpsvJLtKubm6cJTLa68xtei0YrDD8fxIUA",
|
||||
expectedOutput: invalidAlgorithm,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "JWT Verify",
|
||||
args: [esKey],
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* Jump tests
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Jump: Empty Label",
|
||||
input: [
|
||||
"should be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"c2hvdWxkIGJlIGNoYW5nZWQ=",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Jump",
|
||||
args: ["", 10],
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Jump: skips 1",
|
||||
input: [
|
||||
"shouldnt be changed",
|
||||
].join("\n"),
|
||||
expectedOutput: [
|
||||
"shouldnt be changed",
|
||||
].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Jump",
|
||||
args: ["skipReplace", 10],
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="],
|
||||
},
|
||||
{
|
||||
op: "Label",
|
||||
args: ["skipReplace"]
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* MS tests.
|
||||
*
|
||||
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Microsoft Script Decoder",
|
||||
input: "#@~^RQAAAA==-mD~sX|:/TP{~J:+dYbxL~@!F@*@!+@*@!&@*eEI@#@&@#@&\x7fjm.raY 214Wv:zms/obI0xEAAA==^#~@",
|
||||
expectedOutput: "var my_msg = \"Testing <1><2><3>!\";\r\n\r\nWScript.Echo(my_msg);",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Microsoft Script Decoder",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* Magic tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Magic: nothing",
|
||||
input: "",
|
||||
expectedOutput: "Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: hex",
|
||||
input: "41 42 43 44 45",
|
||||
expectedMatch: /"#recipe=From_Hex\('Space'\)"/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: jpeg",
|
||||
input: "\xFF\xD8\xFF",
|
||||
expectedMatch: /Render_Image\('Raw'\)/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, false, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Magic: mojibake",
|
||||
input: "d091d18bd100d182d180d0b0d10020d0bad0bed180d0b8d187d0bdd0b5d0b2d0b0d10020d0bbd0b8d100d0b020d0bfd180d18bd0b3d0b0d0b5d18220d187d0b5d180d0b5d0b720d0bbd0b5d0bdd0b8d0b2d183d18e20d100d0bed0b1d0b0d0bad1832e",
|
||||
expectedMatch: /Быртрар коричневар лира прыгает через ленивую робаку./,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [3, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Base58 tests.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Morse Code: 'SOS'",
|
||||
input: "SOS",
|
||||
expectedOutput: "... --- ...",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Morse Code",
|
||||
args: ["-/.", "Space", "Line feed"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Morse Code '... --- ...'",
|
||||
input: "... --- ...",
|
||||
expectedOutput: "SOS",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Morse Code",
|
||||
args: ["Space", "Line feed"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* NetBIOS tests.
|
||||
*
|
||||
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Encode NetBIOS name",
|
||||
input: "The NetBIOS name",
|
||||
expectedOutput: "FEGIGFCAEOGFHEECEJEPFDCAGOGBGNGF",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Encode NetBIOS Name",
|
||||
args: [65],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Decode NetBIOS Name",
|
||||
input: "FEGIGFCAEOGFHEECEJEPFDCAGOGBGNGF",
|
||||
expectedOutput: "The NetBIOS name",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Decode NetBIOS Name",
|
||||
args: [65],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* OTP HOTP tests.
|
||||
*
|
||||
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Generate HOTP",
|
||||
input: "12345678901234567890",
|
||||
expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Generate HOTP",
|
||||
args: ["", 32, 6, 0],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,285 +0,0 @@
|
|||
/**
|
||||
* PGP tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
const ASCII_TEXT = "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.";
|
||||
|
||||
const UTF8_TEXT = "Шанцы на высвятленне таго, што адбываецца на самай справе ў сусвеце настолькі выдаленыя, адзінае, што трэба зрабіць, гэта павесіць пачуццё яго і трымаць сябе занятымі.";
|
||||
|
||||
const ALL_BYTES = [
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
|
||||
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
|
||||
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
|
||||
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
|
||||
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
|
||||
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
|
||||
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
|
||||
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
|
||||
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
|
||||
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
|
||||
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
|
||||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
].join("");
|
||||
|
||||
|
||||
// RSA-1024
|
||||
const ALICE_PRIVATE = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
xcEYBFsNaYsBBAC9rnmjTzLLBCey2gq9un+XXP089sP3AONhSivdJlJEEWjt999o
|
||||
g8vM18TcEk1sxyItp/GLlE/T70NPFAvdVXKI0KDQZ9fm77JDKitl587npRaspOOX
|
||||
L1yUVFGVr4YEPDLoAT4PJgwI3TsEBfLGeOZqBqd/stw/FKjrNZJLRYfjnQARAQAB
|
||||
AAP9G3EGgAM74fXJQy1wUwqMMvsXrUjgs6IZQ0Cryo7PZVxExfNlCtsmZ42VGWbn
|
||||
H071OY22eu8LWCn2nut+MUM6EnjDZ7e/u85eHd0r5fY/3Vl0lQCy53RDdEQ3w8vA
|
||||
XcUSabxwqpubmtyC3jxIXmVH6rLLmSpGGX8IqHRTfNDwHTECAPsgeVy0qkT0kJq1
|
||||
Aw8gthHO6c3m1NOcAPyTqSRLVspxRDB0LuYHnVxAN+dUHFYAfwPj+h+E6ROolqe4
|
||||
IKtrls8CAMFcwisDUQXFQFmO2pkpgaQTkN9XjGqBhjYd1EGs+WcYZb7eD98Ue0TZ
|
||||
GUF4UtzHUW5hIiCgkTrwpdpRqE3xudMCAJbhnzE+Mj7yKAHAV8LjZfpJA9hh1G8c
|
||||
ATDpoWD1yAcLO1mMVkSExpMHoiuQ5ujzWyCHYnXDdRo6jkowP4JxIX+axs0AwrQE
|
||||
EwEKAB4FAlsNaYsCGy8DCwkHAxUKCAIeAQIXgAMWAgECGQEACgkQhCRlSN+Y5IXj
|
||||
5QP8CZns1zlWk7S37Dhvxe3K3EYVgefc+EDWsj3xvlo+QUKQMAmANFNnqYzt++mv
|
||||
cVhvGzyn+wa244fJb3xGYAi+G4Ya5pWQbXSzAVhjteHyLcjS6VZ/ydxDGCZK37Gc
|
||||
MYs/8x4kwdU+A8/bQhJ+nRVEJjkg0OcoH9rJv0kB+ilcC7LHwRgEWw1piwEEAOXO
|
||||
Jib0QIvuqKAZiN3Yol3xC9Wz5aXQyg7qCnnYHHrPIMgYvGrTjjvDFCwM5uxCv38Q
|
||||
d6rJnzrRXTC1EiAia/b7f76Z0r4W+j6KdVCGpQnVQE6b//WdY5ys1xLAkNr4xwNj
|
||||
42nrOIMGB1qV0XezJ4VBOMpMHlwE2WR27HOQakXDABEBAAEAA/9Svw4BzMVJHaBe
|
||||
NZOQviaIyPjH9ETmle2LvT4UbXqjxd057544oQCACFhFHEgyHj6x1A4i0wKgvS5f
|
||||
EXP7WimhUEybo8YktbYX691QGPHNNQw5dc6IzLZmSm9p1zpuOs1VBHs6lpR5Y0WT
|
||||
/2vDrbY2Loa+Dojuvuq3hY1Bu5fjcQIA/SdK6T8sEYwdZTfCKEWdvMQ8zhjioNNn
|
||||
5enUNT/WQXw6qvkczD2U48PlIXpwfn4Rjh3sGEiumng334LTslXtvwIA6GOl6eFC
|
||||
337clY0Yyog7cTsEZTdCQBIScZi7grMuL9KFWx4UbfHiDS976MRu1ciATCTSCdc5
|
||||
xgLEUF51WrWw/QIApR/pGgDg/Ow32jS38VonCH6TpFFMk9KciKCMm7sRrG3J6kFK
|
||||
UxuxWXPs+pWXjTn6ItfrX6M8dZZkC2BBR9UyrqB5wsCDBBgBCgAPBQJbDWmLBQkP
|
||||
CZwAAhsuAKgJEIQkZUjfmOSFnSAEGQEKAAYFAlsNaYsACgkQPtlTQFIjCzrjvQQA
|
||||
hyGjZ2zDMxyXA3oEoD3RfjPQtAYFPJ5i0/ir/FD2nX7//cyd8zJS24P6S9+ID8vB
|
||||
0n+JwF6KrvjqpMneXXbPmi5OebqMogLahWmhCtjriDKrfJJiL0HmTKGl89p2Z59e
|
||||
BoLbm4Jpk1rL7EmoibsmUZdBUutf0tw5IusXd/B5sNwhdgQArBzyHVIFyN+fegTE
|
||||
9cR677M92NjYhqY8c+fF/AV+7XQv0Vsi9B//HeTMCml6jytxdSIZBl7uLrasIOd0
|
||||
FJk+VP7UrOfDaz6oVq+tarStAelfqT9DRQXw+nEdes4bxDsPvi1OieTtexJRO181
|
||||
zdsmOukv2RhgrJzFCcpzAkUYGqjHwRgEWw1piwEEALDKG2L6NNhTXZ3MJJLVtEPD
|
||||
65c9KmT8DagJXCp0cl3bQbcs+zLmsfYwnIKNTOxnhxAER+5e6jmW4K7sbLY593rO
|
||||
iqDXXX8OR28t88IGjlIrVd+2t6+ma5ecSgsyVqBDFFTpAzg+QFWdk2VEOlA5zNfC
|
||||
dX94pLUMjPDAHSsZfrufABEBAAEAA/wIFwePzPFUIOR8zxWxXnQkUbfbMOJawqoB
|
||||
UYRVMQT2xIzKTBWmq6XjJTBUTREDFG26zudXwiInxn67ongLErX/Zhohq8lBYjjx
|
||||
QkQRtU+QSDsksdJJL0Lj/6SAkljkhXmO+jYmRVirQfGBVl33Dk9YWnd/VePO5epn
|
||||
nYPxEGT+MQIA6n9nHmzbz5ohSi6Ovn4OW0704K3kLhOQ3WP3j+5+bWXv0Xd89w7v
|
||||
ZMyv0IJOvhOw1670BcBxbI/CSFD4Nz+k+QIAwQAP/M8TdG1Twwx6yED0syNvPDfN
|
||||
5hzZM8031zTBbguSRJskD18aBtwcUun93+dcilRY94gXbl4xSq3YitTDVwIAvX+P
|
||||
06nJmFdgeoanpcYIBA4hwi+LPyfPcGo6tfnsxk7ul1mBK27TR+AjnJ+HNFCh54CM
|
||||
4cLH1djyBmwEt30Wm6FjwsCDBBgBCgAPBQJbDWmLBQkDwmcAAhsuAKgJEIQkZUjf
|
||||
mOSFnSAEGQEKAAYFAlsNaYsACgkQW/Z2teklb4u5/gP/fnZ7ZuV+l4c2EQY5Xnk8
|
||||
S/lY3Xr9zoucjQwQWeRKwAQYoiovzxA4XV8gGyrdAsrIPUFLp7PmUBG4YJV/7sVo
|
||||
zzRwVq+jS8Jo0xYbGJMv2DuAnXXrYCZWZRqRscr1Wlc+CUACmxYZjC1DVVrAXr0j
|
||||
TqYTk+jjhemTTAtUelgMhcX82wP9EEU66hCYFUayjn4bBlR1yEvMpJd8JSTHR/dZ
|
||||
H8t3Ri6R2AYRqBxro0JEXDhL9iDnuPQVxsbgq2YlhHrPJI8opKuxV7wrXrupzwFf
|
||||
KixJMNwsAPk/nSc4qIZvXTi2fmyAZDJYUgsm6CwkxumaVvIdVNGRmxqGSRTuEInt
|
||||
W03Cwfs=
|
||||
=Mb52
|
||||
-----END PGP PRIVATE KEY BLOCK-----`;
|
||||
|
||||
const ALICE_PUBLIC = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
xo0EWw1piwEEAL2ueaNPMssEJ7LaCr26f5dc/Tz2w/cA42FKK90mUkQRaO3332iD
|
||||
y8zXxNwSTWzHIi2n8YuUT9PvQ08UC91VcojQoNBn1+bvskMqK2XnzuelFqyk45cv
|
||||
XJRUUZWvhgQ8MugBPg8mDAjdOwQF8sZ45moGp3+y3D8UqOs1kktFh+OdABEBAAHN
|
||||
AMK0BBMBCgAeBQJbDWmLAhsvAwsJBwMVCggCHgECF4ADFgIBAhkBAAoJEIQkZUjf
|
||||
mOSF4+UD/AmZ7Nc5VpO0t+w4b8XtytxGFYHn3PhA1rI98b5aPkFCkDAJgDRTZ6mM
|
||||
7fvpr3FYbxs8p/sGtuOHyW98RmAIvhuGGuaVkG10swFYY7Xh8i3I0ulWf8ncQxgm
|
||||
St+xnDGLP/MeJMHVPgPP20ISfp0VRCY5INDnKB/ayb9JAfopXAuyzo0EWw1piwEE
|
||||
AOXOJib0QIvuqKAZiN3Yol3xC9Wz5aXQyg7qCnnYHHrPIMgYvGrTjjvDFCwM5uxC
|
||||
v38Qd6rJnzrRXTC1EiAia/b7f76Z0r4W+j6KdVCGpQnVQE6b//WdY5ys1xLAkNr4
|
||||
xwNj42nrOIMGB1qV0XezJ4VBOMpMHlwE2WR27HOQakXDABEBAAHCwIMEGAEKAA8F
|
||||
AlsNaYsFCQ8JnAACGy4AqAkQhCRlSN+Y5IWdIAQZAQoABgUCWw1piwAKCRA+2VNA
|
||||
UiMLOuO9BACHIaNnbMMzHJcDegSgPdF+M9C0BgU8nmLT+Kv8UPadfv/9zJ3zMlLb
|
||||
g/pL34gPy8HSf4nAXoqu+Oqkyd5dds+aLk55uoyiAtqFaaEK2OuIMqt8kmIvQeZM
|
||||
oaXz2nZnn14GgtubgmmTWsvsSaiJuyZRl0FS61/S3Dki6xd38Hmw3CF2BACsHPId
|
||||
UgXI3596BMT1xHrvsz3Y2NiGpjxz58X8BX7tdC/RWyL0H/8d5MwKaXqPK3F1IhkG
|
||||
Xu4utqwg53QUmT5U/tSs58NrPqhWr61qtK0B6V+pP0NFBfD6cR16zhvEOw++LU6J
|
||||
5O17ElE7XzXN2yY66S/ZGGCsnMUJynMCRRgaqM6NBFsNaYsBBACwyhti+jTYU12d
|
||||
zCSS1bRDw+uXPSpk/A2oCVwqdHJd20G3LPsy5rH2MJyCjUzsZ4cQBEfuXuo5luCu
|
||||
7Gy2Ofd6zoqg111/DkdvLfPCBo5SK1XftrevpmuXnEoLMlagQxRU6QM4PkBVnZNl
|
||||
RDpQOczXwnV/eKS1DIzwwB0rGX67nwARAQABwsCDBBgBCgAPBQJbDWmLBQkDwmcA
|
||||
AhsuAKgJEIQkZUjfmOSFnSAEGQEKAAYFAlsNaYsACgkQW/Z2teklb4u5/gP/fnZ7
|
||||
ZuV+l4c2EQY5Xnk8S/lY3Xr9zoucjQwQWeRKwAQYoiovzxA4XV8gGyrdAsrIPUFL
|
||||
p7PmUBG4YJV/7sVozzRwVq+jS8Jo0xYbGJMv2DuAnXXrYCZWZRqRscr1Wlc+CUAC
|
||||
mxYZjC1DVVrAXr0jTqYTk+jjhemTTAtUelgMhcX82wP9EEU66hCYFUayjn4bBlR1
|
||||
yEvMpJd8JSTHR/dZH8t3Ri6R2AYRqBxro0JEXDhL9iDnuPQVxsbgq2YlhHrPJI8o
|
||||
pKuxV7wrXrupzwFfKixJMNwsAPk/nSc4qIZvXTi2fmyAZDJYUgsm6CwkxumaVvId
|
||||
VNGRmxqGSRTuEIntW03Cwfs=
|
||||
=PuGL
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
// ECC-384
|
||||
const BOB_PRIVATE = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
xcAABFsNafYBAYDHiv+tCi4267xI6iTmBrhOKdNbKLWIYMG1OoE1f9qpT+nAVKFR
|
||||
zUAFXKqQjqMDESkAEQEAAQABewd7cLkIQHGKly8PE+P0h7fV7X5bJqwZiqDwC8DU
|
||||
38vCUO/KtkZO3jEQYA1U9DsNDQDA73KCr3K1tSX1afeWzb8vVBY4ZzXocKb9AMDV
|
||||
Vk17t1N4nClMfqpGIDELtYBMiiCDyJ0AwLsnQb9cE+g1MZETtNDYXXxilkO/4CP9
|
||||
8j4HzQDCZAQTAQoAHgUCWw1p9gIbLwMLCQcDFQoIAh4BAheAAxYCAQIZAQAKCRCE
|
||||
cIHWt/IPg+sqAYC6goCyOCYD/DytOW3I2cb12iDyFOSDsOx6lrmIgLyP0dDnbJHb
|
||||
S9ar68yuHeDqP7jHiARbDWn2AQEAwSE4qpbLQzSIUfwmfWXmHneAuQIkEYawRxK/
|
||||
H1JkGxcAEQEAAQAA/0pvbnK5OdBGMABBSehs3LrW/hWWIL0y/MfS7h/6gSJ5AID3
|
||||
YOgHLqEgM1Bo2TzvIjwlAIDH3E+0ynQFdLH96FPp47eLAH9e/NZ74e2N8sTMBoYO
|
||||
1sbcLp7CkwQYAQoADwUCWw1p9gUJDwmcAAIbLgBICRCEcIHWt/IPgz0gBBkBCgAG
|
||||
BQJbDWn2AAoJELU8cYHhYcru2lwBAL4OUK2fkhzh2VU3meXgAMWjoP6ryRUCTmSQ
|
||||
xuULvvCyfZMBfiHzV5QLgXSUVUA7Og6mlH5pw2gtgsZhijwwywkzF3tQ+s++hOZR
|
||||
161wHxQKgwHIU8eIBFsNafYBAQCjOV/I3a0HkXVtLndCrWFcjmLzim9PX8EpYUV3
|
||||
yG2/AQARAQABAAD8DBWPVduzl7/ZJcAu7CzR7F376NxG8J42+ioX12n9cNEAgNj7
|
||||
qAcnQCtTDlb1waf4mdcAgMCTCuwur8AqIOSjoOzqwucAf1MfeKXhwNAEtoiD7S44
|
||||
f8UvxsKTBBgBCgAPBQJbDWn2BQkDwmcAAhsuAEgJEIRwgda38g+DPSAEGQEKAAYF
|
||||
AlsNafYACgkQNBtaoVz6VrvTVAD+LD063VrU7vlJ7xQwtMun4G3FW+RKgb7Rsww8
|
||||
B1mt68F5dQGAm8ctxECzEMmyO8jSkjOLkG6u8zLQWFm9MBZqcdmt6EUDf1dA/3xu
|
||||
/y59qEGb0j4w
|
||||
=I/Gz
|
||||
-----END PGP PRIVATE KEY BLOCK-----`;
|
||||
|
||||
const BOB_PUBLIC = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
xj0EWw1p9gEBgMeK/60KLjbrvEjqJOYGuE4p01sotYhgwbU6gTV/2qlP6cBUoVHN
|
||||
QAVcqpCOowMRKQARAQABzQDCZAQTAQoAHgUCWw1p9gIbLwMLCQcDFQoIAh4BAheA
|
||||
AxYCAQIZAQAKCRCEcIHWt/IPg+sqAYC6goCyOCYD/DytOW3I2cb12iDyFOSDsOx6
|
||||
lrmIgLyP0dDnbJHbS9ar68yuHeDqP7jOLQRbDWn2AQEAwSE4qpbLQzSIUfwmfWXm
|
||||
HneAuQIkEYawRxK/H1JkGxcAEQEAAcKTBBgBCgAPBQJbDWn2BQkPCZwAAhsuAEgJ
|
||||
EIRwgda38g+DPSAEGQEKAAYFAlsNafYACgkQtTxxgeFhyu7aXAEAvg5QrZ+SHOHZ
|
||||
VTeZ5eAAxaOg/qvJFQJOZJDG5Qu+8LJ9kwF+IfNXlAuBdJRVQDs6DqaUfmnDaC2C
|
||||
xmGKPDDLCTMXe1D6z76E5lHXrXAfFAqDAchTzi0EWw1p9gEBAKM5X8jdrQeRdW0u
|
||||
d0KtYVyOYvOKb09fwSlhRXfIbb8BABEBAAHCkwQYAQoADwUCWw1p9gUJA8JnAAIb
|
||||
LgBICRCEcIHWt/IPgz0gBBkBCgAGBQJbDWn2AAoJEDQbWqFc+la701QA/iw9Ot1a
|
||||
1O75Se8UMLTLp+BtxVvkSoG+0bMMPAdZrevBeXUBgJvHLcRAsxDJsjvI0pIzi5Bu
|
||||
rvMy0FhZvTAWanHZrehFA39XQP98bv8ufahBm9I+MA==
|
||||
=K9ht
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "PGP Encrypt/Decrypt: RSA, nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Encrypt",
|
||||
"args": [ALICE_PUBLIC]
|
||||
},
|
||||
{
|
||||
"op": "PGP Decrypt",
|
||||
"args": [ALICE_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "PGP Encrypt/Decrypt: RSA, All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Encrypt",
|
||||
"args": [ALICE_PUBLIC]
|
||||
},
|
||||
{
|
||||
"op": "PGP Decrypt",
|
||||
"args": [ALICE_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "PGP Encrypt/Decrypt: ECC, nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Encrypt",
|
||||
"args": [BOB_PUBLIC]
|
||||
},
|
||||
{
|
||||
"op": "PGP Decrypt",
|
||||
"args": [BOB_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "PGP Encrypt/Decrypt: ECC, All bytes",
|
||||
input: ALL_BYTES,
|
||||
expectedOutput: ALL_BYTES,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Encrypt",
|
||||
"args": [BOB_PUBLIC]
|
||||
},
|
||||
{
|
||||
"op": "PGP Decrypt",
|
||||
"args": [BOB_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "PGP Decrypt and Verify: UTF8, Alice -> Bob",
|
||||
input: `-----BEGIN PGP MESSAGE-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
wTwDhHCB1rfyD4MBAX9ld8xGcf2v+X+pwINN0R0TvkWxNesKOQIKPV01AH8JG0J+
|
||||
+yFqLXqDHgYSLANNamfSwQoBOTWuh/5V6gpiXVm2oLHPv997AtoD/kVQrqylF5Xo
|
||||
HUsqPGtSgBA5WPX8tMoHKuqWxEy9FviLnIv73OZN0Ph70uo2E+QIv0Qx27znK0Jy
|
||||
KDSERvcldgShmVbDP3Pxtxkfr9xa2gar5f0OPovOmKGsTGciQJqPkclRwzIXg12L
|
||||
hyd2ElYOMf6vg/yOc06sX4Ih1Tn6JkYqMVJydykMv3g4Z8OXTfwrMLxwO1n3ZB/T
|
||||
OLdhBdsnREnyCqntBVjMKoRTQhfwq48n7b6caZ+aCPISdDIyDKBpxEzXaNBeEY2V
|
||||
GCqORM9WhsQ4A6pAx2SP694qH5vgOwrYrgeOU17oK++mzd1GyU2CXoFi73/PANJD
|
||||
TdC3hGr+S4XeuqZ368QG1cBWhNybsOu5sM2YbArb71ZMYuLDp+VolJbEkVf4c/dD
|
||||
pVEOaX39NVKe6HcpOiw+CFO6GEkQqCXNprWK6ivBHzkAlF2pjjqlS6qhWxFPicSD
|
||||
+1ZKM1fmZu99bhTmdqE3MJx//QMu7mvlHaM85OQkWhWPBxGw/60GVBX9YtvUtfMS
|
||||
IOE1W/Zqmqzq+4frwnzWwYv9/U1RwIs/qlFVnzliREOzW+om8EncSSd7fQ==
|
||||
=fEAT
|
||||
-----END PGP MESSAGE-----
|
||||
`,
|
||||
expectedOutput: `Signed by PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
|
||||
Signed on Tue, 29 May 2018 15:44:52 GMT
|
||||
----------------------------------
|
||||
${UTF8_TEXT}`,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Decrypt and Verify",
|
||||
"args": [ALICE_PUBLIC, BOB_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "PGP Decrypt: ASCII, Alice -> Bob",
|
||||
input: `-----BEGIN PGP MESSAGE-----
|
||||
Version: Keybase OpenPGP v2.0.77
|
||||
Comment: https://keybase.io/crypto
|
||||
|
||||
wYwDPtlTQFIjCzoBBACSlbN7tmQVxR5ZD0rvCwXUkxO3RU8WgBkkmrTCUs9a+xrS
|
||||
F9HuKcpX/N6XrwTXyuX3BN2tGys4zd6nHV8jYqBoIyWJsWe3viTa1dh/x4183+GP
|
||||
fP61gizi3pj0gi2vfGnMhnThbdiO32PVKAeHLHBK+r3XlXZ0kzZCQKRgd55yr9Kk
|
||||
Aa4SR+qpvtdobkDzbnbhcPLR6CQ8TMjTiNXEpgTc1i0JcP8jaMVFzBt8qgmDMdqU
|
||||
H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh
|
||||
8zKua7QLi6wJD/AtQ+D3/NgVpzoXwdoLvTjEcAyy+YWNWkJF/jvx3XV1Q/Fz7sHJ
|
||||
/bspORYvbi591S4U0m4pikwiOZk=
|
||||
=AVb/
|
||||
-----END PGP MESSAGE-----`,
|
||||
expectedOutput: ASCII_TEXT,
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "PGP Decrypt",
|
||||
"args": [ALICE_PRIVATE, ""]
|
||||
}
|
||||
]
|
||||
},
|
||||
]);
|
|
@ -1,68 +0,0 @@
|
|||
/**
|
||||
* PHP tests.
|
||||
*
|
||||
* @author Jarmo van Lenthe
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
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],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,132 +0,0 @@
|
|||
/**
|
||||
* Parse IP Range tests.
|
||||
*
|
||||
* @author Klaxon [klaxon@veyr.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Parse IPv4 CIDR",
|
||||
input: "10.0.0.0/30",
|
||||
expectedOutput: "Network: 10.0.0.0\nCIDR: 30\nMask: 255.255.255.252\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv4 hyphenated",
|
||||
input: "10.0.0.0 - 10.0.0.3",
|
||||
expectedOutput: "Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 30\n\tMask: 255.255.255.252\n\tSubnet range: 10.0.0.0 - 10.0.0.3\n\tTotal addresses in subnet: 4\n\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv4 list",
|
||||
input: "10.0.0.8\n10.0.0.5/30\n10.0.0.1\n10.0.0.3",
|
||||
expectedOutput: "Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 28\n\tMask: 255.255.255.240\n\tSubnet range: 10.0.0.0 - 10.0.0.15\n\tTotal addresses in subnet: 16\n\nRange: 10.0.0.1 - 10.0.0.8\nTotal addresses in range: 8\n\n10.0.0.1\n10.0.0.2\n10.0.0.3\n10.0.0.4\n10.0.0.5\n10.0.0.6\n10.0.0.7\n10.0.0.8",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv6 CIDR - full",
|
||||
input: "2404:6800:4001:0000:0000:0000:0000:0000/48",
|
||||
expectedOutput: "Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv6 CIDR - collapsed",
|
||||
input: "2404:6800:4001::/48",
|
||||
expectedOutput: "Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv6 hyphenated",
|
||||
input: "2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff",
|
||||
expectedOutput: "Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Parse IPv6 list",
|
||||
input: "2404:6800:4001:ffff:ffff:ffff:ffff:ffff\n2404:6800:4001::ffff\n2404:6800:4001:ffff:ffff::1111\n2404:6800:4001::/64",
|
||||
expectedOutput: "Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "IPv4 subnet out of range error",
|
||||
input: "10.1.1.1/34",
|
||||
expectedOutput: "IPv4 CIDR must be less than 32",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "invalid IPv4 address error",
|
||||
input: "444.1.1.1/30",
|
||||
expectedOutput: "Block out of range.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "IPv6 subnet out of range error",
|
||||
input: "2404:6800:4001::/129",
|
||||
expectedOutput: "IPv6 CIDR must be less than 128",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "invalid IPv6 address error",
|
||||
input: "2404:6800:4001:/12",
|
||||
expectedOutput: "Invalid input.\n\nEnter either a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0). IPv6 also supported.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Parse IP range",
|
||||
"args": [true, true, false]
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Power Set tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Power set: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Power Set",
|
||||
args: [","],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Power set",
|
||||
input: "1 2 4",
|
||||
expectedOutput: "\n4\n2\n1\n2 4\n1 4\n1 2\n1 2 4\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Power Set",
|
||||
args: [" "],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,59 +0,0 @@
|
|||
/**
|
||||
* StrUtils tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Regex: non-HTML op",
|
||||
input: "/<>",
|
||||
expectedOutput: "/<>",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Regular expression",
|
||||
"args": ["User defined", "", true, true, false, false, false, false, "Highlight matches"]
|
||||
},
|
||||
{
|
||||
"op": "Remove whitespace",
|
||||
"args": [true, true, true, true, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Regex: Dot matches all",
|
||||
input: "Hello\nWorld",
|
||||
expectedOutput: "Hello\nWorld",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Regular expression",
|
||||
"args": ["User defined", ".+", true, true, true, false, false, false, "List matches"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Regex: Astral off",
|
||||
input: "𝌆😆",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Regular expression",
|
||||
"args": ["User defined", "\\pS", true, true, false, false, false, false, "List matches"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Regex: Astral on",
|
||||
input: "𝌆😆",
|
||||
expectedOutput: "𝌆\n😆",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Regular expression",
|
||||
"args": ["User defined", "\\pS", true, true, false, false, true, false, "List matches"]
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,71 +0,0 @@
|
|||
/**
|
||||
* Register tests
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Register: RC4 key",
|
||||
input: "http://malwarez.biz/beacon.php?key=0e932a5c&data=8db7d5ebe38663a54ecbb334e3db11",
|
||||
expectedOutput: "zNu5y53uBoU2rm7qhq9ijjnVHSlJ9PJ/zpp+xL/to8qIBzkDwKzUNQ==",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Register",
|
||||
args: ["key=([\\da-f]*)", true, false]
|
||||
},
|
||||
{
|
||||
op: "RC4",
|
||||
args: [
|
||||
{
|
||||
"option": "Hex",
|
||||
"string": "$R0"
|
||||
}, "Hex", "Latin1"
|
||||
]
|
||||
},
|
||||
{
|
||||
op: "To Base64",
|
||||
args: ["A-Za-z0-9+/="]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Register: AES key",
|
||||
input: "51e201d463698ef5f717f71f5b4712af20be674b3bff53d38546396ee61daac4908e319ca3fcf7089bfb6b38ea99e781d26e577ba9dd6f311a39420b8978e93014b042d44726caedf5436eaf652429c0df94b521676c7c2ce812097c277273c7c72cd89aec8d9fb4a27586ccf6aa0aee224c34ba3bfdf7aeb1ddd477622b91e72c9e709ab60f8daf731ec0cc85ce0f746ff1554a5a3ec291ca40f9e629a872592d988fdd834534aba79c1ad1676769a7c010bf04739ecdb65d95302371d629d9e37e7b4a361da468f1ed5358922d2ea752dd11c366f3017b14aa011d2af03c44f95579098a15e3cf9b4486f8ffe9c239f34de7151f6ca6500fe4b850c3f1c02e801caf3a24464614e42801615b8ffaa07ac8251493ffda7de5ddf3368880c2b95b030f41f8f15066add071a66cf60e5f46f3a230d397b652963a21a53f",
|
||||
expectedOutput: `"You know," said Arthur, "it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young."
|
||||
"Why, what did she tell you?"
|
||||
"I don't know, I didn't listen."`,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Register",
|
||||
args: ["(.{32})", true, false]
|
||||
},
|
||||
{
|
||||
op: "Drop bytes",
|
||||
args: [0, 32, false]
|
||||
},
|
||||
{
|
||||
op: "AES Decrypt",
|
||||
args: [
|
||||
{
|
||||
"option": "Hex",
|
||||
"string": "1748e7179bd56570d51fa4ba287cc3e5"
|
||||
},
|
||||
{
|
||||
"option": "Hex",
|
||||
"string": "$R0"
|
||||
},
|
||||
"CTR", "Hex", "Raw",
|
||||
{
|
||||
"option": "Hex",
|
||||
"string": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -1,215 +0,0 @@
|
|||
/**
|
||||
* Rotate tests.
|
||||
*
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Rotate left: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate left",
|
||||
args: [1, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rotate left: normal",
|
||||
input: "61 62 63 31 32 33",
|
||||
expectedOutput: "c2 c4 c6 62 64 66",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate left",
|
||||
args: [1, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rotate left: carry",
|
||||
input: "61 62 63 31 32 33",
|
||||
expectedOutput: "85 89 8c c4 c8 cd",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate left",
|
||||
args: [2, true],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rotate right: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate right",
|
||||
args: [1, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rotate right: normal",
|
||||
input: "61 62 63 31 32 33",
|
||||
expectedOutput: "b0 31 b1 98 19 99",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate right",
|
||||
args: [1, false],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rotate right: carry",
|
||||
input: "61 62 63 31 32 33",
|
||||
expectedOutput: "d8 58 98 cc 4c 8c",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hex",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
op: "Rotate right",
|
||||
args: [2, true],
|
||||
},
|
||||
{
|
||||
op: "To Hex",
|
||||
args: ["Space"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: normal",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: full loop",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, 26]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: lowercase only",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Tur Qhvpx Bebja Fbk Jhzcrq Oire Tur Lnml Dbt.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, false, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: uppercase only",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Ghe Duick Orown Sox Wumped Bver Ghe Yazy Qog.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, true, 13]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT47: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT47",
|
||||
args: [47]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT47: normal",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "%96 \"F:4< qC@H? u@I yF>A65 ~G6C %96 {2KJ s@8]",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT47",
|
||||
args: [47]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT47: full loop",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT47",
|
||||
args: [94]
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* SeqUtils tests.
|
||||
*
|
||||
* @author Chris van Marle
|
||||
* @copyright Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "SeqUtils - Numeric sort photos",
|
||||
input: "Photo-1.jpg\nPhoto-4.jpg\nPhoto-2.jpg\nPhoto-3.jpg",
|
||||
expectedOutput: "Photo-1.jpg\nPhoto-2.jpg\nPhoto-3.jpg\nPhoto-4.jpg",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Sort",
|
||||
"args": ["Line feed", false, "Numeric"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "SeqUtils - Numeric sort CVE IDs",
|
||||
input: "CVE-2017-1234,CVE-2017-9999,CVE-2017-10000,CVE-2017-10001,CVE-2017-12345,CVE-2016-1234,CVE-2016-4321,CVE-2016-10000,CVE-2016-9999,CVE-2016-10001",
|
||||
expectedOutput: "CVE-2017-12345,CVE-2017-10001,CVE-2017-10000,CVE-2017-9999,CVE-2017-1234,CVE-2016-10001,CVE-2016-10000,CVE-2016-9999,CVE-2016-4321,CVE-2016-1234",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Sort",
|
||||
"args": ["Comma", true, "Numeric"]
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* Set Difference tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Set Difference",
|
||||
input: "1 2 3 4 5\n\n3 4 5 6 7",
|
||||
expectedOutput: "1 2",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Difference",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Difference: wrong sample count",
|
||||
input: "1 2 3 4 5_3_4 5 6 7",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Difference",
|
||||
args: [" ", "_"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Difference: item delimiter",
|
||||
input: "1;2;3;4;5\n\n3;4;5;6;7",
|
||||
expectedOutput: "1;2",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Difference",
|
||||
args: ["\n\n", ";"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Difference: sample delimiter",
|
||||
input: "1;2;3;4;5===3;4;5;6;7",
|
||||
expectedOutput: "1;2",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Difference",
|
||||
args: ["===", ";"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* Set Intersection tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Set Intersection",
|
||||
input: "1 2 3 4 5\n\n3 4 5 6 7",
|
||||
expectedOutput: "3 4 5",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Intersection",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Intersection: only one set",
|
||||
input: "1 2 3 4 5 6 7 8",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Intersection",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Intersection: item delimiter",
|
||||
input: "1-2-3-4-5\n\n3-4-5-6-7",
|
||||
expectedOutput: "3-4-5",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Intersection",
|
||||
args: ["\n\n", "-"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Intersection: sample delimiter",
|
||||
input: "1-2-3-4-5z3-4-5-6-7",
|
||||
expectedOutput: "3-4-5",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Intersection",
|
||||
args: ["z", "-"],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
* Set Union tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Set Union: Nothing",
|
||||
input: "\n\n",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Union",
|
||||
input: "1 2 3 4 5\n\n3 4 5 6 7",
|
||||
expectedOutput: "1 2 3 4 5 6 7",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Union: invalid sample number",
|
||||
input: "1 2 3 4 5\n\n3 4 5 6 7\n\n1",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Union: item delimiter",
|
||||
input: "1,2,3,4,5\n\n3,4,5,6,7",
|
||||
expectedOutput: "1,2,3,4,5,6,7",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["\n\n", ","],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Set Union: sample delimiter",
|
||||
input: "1 2 3 4 5whatever3 4 5 6 7",
|
||||
expectedOutput: "1 2 3 4 5 6 7",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Set Union",
|
||||
args: ["whatever", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,297 +0,0 @@
|
|||
/**
|
||||
* StrUtils tests.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Diff, basic usage",
|
||||
input: "testing23\n\ntesting123",
|
||||
expectedOutput: "testing<span class='hl5'>1</span>23",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Diff",
|
||||
"args": ["\\n\\n", "Character", true, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head 0",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head 1",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", 1]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head 2",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", 2]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head 6",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", 6]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head big",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", 100]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head all but 1",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4, 5].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", -1]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head all but 2",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", -2]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head all but 6",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", -6]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Head all but big",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Head",
|
||||
"args": ["Line feed", -100]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail 0",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", 0]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail 1",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", 1]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail 2",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", 2]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail 6",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", 6]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail big",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", 100]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail all but 1",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [2, 3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", -1]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail all but 2",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [3, 4, 5, 6].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", -2]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail all but 6",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", -6]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Tail all but big",
|
||||
input: [1, 2, 3, 4, 5, 6].join("\n"),
|
||||
expectedOutput: [].join("\n"),
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Tail",
|
||||
"args": ["Line feed", -100]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Escape String: single quotes",
|
||||
input: "Escape 'these' quotes.",
|
||||
expectedOutput: "Escape \\'these\\' quotes.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Escape string",
|
||||
"args": ["Special chars", "Single", false, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Escape String: double quotes",
|
||||
input: "Hello \"World\"!",
|
||||
expectedOutput: "Hello \\\"World\\\"!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Escape string",
|
||||
"args": ["Special chars", "Double", false, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Escape String: special characters",
|
||||
input: "Fizz & buzz\n\ttabbed newline\rcarriage returned line\nbackspace character: \"\" form feed character: \"\"",
|
||||
expectedOutput: "Fizz & buzz\\n\\ttabbed newline\\rcarriage returned line\\nbackspace character: \\\"\\b\\\" form feed character: \\\"\\f\\\"",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Escape string",
|
||||
"args": ["Special chars", "Double", false, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unescape String: quotes",
|
||||
input: "Hello \\\"World\\\"! Escape \\'these\\' quotes.",
|
||||
expectedOutput: "Hello \"World\"! Escape 'these' quotes.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unescape string",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unescape String: special characters",
|
||||
input: "Fizz \x26 buzz\\n\\ttabbed newline\\rcarriage returned line\\nbackspace character: \\\"\\b\\\" form feed character: \\\"\\f\\\"",
|
||||
expectedOutput: "Fizz & buzz\n\ttabbed newline\rcarriage returned line\nbackspace character: \"\" form feed character: \"\"",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unescape string",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Escape String: complex",
|
||||
input: "null\0backspace\btab\tnewline\nverticaltab\vformfeed\fcarriagereturn\rdoublequote\"singlequote'hex\xa9unicode\u2665codepoint\u{1D306}",
|
||||
expectedOutput: "null\\0backspace\\btab\\tnewline\\nverticaltab\\x0bformfeed\\fcarriagereturn\\rdoublequote\"singlequote\\'hex\\xa9unicode\\u2665codepoint\\u{1d306}",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Escape string",
|
||||
"args": ["Special chars", "Single", false, true, false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Unescape String: complex",
|
||||
input: "null\\0backspace\\btab\\tnewline\\nverticaltab\\vformfeed\\fcarriagereturn\\rdoublequote\\\"singlequote\\'hex\\xa9unicode\\u2665codepoint\\u{1D306}",
|
||||
expectedOutput: "null\0backspace\btab\tnewline\nverticaltab\vformfeed\fcarriagereturn\rdoublequote\"singlequote'hex\xa9unicode\u2665codepoint\u{1D306}",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Unescape string",
|
||||
"args": []
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* Symmetric difference tests.
|
||||
*
|
||||
* @author d98762625
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Symmetric Difference",
|
||||
input: "1 2 3 4 5\n\n3 4 5 6 7",
|
||||
expectedOutput: "1 2 6 7",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Symmetric Difference",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Symmetric Difference: wrong sample count",
|
||||
input: "1 2\n\n3 4 5\n\n3 4 5 6 7",
|
||||
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Symmetric Difference",
|
||||
args: ["\n\n", " "],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Symmetric Difference: item delimiter",
|
||||
input: "a_b_c_d_e\n\nc_d_e_f_g",
|
||||
expectedOutput: "a_b_f_g",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Symmetric Difference",
|
||||
args: ["\n\n", "_"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Symmetric Difference: sample delimiter",
|
||||
input: "a_b_c_d_eAAAAAc_d_e_f_g",
|
||||
expectedOutput: "a_b_f_g",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Symmetric Difference",
|
||||
args: ["AAAAA", "_"],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* To Geohash tests
|
||||
*
|
||||
* @author gchq77703
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "To Geohash",
|
||||
input: "37.8324,112.5584",
|
||||
expectedOutput: "ww8p1r4t8",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Geohash",
|
||||
args: [9],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Geohash",
|
||||
input: "37.9324,-112.2584",
|
||||
expectedOutput: "9w8pv3ruj",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Geohash",
|
||||
args: [9],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Geohash",
|
||||
input: "37.8324,112.5584",
|
||||
expectedOutput: "ww8",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Geohash",
|
||||
args: [3],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "To Geohash",
|
||||
input: "37.9324,-112.2584",
|
||||
expectedOutput: "9w8pv3rujxy5b99",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "To Geohash",
|
||||
args: [15],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* Translate DateTime Format tests.
|
||||
*
|
||||
* @author Cynser
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Translate DateTime Format",
|
||||
input: "01/04/1999 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: invalid input",
|
||||
input: "1234567890",
|
||||
expectedMatch: /Invalid format./,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: timezone conversion",
|
||||
input: "01/04/1999 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 17:33:01 -05:00 EST",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "US/Eastern"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: automatic input format",
|
||||
input: "1999-04-01 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Automatic", "", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue