mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-26 09:46:17 -04:00
Merge branch 'master' into parse-ethernet-frame
This commit is contained in:
commit
2cd47f7103
41 changed files with 3049 additions and 328 deletions
|
@ -167,6 +167,37 @@ module.exports = {
|
|||
browser.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
},
|
||||
|
||||
"Autobaking the latest input": browser => {
|
||||
// Use the sleep recipe to simulate a long running task
|
||||
utils.loadRecipe(browser, "Sleep", "input", [2000]);
|
||||
|
||||
browser.waitForElementVisible("#stale-indicator");
|
||||
|
||||
// Enable previously disabled autobake
|
||||
browser.expect.element("#auto-bake").to.not.be.selected;
|
||||
browser.click("#auto-bake-label");
|
||||
browser.expect.element("#auto-bake").to.be.selected.before(1000);
|
||||
|
||||
// Add content to the input
|
||||
browser.pause(100);
|
||||
browser.sendKeys("#input-text .cm-content", "1");
|
||||
browser.waitForElementVisible("#output-loader");
|
||||
browser.pause(500);
|
||||
|
||||
// Make another change while the previous input is being baked
|
||||
browser
|
||||
.sendKeys("#input-text .cm-content", "2")
|
||||
.waitForElementNotVisible("#stale-indicator")
|
||||
.waitForElementNotVisible("#output-loader");
|
||||
|
||||
// Ensure we got the latest input baked
|
||||
utils.expectOutput(browser, "input12");
|
||||
|
||||
// Turn autobake off again
|
||||
browser.click("#auto-bake-label");
|
||||
browser.expect.element("#auto-bake").to.not.be.selected.before(1000);
|
||||
},
|
||||
|
||||
"Special content": browser => {
|
||||
/* Special characters are rendered correctly */
|
||||
utils.setInput(browser, SPECIAL_CHARS, false);
|
||||
|
@ -383,13 +414,17 @@ module.exports = {
|
|||
utils.setInput(browser, CHINESE_CHARS, false);
|
||||
utils.setChrEnc(browser, "input", "UTF-8");
|
||||
utils.bake(browser);
|
||||
utils.expectOutput(browser, "\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082");
|
||||
|
||||
/* Changing output to match input works as expected */
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
utils.bake(browser);
|
||||
/* Output encoding should be autodetected */
|
||||
browser
|
||||
.waitForElementVisible("#snackbar-container .snackbar-content", 5000)
|
||||
.expect.element("#snackbar-container .snackbar-content").text.to.equal("Output character encoding has been detected and changed to UTF-8");
|
||||
|
||||
utils.expectOutput(browser, CHINESE_CHARS);
|
||||
|
||||
/* Change the output encoding manually to test for URL presence */
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
|
||||
/* Encodings appear in the URL */
|
||||
browser.assert.urlContains("ienc=65001");
|
||||
browser.assert.urlContains("oenc=65001");
|
||||
|
@ -641,6 +676,20 @@ module.exports = {
|
|||
},
|
||||
|
||||
"Loading from URL": browser => {
|
||||
utils.clear(browser);
|
||||
|
||||
/* Side panel displays correct info */
|
||||
utils.uploadFile(browser, "files/TowelDay.jpeg");
|
||||
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-file-details")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-thumbnail")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-name")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-size")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-type")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-loaded");
|
||||
|
||||
/* Complex deep link populates the input correctly (encoding, eol, input) */
|
||||
browser
|
||||
.urlHash("recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=FF&oeol=PS")
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = {
|
|||
testOp(browser, ["From Hex", "Add Text To Image", "To Base64"], Images.PNG_HEX, Images.PNG_CHEF_B64, [[], ["Chef", "Center", "Middle", 0, 0, 16], []]);
|
||||
testOp(browser, "Adler-32 Checksum", "test input", "16160411");
|
||||
testOp(browser, "Affine Cipher Decode", "test input", "rcqr glnsr", [1, 2]);
|
||||
testOp(browser, "Affine Cipher Encode", "test input", "njln rbfpn", [2, 1]);
|
||||
testOp(browser, "Affine Cipher Encode", "test input", "gndg zoujg", [3, 1]);
|
||||
testOp(browser, "AMF Decode", "\u000A\u0013\u0001\u0003a\u0006\u0009test", /"\$value": "test"/);
|
||||
testOp(browser, "AMF Encode", '{"a": "test"}', "\u000A\u0013\u0001\u0003a\u0006\u0009test");
|
||||
testOp(browser, "Analyse hash", "0123456789abcdef", /CRC-64/);
|
||||
|
|
|
@ -39,6 +39,7 @@ function setInput(browser, input, type=true) {
|
|||
browser.execute(text => {
|
||||
window.app.setInput(text);
|
||||
}, [input]);
|
||||
browser.pause(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,13 +177,14 @@ function loadRecipe(browser, opName, input, args) {
|
|||
*/
|
||||
function expectOutput(browser, expected) {
|
||||
browser.execute(expected => {
|
||||
const output = window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
return window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
}, [expected], function({value}) {
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
browser.expect(value).match(expected);
|
||||
} else {
|
||||
return expected === output;
|
||||
browser.expect(value).to.be.equal(expected);
|
||||
}
|
||||
}, [expected]);
|
||||
});
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue