mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 08:15:00 -04:00
Merge branch 'master' of github.com:gchq/CyberChef into allow-magic
This commit is contained in:
commit
0a3bea7ddf
92 changed files with 9934 additions and 5075 deletions
|
@ -97,6 +97,10 @@ import "./tests/DefangIP.mjs";
|
|||
import "./tests/ParseUDP.mjs";
|
||||
import "./tests/AvroToJSON.mjs";
|
||||
import "./tests/Lorenz.mjs";
|
||||
import "./tests/LuhnChecksum.mjs";
|
||||
import "./tests/CipherSaber2.mjs";
|
||||
import "./tests/Colossus.mjs";
|
||||
import "./tests/ParseObjectIDTimestamp.mjs";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
@ -112,5 +116,7 @@ setLongTestFailure();
|
|||
|
||||
const logOpsTestReport = logTestReport.bind(null, testStatus);
|
||||
|
||||
TestRegister.runTests()
|
||||
.then(logOpsTestReport);
|
||||
(async function() {
|
||||
const results = await TestRegister.runTests();
|
||||
logOpsTestReport(results);
|
||||
})();
|
||||
|
|
43
tests/operations/samples/Images.mjs
Normal file
43
tests/operations/samples/Images.mjs
Normal file
File diff suppressed because one or more lines are too long
45
tests/operations/tests/CipherSaber2.mjs
Normal file
45
tests/operations/tests/CipherSaber2.mjs
Normal file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* Ciphersaber2 tests.
|
||||
*
|
||||
* @author n1073645 [n1073645@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2020
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "CipherSaber2 Encrypt",
|
||||
input: "Hello World",
|
||||
expectedMatch: /.{21}/s,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Encrypt",
|
||||
args: [{ "option": "Latin1", "string": "test" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CipherSaber2 Decrypt",
|
||||
input: "\x5d\xd9\x7f\xeb\x77\x3c\x42\x9d\xfe\x9c\x3b\x21\x63\xbd\x53\x38\x18\x7c\x36\x37",
|
||||
expectedOutput: "helloworld",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Decrypt",
|
||||
args: [{ "option": "Latin1", "string": "test" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "CipherSaber2 Encrypt",
|
||||
input: "",
|
||||
expectedMatch: /.{10}/s,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "CipherSaber2 Encrypt",
|
||||
args: [{ "option": "Latin1", "string": "" }, 20],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
91
tests/operations/tests/Colossus.mjs
Normal file
91
tests/operations/tests/Colossus.mjs
Normal file
File diff suppressed because one or more lines are too long
32
tests/operations/tests/ConvertToNATOAlphabet.mjs
Normal file
32
tests/operations/tests/ConvertToNATOAlphabet.mjs
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @author MarvinJWendt [git@marvinjwendt.com]
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Convert to NATO alphabet: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Convert to NATO alphabet",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Convert to NATO alphabet: full alphabet with numbers",
|
||||
input: "abcdefghijklmnopqrstuvwxyz0123456789,/.",
|
||||
expectedOutput: "Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu Zero One Two Three Four Five Six Seven Eight Nine Comma Fraction bar Full stop ",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Convert to NATO alphabet",
|
||||
args: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
|
@ -92,6 +92,19 @@ TestRegister.addTests([
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "0x with Comma to Ascii",
|
||||
input: "0x74,0x65,0x73,0x74,0x20,0x73,0x74,0x72,0x69,0x6e,0x67",
|
||||
expectedOutput: "test string",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": [
|
||||
"0x with comma"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
|
File diff suppressed because one or more lines are too long
66
tests/operations/tests/LuhnChecksum.mjs
Normal file
66
tests/operations/tests/LuhnChecksum.mjs
Normal file
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* From Decimal tests
|
||||
*
|
||||
* @author n1073645 [n1073645@gmail.com]
|
||||
* @copyright Crown Copyright 2020
|
||||
* @licence Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Luhn Checksum on standard data",
|
||||
input: "35641709012469",
|
||||
expectedOutput: "Checksum: 7\nCheckdigit: 0\nLuhn Validated String: 356417090124690",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on standard data 2",
|
||||
input: "896101950123440000",
|
||||
expectedOutput: "Checksum: 5\nCheckdigit: 1\nLuhn Validated String: 8961019501234400001",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on standard data 3",
|
||||
input: "35726908971331",
|
||||
expectedOutput: "Checksum: 6\nCheckdigit: 7\nLuhn Validated String: 357269089713317",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on invalid data",
|
||||
input: "35641709b012469",
|
||||
expectedOutput: "Character: b is not a digit.",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Luhn Checksum on empty data",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Luhn Checksum",
|
||||
args: []
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
File diff suppressed because one or more lines are too long
24
tests/operations/tests/ParseObjectIDTimestamp.mjs
Normal file
24
tests/operations/tests/ParseObjectIDTimestamp.mjs
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Parse ObjectID timestamp tests
|
||||
*
|
||||
* @author dmfj [dominic@dmfj.io]
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Parse ISO timestamp from ObjectId",
|
||||
input: "000000000000000000000000",
|
||||
expectedOutput: "1970-01-01T00:00:00.000Z",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse ObjectID timestamp",
|
||||
args: [],
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue