mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-26 09:46:17 -04:00
Added parsing of headers.
This commit is contained in:
parent
c3994aa8e3
commit
7f97afd3e0
3 changed files with 172 additions and 78 deletions
|
@ -11,10 +11,7 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
setLongTestFailure,
|
||||
logTestReport,
|
||||
} from "../lib/utils.mjs";
|
||||
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
|
||||
|
||||
import TestRegister from "../lib/TestRegister.mjs";
|
||||
import "./tests/AESKeyWrap.mjs";
|
||||
|
@ -104,6 +101,7 @@ import "./tests/LZNT1Decompress.mjs";
|
|||
import "./tests/LZString.mjs";
|
||||
import "./tests/Magic.mjs";
|
||||
import "./tests/Media.mjs";
|
||||
import "./tests/MIMEDecoding";
|
||||
import "./tests/Modhex.mjs";
|
||||
import "./tests/MorseCode.mjs";
|
||||
import "./tests/MS.mjs";
|
||||
|
@ -167,14 +165,14 @@ const testStatus = {
|
|||
allTestsPassing: true,
|
||||
counts: {
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
setLongTestFailure();
|
||||
|
||||
const logOpsTestReport = logTestReport.bind(null, testStatus);
|
||||
|
||||
(async function() {
|
||||
(async function () {
|
||||
const results = await TestRegister.runTests();
|
||||
logOpsTestReport(results);
|
||||
})();
|
||||
|
|
46
tests/operations/tests/MIMEDecoding.mjs
Normal file
46
tests/operations/tests/MIMEDecoding.mjs
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* MIME Header Decoding tests
|
||||
*
|
||||
* @author mshwed [m@ttshwed.com]
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Encoded =?",
|
||||
input: "=?=?utf-8?q?test?=",
|
||||
expectedOutput: "=?test",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MIME Decoding",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "UTF-8 Encodings Multiple Headers",
|
||||
input: "=?utf-8?q?=C3=89ric?= <eric@example.org>, =?utf-8?q?Ana=C3=AFs?= <anais@example.org>",
|
||||
expectedOutput: "Éric <eric@example.org>, Anaïs <anais@example.org>",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MIME Decoding",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "UTF-8 Encodings Single Header",
|
||||
input: "=?utf-8?q?=C2=A1Hola,?= =?utf-8?q?_se=C3=B1or!?=",
|
||||
expectedOutput: "¡Hola, señor!",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "MIME Decoding",
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue