mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 07:21:02 -04:00
adding prettier
This commit is contained in:
parent
c5a1b69c30
commit
ab0bc52d3c
717 changed files with 29324 additions and 18602 deletions
|
@ -9,20 +9,16 @@
|
|||
const utils = require("./browserUtils.js");
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl);
|
||||
before: (browser) => {
|
||||
browser.resizeWindow(1280, 800).url(browser.launchUrl);
|
||||
},
|
||||
|
||||
"Loading screen": browser => {
|
||||
"Loading screen": (browser) => {
|
||||
// Check that the loading screen appears and then disappears within a reasonable time
|
||||
browser
|
||||
.waitForElementVisible("#preloader", 300)
|
||||
.waitForElementNotPresent("#preloader", 10000);
|
||||
browser.waitForElementVisible("#preloader", 300).waitForElementNotPresent("#preloader", 10000);
|
||||
},
|
||||
|
||||
"App loaded": browser => {
|
||||
"App loaded": (browser) => {
|
||||
browser.useCss();
|
||||
// Check that various important elements are loaded
|
||||
browser.expect.element("#operations").to.be.visible;
|
||||
|
@ -36,7 +32,7 @@ module.exports = {
|
|||
browser.expect.element("#output-text").to.be.visible;
|
||||
},
|
||||
|
||||
"Operations loaded": browser => {
|
||||
"Operations loaded": (browser) => {
|
||||
browser.useXpath();
|
||||
// Check that an operation in every category has been populated
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='To Base64']").to.be.present;
|
||||
|
@ -58,14 +54,12 @@ module.exports = {
|
|||
browser.expect.element("//li[contains(@class, 'operation') and text()='Register']").to.be.present;
|
||||
},
|
||||
|
||||
"Recipe can be run": browser => {
|
||||
"Recipe can be run": (browser) => {
|
||||
const toHex = "//li[contains(@class, 'operation') and text()='To Hex']";
|
||||
const op = "#rec-list .operation .op-title";
|
||||
|
||||
// Check that operation is visible
|
||||
browser
|
||||
.useXpath()
|
||||
.expect.element(toHex).to.be.visible;
|
||||
browser.useXpath().expect.element(toHex).to.be.visible;
|
||||
|
||||
// Add it to the recipe by double clicking
|
||||
browser
|
||||
|
@ -76,23 +70,17 @@ module.exports = {
|
|||
.doubleClick("xpath", toHex);
|
||||
|
||||
// Confirm that it has been added to the recipe
|
||||
browser
|
||||
.useCss()
|
||||
.waitForElementVisible(op, 100)
|
||||
.expect.element(op).text.to.contain("To Hex");
|
||||
browser.useCss().waitForElementVisible(op, 100).expect.element(op).text.to.contain("To Hex");
|
||||
|
||||
// Enter input
|
||||
browser
|
||||
.useCss()
|
||||
.sendKeys("#input-text .cm-content", "Don't Panic.")
|
||||
.pause(1000)
|
||||
.click("#bake");
|
||||
browser.useCss().sendKeys("#input-text .cm-content", "Don't Panic.").pause(1000).click("#bake");
|
||||
|
||||
// Check output
|
||||
browser
|
||||
.useCss()
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
||||
.expect.element("#output-text .cm-content")
|
||||
.text.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
||||
|
||||
// Clear recipe
|
||||
browser
|
||||
|
@ -103,99 +91,77 @@ module.exports = {
|
|||
.waitForElementNotPresent(op);
|
||||
},
|
||||
|
||||
"Test every module": browser => {
|
||||
"Test every module": (browser) => {
|
||||
browser.useCss();
|
||||
|
||||
// BSON
|
||||
loadOp("BSON deserialise", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("BSON deserialise", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Charts
|
||||
loadOp("Entropy", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Entropy", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Ciphers
|
||||
loadOp("AES Encrypt", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("AES Encrypt", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Code
|
||||
loadOp("XPath expression", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("XPath expression", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Compression
|
||||
loadOp("Gzip", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Gzip", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Crypto
|
||||
loadOp("MD5", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("MD5", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Default
|
||||
loadOp("Fork", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Fork", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Diff
|
||||
loadOp("Diff", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Diff", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Encodings
|
||||
loadOp("Encode text", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Encode text", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Hashing
|
||||
loadOp("Streebog", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Streebog", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Image
|
||||
loadOp("Extract EXIF", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Extract EXIF", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// PGP
|
||||
loadOp("PGP Encrypt", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("PGP Encrypt", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// PublicKey
|
||||
loadOp("Hex to PEM", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Hex to PEM", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Regex
|
||||
loadOp("Strings", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Strings", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// Shellcode
|
||||
loadOp("Disassemble x86", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Disassemble x86", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// URL
|
||||
loadOp("URL Encode", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("URL Encode", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// UserAgent
|
||||
loadOp("Parse User Agent", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("Parse User Agent", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
// YARA
|
||||
loadOp("YARA Rules", browser)
|
||||
.waitForElementNotVisible("#output-loader", 5000);
|
||||
loadOp("YARA Rules", browser).waitForElementNotVisible("#output-loader", 5000);
|
||||
|
||||
browser.click("#clr-recipe");
|
||||
},
|
||||
|
||||
"Move around the UI": browser => {
|
||||
"Move around the UI": (browser) => {
|
||||
const otherCat = "//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
|
||||
genUUID = "//li[contains(@class, 'operation') and text()='Generate UUID']";
|
||||
|
||||
browser.useXpath();
|
||||
|
||||
// Scroll to a lower category
|
||||
browser
|
||||
.getLocationInView(otherCat)
|
||||
.expect.element(otherCat).to.be.visible;
|
||||
browser.getLocationInView(otherCat).expect.element(otherCat).to.be.visible;
|
||||
|
||||
// Open category
|
||||
browser
|
||||
.click(otherCat)
|
||||
.expect.element(genUUID).to.be.visible;
|
||||
browser.click(otherCat).expect.element(genUUID).to.be.visible;
|
||||
|
||||
// Add op to recipe
|
||||
/* mouseButtonUp drops wherever the actual cursor is, not necessarily in the right place,
|
||||
|
@ -208,12 +174,13 @@ module.exports = {
|
|||
.useCss()
|
||||
.waitForElementVisible(".operation .op-title", 1000)
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.which.matches(/[\da-f-]{36}/);
|
||||
.expect.element("#output-text .cm-content")
|
||||
.text.which.matches(/[\da-f-]{36}/);
|
||||
|
||||
browser.click("#clr-recipe");
|
||||
},
|
||||
|
||||
"Search": browser => {
|
||||
"Search": (browser) => {
|
||||
// Search for an op
|
||||
browser
|
||||
.useCss()
|
||||
|
@ -223,7 +190,7 @@ module.exports = {
|
|||
.waitForElementVisible("//ul[@id='search-results']//b[text()='MD5']", 1000);
|
||||
},
|
||||
|
||||
"Alert bar": browser => {
|
||||
"Alert bar": (browser) => {
|
||||
// Bake nothing to create an empty output which can be copied
|
||||
utils.clear(browser);
|
||||
utils.bake(browser);
|
||||
|
@ -233,7 +200,8 @@ module.exports = {
|
|||
.click("#copy-output")
|
||||
.waitForElementVisible("#snackbar-container")
|
||||
.waitForElementVisible("#snackbar-container .snackbar-content")
|
||||
.expect.element("#snackbar-container .snackbar-content").text.to.equal("Copied raw output successfully.");
|
||||
.expect.element("#snackbar-container .snackbar-content")
|
||||
.text.to.equal("Copied raw output successfully.");
|
||||
|
||||
// Alert bar disappears after the correct amount of time
|
||||
// Should disappear after 2000ms
|
||||
|
@ -242,7 +210,7 @@ module.exports = {
|
|||
.waitForElementNotVisible("#snackbar-container");
|
||||
},
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -48,12 +48,12 @@ const ALL_BYTES = [
|
|||
"\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",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
|
||||
].join("");
|
||||
|
||||
const PUA_CHARS = "\ue000\ue001\uf8fe\uf8ff";
|
||||
|
||||
const MULTI_LINE_STRING =`"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."
|
||||
const MULTI_LINE_STRING = `"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."`;
|
||||
|
||||
|
@ -91,7 +91,7 @@ const CONTROL_CHAR_NAMES = {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
before: (browser) => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
|
@ -100,7 +100,7 @@ module.exports = {
|
|||
.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"CodeMirror has loaded correctly": browser => {
|
||||
"CodeMirror has loaded correctly": (browser) => {
|
||||
/* Editor has initialised */
|
||||
browser
|
||||
.useCss()
|
||||
|
@ -121,29 +121,45 @@ module.exports = {
|
|||
browser // Input
|
||||
.waitForElementVisible("#input-text .cm-status-bar")
|
||||
.waitForElementVisible("#input-text .cm-status-bar .stats-length-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("0");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#input-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .eol-value")
|
||||
.expect.element("#input-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
.expect.element("#input-text .cm-status-bar .stats-length-value")
|
||||
.text.to.equal("0");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("1");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#input-text .cm-status-bar .chr-enc-value")
|
||||
.text.to.equal("Raw Bytes");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .eol-value")
|
||||
.expect.element("#input-text .cm-status-bar .eol-value")
|
||||
.text.to.equal("LF");
|
||||
|
||||
browser // Output
|
||||
.waitForElementVisible("#output-text .cm-status-bar")
|
||||
.waitForElementVisible("#output-text .cm-status-bar .stats-length-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("0");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
|
||||
.expect.element("#output-text .cm-status-bar .baking-time-info").text.to.contain("ms");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#output-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .eol-value")
|
||||
.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
.expect.element("#output-text .cm-status-bar .stats-length-value")
|
||||
.text.to.equal("0");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("1");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
|
||||
.expect.element("#output-text .cm-status-bar .baking-time-info")
|
||||
.text.to.contain("ms");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#output-text .cm-status-bar .chr-enc-value")
|
||||
.text.to.equal("Raw Bytes");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .eol-value")
|
||||
.expect.element("#output-text .cm-status-bar .eol-value")
|
||||
.text.to.equal("LF");
|
||||
},
|
||||
|
||||
"Adding content": browser => {
|
||||
"Adding content": (browser) => {
|
||||
/* Status bar updates correctly */
|
||||
utils.setInput(browser, MULTI_LINE_STRING);
|
||||
|
||||
|
@ -167,23 +183,32 @@ module.exports = {
|
|||
browser.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
},
|
||||
|
||||
"Special content": browser => {
|
||||
"Special content": (browser) => {
|
||||
/* Special characters are rendered correctly */
|
||||
utils.setInput(browser, SPECIAL_CHARS, false);
|
||||
|
||||
// First line
|
||||
for (let i = 0x0; i <= 0x8; i++) {
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
// Tab \u0009
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/\u0009$/);
|
||||
|
||||
// Line feed \u000a
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{10}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
// Second line
|
||||
|
@ -192,9 +217,12 @@ module.exports = {
|
|||
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
|
||||
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
|
||||
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
.to.have.property("title").equals(`Control character ${name}`);
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${name}`);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.text.to.equal(value);
|
||||
}
|
||||
|
||||
|
@ -204,17 +232,26 @@ module.exports = {
|
|||
|
||||
// First line
|
||||
for (let i = 0x0; i <= 0x8; i++) {
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
// Tab \u0009
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/\u0009$/);
|
||||
|
||||
// Line feed \u000a
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{10}$/);
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
// Second line
|
||||
|
@ -223,20 +260,25 @@ module.exports = {
|
|||
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
|
||||
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
|
||||
|
||||
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
.to.have.property("title").equals(`Control character ${name}`);
|
||||
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${name}`);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.text.to.equal(value);
|
||||
}
|
||||
|
||||
/* Bytes are rendered correctly */
|
||||
utils.setInput(browser, ALL_BYTES, false);
|
||||
// Expect length to be 255, since one character is creating a newline
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{255}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{255}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("256");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
||||
/* PUA \ue000-\uf8ff */
|
||||
utils.setInput(browser, PUA_CHARS, false);
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
|
@ -250,8 +292,14 @@ module.exports = {
|
|||
Therefore, PUA characters should be rendered normally in the Input but as control character
|
||||
pictures in the output.
|
||||
*/
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^\ue000\ue001\uf8fe\uf8ff$/);
|
||||
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^\u2400\u2401\u3cfe\u3cff$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^\ue000\ue001\uf8fe\uf8ff$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^\u2400\u2401\u3cfe\u3cff$/);
|
||||
|
||||
/* Can be copied */
|
||||
utils.setInput(browser, SPECIAL_CHARS, false);
|
||||
|
@ -266,28 +314,28 @@ module.exports = {
|
|||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
browser.expect.element("#search").to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
|
||||
browser.expect
|
||||
.element("#search")
|
||||
.to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
|
||||
browser.clearValue("#search");
|
||||
|
||||
// Raw copy
|
||||
browser
|
||||
.click("#copy-output")
|
||||
.pause(100);
|
||||
browser.click("#copy-output").pause(100);
|
||||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
browser.expect.element("#search").to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
|
||||
browser.expect
|
||||
.element("#search")
|
||||
.to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
|
||||
browser.clearValue("#search");
|
||||
},
|
||||
|
||||
"HTML output": browser => {
|
||||
"HTML output": (browser) => {
|
||||
/* Displays correctly */
|
||||
utils.loadRecipe(browser, "Entropy", ALL_BYTES);
|
||||
utils.bake(browser);
|
||||
|
||||
browser
|
||||
.waitForElementVisible("#output-html")
|
||||
.waitForElementVisible("#output-html #chart-area");
|
||||
browser.waitForElementVisible("#output-html").waitForElementVisible("#output-html #chart-area");
|
||||
|
||||
/* Status bar widgets are disabled */
|
||||
browser.expect.element("#output-text .cm-status-bar .disabled .stats-length-value").to.be.visible;
|
||||
|
@ -300,17 +348,18 @@ module.exports = {
|
|||
utils.bake(browser);
|
||||
|
||||
for (let i = 0x0; i <= 0x4; i++) {
|
||||
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
/* Can be copied */
|
||||
// Raw copy
|
||||
browser
|
||||
.click("#copy-output")
|
||||
.pause(100);
|
||||
browser.click("#copy-output").pause(100);
|
||||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
|
@ -318,7 +367,7 @@ module.exports = {
|
|||
browser.clearValue("#search");
|
||||
},
|
||||
|
||||
"Highlighting": browser => {
|
||||
"Highlighting": (browser) => {
|
||||
utils.setInput(browser, SELECTABLE_STRING);
|
||||
utils.bake(browser);
|
||||
|
||||
|
@ -376,14 +425,17 @@ module.exports = {
|
|||
browser.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"Character encoding": browser => {
|
||||
"Character encoding": (browser) => {
|
||||
const CHINESE_CHARS = "不要恐慌。";
|
||||
/* Dropup works */
|
||||
/* Selecting changes output correctly */
|
||||
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");
|
||||
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");
|
||||
|
@ -395,9 +447,7 @@ module.exports = {
|
|||
browser.assert.urlContains("oenc=65001");
|
||||
|
||||
/* Preserved when changing tabs */
|
||||
browser
|
||||
.click("#btn-new-tab")
|
||||
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.expect.element("#input-text .chr-enc-value").text.that.equals("Raw Bytes");
|
||||
browser.expect.element("#output-text .chr-enc-value").text.that.equals("Raw Bytes");
|
||||
|
||||
|
@ -435,7 +485,7 @@ module.exports = {
|
|||
utils.expectOutput(browser, "\u00A4\u0408\u00ADn\u00AE\u0408\u00B7W\u040EC");
|
||||
},
|
||||
|
||||
"Line endings": browser => {
|
||||
"Line endings": (browser) => {
|
||||
/* Dropup works */
|
||||
/* Selecting changes view in input */
|
||||
utils.setInput(browser, MULTI_LINE_STRING);
|
||||
|
@ -530,7 +580,9 @@ module.exports = {
|
|||
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(2)")
|
||||
.waitForElementNotPresent("#input-text .cm-content .cm-line:nth-of-type(3)")
|
||||
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)");
|
||||
browser.expect.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)").text.to.equal("␋");
|
||||
browser.expect
|
||||
.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)")
|
||||
.text.to.equal("␋");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("304");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
@ -549,9 +601,7 @@ module.exports = {
|
|||
browser.assert.urlContains("oeol=%0D");
|
||||
|
||||
/* Preserved when changing tabs */
|
||||
browser
|
||||
.click("#btn-new-tab")
|
||||
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.expect.element("#input-text .eol-value").text.that.equals("LF");
|
||||
browser.expect.element("#output-text .eol-value").text.that.equals("LF");
|
||||
|
||||
|
@ -565,7 +615,7 @@ module.exports = {
|
|||
browser.expect.element("#output-text .eol-value").text.that.equals("CR");
|
||||
},
|
||||
|
||||
"File inputs": browser => {
|
||||
"File inputs": (browser) => {
|
||||
utils.clear(browser);
|
||||
|
||||
/* Side panel displays correct info */
|
||||
|
@ -589,16 +639,20 @@ module.exports = {
|
|||
.click("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("1px");
|
||||
.expect.element("#input-text .cm-file-details")
|
||||
.to.have.css("width")
|
||||
.which.equals("1px");
|
||||
|
||||
browser
|
||||
.click("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("200px");
|
||||
.expect.element("#input-text .cm-file-details")
|
||||
.to.have.css("width")
|
||||
.which.equals("200px");
|
||||
},
|
||||
|
||||
"Folder inputs": browser => {
|
||||
"Folder inputs": (browser) => {
|
||||
utils.clear(browser);
|
||||
|
||||
/* Side panel displays correct info */
|
||||
|
@ -619,19 +673,35 @@ module.exports = {
|
|||
.waitForElementVisible("#input-text .cm-file-details .file-details-type")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-loaded");
|
||||
|
||||
browser.getText("#input-text .cm-file-details .file-details-name", function(result) {
|
||||
browser.getText("#input-text .cm-file-details .file-details-name", function (result) {
|
||||
switch (result.value) {
|
||||
case "TowelDay.jpeg":
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("TowelDay.jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("61,379 bytes");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-name")
|
||||
.text.that.equals("TowelDay.jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-size")
|
||||
.text.that.equals("61,379 bytes");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-type")
|
||||
.text.that.equals("image/jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-loaded")
|
||||
.text.that.equals("100%");
|
||||
break;
|
||||
case "Hitchhikers_Guide.jpeg":
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("Hitchhikers_Guide.jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("36,595 bytes");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-name")
|
||||
.text.that.equals("Hitchhikers_Guide.jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-size")
|
||||
.text.that.equals("36,595 bytes");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-type")
|
||||
.text.that.equals("image/jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-loaded")
|
||||
.text.that.equals("100%");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -640,13 +710,18 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
"Loading from URL": browser => {
|
||||
"Loading from URL": (browser) => {
|
||||
/* 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=%0C&oeol=%E2%80%A9")
|
||||
.urlHash(
|
||||
"recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=%0C&oeol=%E2%80%A9"
|
||||
)
|
||||
.waitForElementVisible("#rec-list li.operation");
|
||||
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{65}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{65}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("66");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
@ -658,14 +733,21 @@ module.exports = {
|
|||
|
||||
utils.bake(browser);
|
||||
|
||||
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^.{44}$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{44}$/);
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("44");
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
},
|
||||
|
||||
"Replace input with output": browser => {
|
||||
"Replace input with output": (browser) => {
|
||||
/* Input is correctly populated */
|
||||
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [{ "option": "Hex", "string": "65" }, "Standard", false]);
|
||||
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [
|
||||
{ "option": "Hex", "string": "65" },
|
||||
"Standard",
|
||||
false
|
||||
]);
|
||||
utils.setChrEnc(browser, "input", "UTF-32LE");
|
||||
utils.setChrEnc(browser, "output", "UTF-7");
|
||||
utils.setEOLSeq(browser, "input", "CRLF");
|
||||
|
@ -673,7 +755,8 @@ module.exports = {
|
|||
|
||||
browser
|
||||
.sendKeys("#input-text .cm-content", browser.Keys.RETURN)
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("2");
|
||||
utils.bake(browser);
|
||||
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("67");
|
||||
|
@ -682,9 +765,7 @@ module.exports = {
|
|||
browser.expect.element("#input-text .eol-value").text.that.equals("CRLF");
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("268");
|
||||
|
||||
browser
|
||||
.click("#switch")
|
||||
.waitForElementVisible("#stale-indicator");
|
||||
browser.click("#switch").waitForElementVisible("#stale-indicator");
|
||||
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("268");
|
||||
|
||||
|
@ -693,12 +774,13 @@ module.exports = {
|
|||
browser.expect.element("#input-text .chr-enc-value").text.that.equals("UTF-7");
|
||||
browser.expect.element("#input-text .eol-value").text.that.equals("LS");
|
||||
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(1)").text.to.equal("␍");
|
||||
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)").text.to.equal("␑");
|
||||
browser.expect
|
||||
.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)")
|
||||
.text.to.equal("␑");
|
||||
browser.waitForElementNotPresent("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(50)");
|
||||
},
|
||||
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
const utils = require("./browserUtils.js");
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
before: (browser) => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
|
@ -25,16 +25,33 @@ module.exports = {
|
|||
.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"Sanity check operations": async browser => {
|
||||
"Sanity check operations": async (browser) => {
|
||||
const Images = await import("../samples/Images.mjs");
|
||||
testOp(browser, "A1Z26 Cipher Decode", "20 5 19 20 15 21 20 16 21 20", "testoutput");
|
||||
testOp(browser, "A1Z26 Cipher Encode", "test input", "20 5 19 20 9 14 16 21 20");
|
||||
testOp(browser, "ADD", "test input", "Ê»ÉÊv¿ÄÆËÊ", [{ "option": "Hex", "string": "56" }]);
|
||||
testOp(browser, "AES Decrypt", "b443f7f7c16ac5396a34273f6f639caa", "test output", [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" }, { "option": "Hex", "string": "00000000000000000000000000000000" }, "CBC", "Hex", "Raw", { "option": "Hex", "string": "" }]);
|
||||
testOp(browser, "AES Encrypt", "test input", "e42eb8fbfb7a98fff061cd2c1a794d92", [{"option": "Hex", "string": "00112233445566778899aabbccddeeff"}, {"option": "Hex", "string": "00000000000000000000000000000000"}, "CBC", "Raw", "Hex"]);
|
||||
testOp(browser, "AES Decrypt", "b443f7f7c16ac5396a34273f6f639caa", "test output", [
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ "option": "Hex", "string": "00000000000000000000000000000000" },
|
||||
"CBC",
|
||||
"Hex",
|
||||
"Raw",
|
||||
{ "option": "Hex", "string": "" }
|
||||
]);
|
||||
testOp(browser, "AES Encrypt", "test input", "e42eb8fbfb7a98fff061cd2c1a794d92", [
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ "option": "Hex", "string": "00000000000000000000000000000000" },
|
||||
"CBC",
|
||||
"Raw",
|
||||
"Hex"
|
||||
]);
|
||||
testOp(browser, "AND", "test input", "4$04 $044", [{ "option": "Hex", "string": "34" }]);
|
||||
testOp(browser, "Add line numbers", "test input", "1 test input");
|
||||
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, ["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]);
|
||||
|
@ -43,35 +60,97 @@ module.exports = {
|
|||
testOp(browser, "Analyse hash", "0123456789abcdef", /CRC-64/);
|
||||
testOp(browser, "Atbash Cipher", "test input", "gvhg rmkfg");
|
||||
// testOp(browser, "Avro to JSON", "test input", "test_output");
|
||||
testOp(browser, "BLAKE2b", "test input", "33ebdc8f38177f3f3f334eeb117a84e11f061bbca4db6b8923e5cec85103f59f415551a5d5a933fdb6305dc7bf84671c2540b463dbfa08ee1895cfaa5bd780b5", ["512", "Hex", { "option": "UTF8", "string": "pass" }]);
|
||||
testOp(browser, "BLAKE2s", "test input", "defe73d61dfa6e5807e4f9643e159a09ccda6be3c26dcd65f8a9bb38bfc973a7", ["256", "Hex", { "option": "UTF8", "string": "pass" }]);
|
||||
testOp(browser, "BSON deserialise", "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000", '{\u000A "a": "test"\u000A}');
|
||||
testOp(browser, "BSON serialise", '{"a":"test"}', "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000");
|
||||
testOp(
|
||||
browser,
|
||||
"BLAKE2b",
|
||||
"test input",
|
||||
"33ebdc8f38177f3f3f334eeb117a84e11f061bbca4db6b8923e5cec85103f59f415551a5d5a933fdb6305dc7bf84671c2540b463dbfa08ee1895cfaa5bd780b5",
|
||||
["512", "Hex", { "option": "UTF8", "string": "pass" }]
|
||||
);
|
||||
testOp(browser, "BLAKE2s", "test input", "defe73d61dfa6e5807e4f9643e159a09ccda6be3c26dcd65f8a9bb38bfc973a7", [
|
||||
"256",
|
||||
"Hex",
|
||||
{ "option": "UTF8", "string": "pass" }
|
||||
]);
|
||||
testOp(
|
||||
browser,
|
||||
"BSON deserialise",
|
||||
"\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000",
|
||||
'{\u000A "a": "test"\u000A}'
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
"BSON serialise",
|
||||
'{"a":"test"}',
|
||||
"\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000"
|
||||
);
|
||||
// testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
|
||||
testOp(browser, "Bcrypt", "test input", /^\$2a\$06\$.{53}$/, [6]);
|
||||
testOp(browser, "Bcrypt compare", "test input", "Match: test input", ["$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG"]);
|
||||
testOp(browser, "Bcrypt compare", "test input", "Match: test input", [
|
||||
"$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG"
|
||||
]);
|
||||
testOp(browser, "Bcrypt parse", "$2a$05$kXWtAIGB/R8VEzInoM5ocOTBtyc0m2YTIwFiBU/0XoW032f9QrkWW", /Rounds: 5/);
|
||||
testOp(browser, "Bifid Cipher Decode", "qblb tfovy", "test input", ["pass"]);
|
||||
testOp(browser, "Bifid Cipher Encode", "test input", "qblb tfovy", ["pass"]);
|
||||
testOp(browser, "Bit shift left", "test input", "\u00E8\u00CA\u00E6\u00E8@\u00D2\u00DC\u00E0\u00EA\u00E8");
|
||||
testOp(browser, "Bit shift right", "test input", ":29:\u0010478::");
|
||||
testOp(browser, "Blowfish Decrypt", "10884e15427dd84ec35204e9c8e921ae", "test_output", [{"option": "Hex", "string": "1234567801234567"}, {"option": "Hex", "string": "0011223344556677"}, "CBC", "Hex", "Raw"]);
|
||||
testOp(browser, "Blowfish Encrypt", "test input", "f0fadbd1d90d774f714248cf26b96410", [{"option": "Hex", "string": "1234567801234567"}, {"option": "Hex", "string": "0011223344556677"}, "CBC", "Raw", "Hex"]);
|
||||
testOp(browser, "Blowfish Decrypt", "10884e15427dd84ec35204e9c8e921ae", "test_output", [
|
||||
{ "option": "Hex", "string": "1234567801234567" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"CBC",
|
||||
"Hex",
|
||||
"Raw"
|
||||
]);
|
||||
testOp(browser, "Blowfish Encrypt", "test input", "f0fadbd1d90d774f714248cf26b96410", [
|
||||
{ "option": "Hex", "string": "1234567801234567" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"CBC",
|
||||
"Raw",
|
||||
"Hex"
|
||||
]);
|
||||
testOp(browser, ["From Hex", "Blur Image", "To Base64"], Images.PNG_HEX, Images.PNG_BLUR_B64);
|
||||
testOpHtml(browser, "Bombe", "XTSYN WAEUG EZALY NRQIM AMLZX MFUOD AWXLY LZCUZ QOQBQ JLCPK NDDRW F", "table tr:last-child td:first-child", "ECG", ["3-rotor", "LEYJVCNIXWPBQMDRTAKZGFUHOS", "BDFHJLCPRTXVZNYEIWGAKMUSQO<W", "AJDKSIRUXBLHWTMCQGZNPYFVOE<F", "ESOVPZJAYQUIRHXLNFTGKDCMWB<K", "AY BR CU DH EQ FS GL IP JX KN MO TZ VW", "HELLO CYBER CHEFU SER", 0, true]);
|
||||
testOp(browser, ["Bzip2 Compress", "To Hex"], "test input", "42 5a 68 39 31 41 59 26 53 59 cf 96 82 1d 00 00 03 91 80 40 00 02 21 4e 00 20 00 21 90 c2 10 c0 88 33 92 8e df 17 72 45 38 50 90 cf 96 82 1d");
|
||||
testOp(browser, ["From Hex", "Bzip2 Decompress"], "425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0", "test_output", [[], [true]]);
|
||||
// testOp(browser, "CBOR Decode", "test input", "test output");
|
||||
// testOp(browser, "CBOR Encode", "test input", "test output");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Bombe",
|
||||
"XTSYN WAEUG EZALY NRQIM AMLZX MFUOD AWXLY LZCUZ QOQBQ JLCPK NDDRW F",
|
||||
"table tr:last-child td:first-child",
|
||||
"ECG",
|
||||
[
|
||||
"3-rotor",
|
||||
"LEYJVCNIXWPBQMDRTAKZGFUHOS",
|
||||
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W",
|
||||
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F",
|
||||
"ESOVPZJAYQUIRHXLNFTGKDCMWB<K",
|
||||
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW",
|
||||
"HELLO CYBER CHEFU SER",
|
||||
0,
|
||||
true
|
||||
]
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
["Bzip2 Compress", "To Hex"],
|
||||
"test input",
|
||||
"42 5a 68 39 31 41 59 26 53 59 cf 96 82 1d 00 00 03 91 80 40 00 02 21 4e 00 20 00 21 90 c2 10 c0 88 33 92 8e df 17 72 45 38 50 90 cf 96 82 1d"
|
||||
);
|
||||
testOp(
|
||||
browser,
|
||||
["From Hex", "Bzip2 Decompress"],
|
||||
"425a68393141592653597b0884b7000003038000008200ce00200021a647a4218013709517c5dc914e14241ec2212dc0",
|
||||
"test_output",
|
||||
[[], [true]]
|
||||
);
|
||||
// testOp(browser, "CBOR Decode", "test input", "test output");
|
||||
// testOp(browser, "CBOR Encode", "test input", "test output");
|
||||
testOp(browser, "CRC-16 Checksum", "test input", "77c7");
|
||||
testOp(browser, "CRC-32 Checksum", "test input", "29822bc8");
|
||||
testOp(browser, "CRC-8 Checksum", "test input", "9d");
|
||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Beautify", "test input", "test_output");
|
||||
// testOp(browser, "CSS Minify", "test input", "test_output");
|
||||
// testOp(browser, "CSS selector", "test input", "test_output");
|
||||
// testOp(browser, "CSV to JSON", "test input", "test_output");
|
||||
// testOp(browser, "CTPH", "test input", "test_output");
|
||||
// testOp(browser, "CTPH", "test input", "test_output");
|
||||
// testOp(browser, "Cartesian Product", "test input", "test_output");
|
||||
// testOp(browser, "Change IP format", "test input", "test_output");
|
||||
// testOp(browser, "Chi Square", "test input", "test_output");
|
||||
|
@ -79,14 +158,72 @@ module.exports = {
|
|||
// testOp(browser, "CipherSaber2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Decode", "test input", "test_output");
|
||||
// testOp(browser, "Citrix CTX1 Encode", "test input", "test_output");
|
||||
testOpHtml(browser, "Colossus", "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N", "table tr:last-child td:first-child", "30", ["", "KH Pattern", "Z", "", "", "None", "Select Program", "Letter Count", "", "", "", "", "", "", false, "", "", "", "", "", "", false, "", "", "", "", "", "", false, "", false, "", false, false, false, false, false, "", false, false, "", "", 0, "", "", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
testOpHtml(browser, "Colossus", "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N", "table tr:last-child td:first-child", "30", [
|
||||
"",
|
||||
"KH Pattern",
|
||||
"Z",
|
||||
"",
|
||||
"",
|
||||
"None",
|
||||
"Select Program",
|
||||
"Letter Count",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]);
|
||||
// testOp(browser, "Comment", "test input", "test_output");
|
||||
// testOp(browser, "Compare CTPH hashes", "test input", "test_output");
|
||||
// testOp(browser, "Compare SSDEEP hashes", "test input", "test_output");
|
||||
// testOp(browser, "Conditional Jump", "test input", "test_output");
|
||||
testOpImage(browser, "Contain Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Convert area", "test input", "test_output");
|
||||
// testOp(browser, "Convert co-ordinate format", "test input", "test_output");
|
||||
// testOp(browser, "Convert co-ordinate format", "test input", "test_output");
|
||||
// testOp(browser, "Convert data units", "test input", "test_output");
|
||||
// testOp(browser, "Convert distance", "test input", "test_output");
|
||||
testOpImage(browser, "Convert Image Format", "files/Hitchhikers_Guide.jpeg");
|
||||
|
@ -96,7 +233,7 @@ module.exports = {
|
|||
// testOp(browser, "Count occurrences", "test input", "test_output");
|
||||
testOpImage(browser, "Cover Image", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpImage(browser, "Crop Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "CSS Selector", "test input", "test output");
|
||||
// testOp(browser, "CSS Selector", "test input", "test output");
|
||||
// testOp(browser, "DES Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "DES Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "DNS over HTTPS", "test input", "test_output");
|
||||
|
@ -108,24 +245,37 @@ module.exports = {
|
|||
// testOp(browser, "Derive EVP key", "test input", "test_output");
|
||||
// testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
|
||||
// testOp(browser, "Detect File Type", "test input", "test_output");
|
||||
testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", "ins:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]);
|
||||
testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", "ins:first-child", "mat", [
|
||||
"\\n\\n",
|
||||
"Word",
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]);
|
||||
// testOp(browser, "Disassemble x86", "test input", "test_output");
|
||||
testOpImage(browser, "Dither Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Divide", "test input", "test_output");
|
||||
// testOp(browser, "Divide", "test input", "test_output");
|
||||
// testOp(browser, "Drop bytes", "test input", "test_output");
|
||||
// testOp(browser, "Encode NetBIOS Name", "test input", "test_output");
|
||||
// testOp(browser, "Encode text", "test input", "test_output");
|
||||
// testOp(browser, "Enigma", "test input", "test_output");
|
||||
testOpHtml(browser, "Entropy", "test input", "", /Shannon entropy: 2.8464393446710154/);
|
||||
// testOp(browser, "Escape string", "test input", "test_output");
|
||||
// testOp(browser, "Escape string", "test input", "test_output");
|
||||
// testOp(browser, "Escape Unicode Characters", "test input", "test_output");
|
||||
// testOp(browser, "Expand alphabet range", "test input", "test_output");
|
||||
// testOp(browser, "Extract dates", "test input", "test_output");
|
||||
// testOp(browser, "Extract domains", "test input", "test_output");
|
||||
// testOp(browser, "Extract EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Extract EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Extract email addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract file paths", "test input", "test_output");
|
||||
testOpFile(browser, "Extract Files", "files/Hitchhikers_Guide.jpeg", ".card:last-child .collapsed", "extracted_at_0x3d38.zlib");
|
||||
testOpFile(
|
||||
browser,
|
||||
"Extract Files",
|
||||
"files/Hitchhikers_Guide.jpeg",
|
||||
".card:last-child .collapsed",
|
||||
"extracted_at_0x3d38.zlib"
|
||||
);
|
||||
testOpFile(browser, "Extract ID3", "files/mp3example.mp3", "tr:last-child td:last-child", "Kevin MacLeod");
|
||||
// testOp(browser, "Extract IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Extract LSB", "test input", "test_output");
|
||||
|
@ -143,7 +293,7 @@ module.exports = {
|
|||
// testOp(browser, "Format MAC addresses", "test input", "test_output");
|
||||
testOpHtml(browser, "Frequency distribution", "test input", "", /Number of bytes not represented: 248/);
|
||||
// testOp(browser, "From BCD", "test input", "test_output");
|
||||
// testOp(browser, "From Base", "test input", "test_output");
|
||||
// testOp(browser, "From Base", "test input", "test_output");
|
||||
// testOp(browser, "From Base32", "test input", "test_output");
|
||||
// testOp(browser, "From Base58", "test input", "test_output");
|
||||
// testOp(browser, "From Base62", "test input", "test_output");
|
||||
|
@ -158,26 +308,26 @@ module.exports = {
|
|||
// testOp(browser, "From Hex", "test input", "test_output");
|
||||
// testOp(browser, "From Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "From Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "From MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "From MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "From Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "From Octal", "test input", "test_output");
|
||||
// testOp(browser, "From Punycode", "test input", "test_output");
|
||||
// testOp(browser, "From Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "From UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "From UNIX Timestamp", "test input", "test_output");
|
||||
testOpHtml(browser, "Fuzzy Match", "test input", "b:last-child", "in", ["tein", 15, 30, 30, 15, -5, -15, -1]);
|
||||
// testOp(browser, "GOST hash", "test input", "test_output");
|
||||
// testOp(browser, "Generate all hashes", "test input", "test_output");
|
||||
// testOp(browser, "Generate HOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate HOTP", "test input", "test_output");
|
||||
testOpHtml(browser, "Generate Image", "test input", "img", "");
|
||||
// testOp(browser, "Generate Lorem Ipsum", "test input", "test_output");
|
||||
// testOp(browser, "Generate PGP Key Pair", "test input", "test_output");
|
||||
testOpHtml(browser, "Generate QR Code", "test input", "img", "");
|
||||
// testOp(browser, "Generate TOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate TOTP", "test input", "test_output");
|
||||
// testOp(browser, "Generate UUID", "test input", "test_output");
|
||||
// testOp(browser, "Generic Code Beautify", "test input", "test_output");
|
||||
// testOp(browser, "Group IP addresses", "test input", "test_output");
|
||||
// testOp(browser, "Gunzip", "test input", "test_output");
|
||||
// testOp(browser, "Gzip", "test input", "test_output");
|
||||
// testOp(browser, "Gunzip", "test input", "test_output");
|
||||
// testOp(browser, "Gzip", "test input", "test_output");
|
||||
// testOp(browser, "HAS-160", "test input", "test_output");
|
||||
// testOp(browser, "HMAC", "test input", "test_output");
|
||||
// testOp(browser, "HTML To Text", "test input", "test_output");
|
||||
|
@ -195,31 +345,31 @@ module.exports = {
|
|||
testOpImage(browser, "Image Opacity", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpHtml(browser, "Index of Coincidence", "test input", "", /Index of Coincidence: 0.08333333333333333/);
|
||||
testOpImage(browser, "Invert Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "JPath expression", "test input", "test_output");
|
||||
// testOp(browser, "JPath expression", "test input", "test_output");
|
||||
testOpHtml(browser, "JSON Beautify", "{a:1}", ".json-dict .json-literal", "1");
|
||||
// testOp(browser, "JSON Minify", "test input", "test_output");
|
||||
// testOp(browser, "JSON to CSV", "test input", "test_output");
|
||||
// testOp(browser, "JWT Decode", "test input", "test_output");
|
||||
// testOp(browser, "JWT Sign", "test input", "test_output");
|
||||
// testOp(browser, "JWT Verify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Minify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Parser", "test input", "test_output");
|
||||
// testOp(browser, "JSON to CSV", "test input", "test_output");
|
||||
// testOp(browser, "JWT Decode", "test input", "test_output");
|
||||
// testOp(browser, "JWT Sign", "test input", "test_output");
|
||||
// testOp(browser, "JWT Verify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Beautify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Minify", "test input", "test_output");
|
||||
// testOp(browser, "JavaScript Parser", "test input", "test_output");
|
||||
// testOp(browser, "Jump", "test input", "test_output");
|
||||
// testOp(browser, "Keccak", "test input", "test_output");
|
||||
// testOp(browser, "Keccak", "test input", "test_output");
|
||||
// testOp(browser, "Label", "test input", "test_output");
|
||||
// testOp(browser, "LM Hash", "test input", "test output");
|
||||
// testOp(browser, "LM Hash", "test input", "test output");
|
||||
// testOp(browser, "Lorenz", "test input", "test_output");
|
||||
// testOp(browser, "Luhn Checksum", "test input", "test_output");
|
||||
// testOp(browser, "LZ String", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Compress", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Decompress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Compress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Decompress", "test input", "test output");
|
||||
// testOp(browser, "MD2", "test input", "test_output");
|
||||
// testOp(browser, "MD4", "test input", "test_output");
|
||||
// testOp(browser, "MD5", "test input", "test_output");
|
||||
// testOp(browser, "MD6", "test input", "test_output");
|
||||
// testOp(browser, "LZ String", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Compress", "test input", "test output");
|
||||
// testOp(browser, "LZ4 Decompress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Compress", "test input", "test output");
|
||||
// testOp(browser, "LZMA Decompress", "test input", "test output");
|
||||
// testOp(browser, "MD2", "test input", "test_output");
|
||||
// testOp(browser, "MD4", "test input", "test_output");
|
||||
// testOp(browser, "MD5", "test input", "test_output");
|
||||
// testOp(browser, "MD6", "test input", "test_output");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(1) th:nth-of-type(2)", "Result snippet");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(2) td:nth-of-type(2)", "test_output");
|
||||
testOpHtml(browser, "Magic", "dGVzdF9vdXRwdXQ=", "tr:nth-of-type(2) td:nth-of-type(1)", /Base64/);
|
||||
|
@ -231,44 +381,56 @@ module.exports = {
|
|||
// testOp(browser, "Multiply", "test input", "test_output");
|
||||
// testOp(browser, "NOT", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Image", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Unicode", "test input", "test_output");
|
||||
// testOp(browser, "Normalise Unicode", "test input", "test_output");
|
||||
// testOp(browser, "Numberwang", "test input", "test_output");
|
||||
// testOp(browser, "OR", "test input", "test_output");
|
||||
// testOp(browser, "Object Identifier to Hex", "test input", "test_output");
|
||||
testOpHtml(browser, "Offset checker", "test input\n\nbest input", ".hl5", "est input");
|
||||
// testOp(browser, "Optical Character Recognition", "test input", "test_output");
|
||||
// testOp(browser, "Optical Character Recognition", "test input", "test_output");
|
||||
// testOp(browser, "PEM to Hex", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
|
||||
// testOp(browser, "PGP Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
|
||||
// testOp(browser, "PGP Verify", "test input", "test_output");
|
||||
// testOp(browser, "PHP Deserialize", "test input", "test_output");
|
||||
// testOp(browser, "Pad lines", "test input", "test_output");
|
||||
// testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
|
||||
// testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse colour code", "#000", ".colorpicker-preview", "rgb(0, 0, 0)");
|
||||
testOpHtml(browser, "Parse DateTime", "01/12/2000 13:00:00", "", /Date: Friday 1st December 2000/);
|
||||
// testOp(browser, "Parse IP range", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse IPv4 header", "45 c0 00 c4 02 89 00 00 ff 11 1e 8c c0 a8 0c 01 c0 a8 0c 02", "tr:last-child td:last-child", "192.168.12.2");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse IPv4 header",
|
||||
"45 c0 00 c4 02 89 00 00 ff 11 1e 8c c0 a8 0c 01 c0 a8 0c 02",
|
||||
"tr:last-child td:last-child",
|
||||
"192.168.12.2"
|
||||
);
|
||||
// testOp(browser, "Parse IPv6 address", "test input", "test_output");
|
||||
// testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
|
||||
// testOp(browser, "Parse QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
|
||||
// testOp(browser, "Parse QR Code", "test input", "test_output");
|
||||
// testOp(browser, "Parse SSH Host Key", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse TCP", "c2eb0050a138132e70dc9fb9501804025ea70000", "tr:nth-of-type(2) td:last-child", "49899");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Parse TCP",
|
||||
"c2eb0050a138132e70dc9fb9501804025ea70000",
|
||||
"tr:nth-of-type(2) td:last-child",
|
||||
"49899"
|
||||
);
|
||||
// testOp(browser, "Parse TLV", "test input", "test_output");
|
||||
testOpHtml(browser, "Parse UDP", "04 89 00 35 00 2c 01 01", "tr:last-child td:last-child", "0x0101");
|
||||
// testOp(browser, "Parse UNIX file permissions", "test input", "test_output");
|
||||
// testOp(browser, "Parse URI", "test input", "test_output");
|
||||
// testOp(browser, "Parse User Agent", "test input", "test_output");
|
||||
// testOp(browser, "Parse User Agent", "test input", "test_output");
|
||||
// testOp(browser, "Parse X.509 certificate", "test input", "test_output");
|
||||
testOpFile(browser, "Play Media", "files/mp3example.mp3", "audio", "");
|
||||
// testOp(browser, "Power Set", "test input", "test_output");
|
||||
// testOp(browser, "Protobuf Decode", "test input", "test_output");
|
||||
// testOp(browser, "Protobuf Decode", "test input", "test_output");
|
||||
// testOp(browser, "Pseudo-Random Number Generator", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC4", "test input", "test_output");
|
||||
// testOp(browser, "RC4 Drop", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Decrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC2 Encrypt", "test input", "test_output");
|
||||
// testOp(browser, "RC4", "test input", "test_output");
|
||||
// testOp(browser, "RC4 Drop", "test input", "test_output");
|
||||
// testOp(browser, "RIPEMD", "test input", "test_output");
|
||||
// testOp(browser, "ROT13", "test input", "test_output");
|
||||
// testOp(browser, "ROT47", "test input", "test_output");
|
||||
|
@ -276,10 +438,20 @@ module.exports = {
|
|||
// testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
|
||||
// testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
|
||||
testOpImage(browser, "Randomize Colour Palette", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Raw Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Inflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Raw Inflate", "test input", "test_output");
|
||||
// testOp(browser, "Register", "test input", "test_output");
|
||||
testOpHtml(browser, "Regular expression", "The cat sat on the mat", ".hl2:last-child", "mat", ["User defined", ".at", true, true, false, false, false, false, "Highlight matches"]);
|
||||
testOpHtml(browser, "Regular expression", "The cat sat on the mat", ".hl2:last-child", "mat", [
|
||||
"User defined",
|
||||
".at",
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"Highlight matches"
|
||||
]);
|
||||
// testOp(browser, "Remove Diacritics", "test input", "test_output");
|
||||
// testOp(browser, "Remove EXIF", "test input", "test_output");
|
||||
// testOp(browser, "Remove line numbers", "test input", "test_output");
|
||||
|
@ -293,14 +465,14 @@ module.exports = {
|
|||
testOpImage(browser, "Rotate Image", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Rotate left", "test input", "test_output");
|
||||
// testOp(browser, "Rotate right", "test input", "test_output");
|
||||
// testOp(browser, "Scrypt", "test input", "test output");
|
||||
// testOp(browser, "SHA0", "test input", "test_output");
|
||||
// testOp(browser, "SHA1", "test input", "test_output");
|
||||
// testOp(browser, "SHA2", "test input", "test_output");
|
||||
// testOp(browser, "SHA3", "test input", "test_output");
|
||||
// testOp(browser, "Scrypt", "test input", "test output");
|
||||
// testOp(browser, "SHA0", "test input", "test_output");
|
||||
// testOp(browser, "SHA1", "test input", "test_output");
|
||||
// testOp(browser, "SHA2", "test input", "test_output");
|
||||
// testOp(browser, "SHA3", "test input", "test_output");
|
||||
// testOp(browser, "SQL Beautify", "test input", "test_output");
|
||||
// testOp(browser, "SQL Minify", "test input", "test_output");
|
||||
// testOp(browser, "SSDEEP", "test input", "test_output");
|
||||
// testOp(browser, "SSDEEP", "test input", "test_output");
|
||||
// testOp(browser, "SUB", "test input", "test_output");
|
||||
// testOp(browser, "Scan for Embedded Files", "test input", "test_output");
|
||||
testOpHtml(browser, "Scatter chart", "a b\n1 2", "svg", /a/);
|
||||
|
@ -309,12 +481,18 @@ module.exports = {
|
|||
// testOp(browser, "Set Difference", "test input", "test_output");
|
||||
// testOp(browser, "Set Intersection", "test input", "test_output");
|
||||
// testOp(browser, "Set Union", "test input", "test_output");
|
||||
// testOp(browser, "Shake", "test input", "test_output");
|
||||
// testOp(browser, "Shake", "test input", "test_output");
|
||||
testOpImage(browser, "Sharpen Image", "files/Hitchhikers_Guide.jpeg");
|
||||
testOpHtml(browser, "Show Base64 offsets", "test input", "span:nth-last-of-type(2)", "B");
|
||||
testOpHtml(browser, "Show on map", "51.5007° N, 0.1246° W", "#presentedMap .leaflet-popup-content", "51.5007,-0.1246");
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Show on map",
|
||||
"51.5007° N, 0.1246° W",
|
||||
"#presentedMap .leaflet-popup-content",
|
||||
"51.5007,-0.1246"
|
||||
);
|
||||
// testOp(browser, "Sleep", "test input", "test_output");
|
||||
// testOp(browser, "SM3", "test input", "test output");
|
||||
// testOp(browser, "SM3", "test input", "test output");
|
||||
// testOp(browser, "Snefru", "test input", "test_output");
|
||||
// testOp(browser, "Sort", "test input", "test_output");
|
||||
// testOp(browser, "Split", "test input", "test_output");
|
||||
|
@ -327,7 +505,7 @@ module.exports = {
|
|||
// testOp(browser, "Subsection", "test input", "test_output");
|
||||
// testOp(browser, "Substitute", "test input", "test_output");
|
||||
// testOp(browser, "Subtract", "test input", "test_output");
|
||||
// testOp(browser, "Sum", "test input", "test_output");
|
||||
// testOp(browser, "Sum", "test input", "test_output");
|
||||
// testOp(browser, "Swap endianness", "test input", "test_output");
|
||||
// testOp(browser, "Symmetric Difference", "test input", "test_output");
|
||||
testOpHtml(browser, "Syntax highlighter", "var a = [4,5,6]", ".hljs-selector-attr", "[4,5,6]");
|
||||
|
@ -335,7 +513,13 @@ module.exports = {
|
|||
// testOp(browser, "Tail", "test input", "test_output");
|
||||
// testOp(browser, "Take bytes", "test input", "test_output");
|
||||
testOp(browser, "Tar", "test input", /^file\.txt\x00{92}/);
|
||||
testOpHtml(browser, "Text Encoding Brute Force", "test input", "tr:nth-of-type(4) td:last-child", /t\u2400e\u2400s\u2400t\u2400/);
|
||||
testOpHtml(
|
||||
browser,
|
||||
"Text Encoding Brute Force",
|
||||
"test input",
|
||||
"tr:nth-of-type(4) td:last-child",
|
||||
/t\u2400e\u2400s\u2400t\u2400/
|
||||
);
|
||||
// testOp(browser, "To BCD", "test input", "test_output");
|
||||
// testOp(browser, "To Base", "test input", "test_output");
|
||||
// testOp(browser, "To Base32", "test input", "test_output");
|
||||
|
@ -345,7 +529,7 @@ module.exports = {
|
|||
// testOp(browser, "To Base85", "test input", "test_output");
|
||||
// testOp(browser, "To Binary", "test input", "test_output");
|
||||
// testOp(browser, "To Braille", "test input", "test_output");
|
||||
// testOp(browser, "To Camel case", "test input", "test_output");
|
||||
// testOp(browser, "To Camel case", "test input", "test_output");
|
||||
// testOp(browser, "To Case Insensitive Regex", "test input", "test_output");
|
||||
// testOp(browser, "To Charcode", "test input", "test_output");
|
||||
// testOp(browser, "To Decimal", "test input", "test_output");
|
||||
|
@ -353,14 +537,14 @@ module.exports = {
|
|||
// testOp(browser, "To Hex", "test input", "test_output");
|
||||
// testOp(browser, "To Hex Content", "test input", "test_output");
|
||||
// testOp(browser, "To Hexdump", "test input", "test_output");
|
||||
// testOp(browser, "To Kebab case", "test input", "test_output");
|
||||
// testOp(browser, "To Kebab case", "test input", "test_output");
|
||||
// testOp(browser, "To Lower case", "test input", "test_output");
|
||||
// testOp(browser, "To MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "To MessagePack", "test input", "test_output");
|
||||
// testOp(browser, "To Morse Code", "test input", "test_output");
|
||||
// testOp(browser, "To Octal", "test input", "test_output");
|
||||
// testOp(browser, "To Punycode", "test input", "test_output");
|
||||
// testOp(browser, "To Quoted Printable", "test input", "test_output");
|
||||
// testOp(browser, "To Snake case", "test input", "test_output");
|
||||
// testOp(browser, "To Snake case", "test input", "test_output");
|
||||
testOpHtml(browser, "To Table", "a,b,c\n1,2,3", "", /| a | b | c |/);
|
||||
// testOp(browser, "To UNIX Timestamp", "test input", "test_output");
|
||||
// testOp(browser, "To Upper case", "test input", "test_output");
|
||||
|
@ -381,27 +565,30 @@ module.exports = {
|
|||
testOpImage(browser, "View Bit Plane", "files/Hitchhikers_Guide.jpeg");
|
||||
// testOp(browser, "Vigenère Decode", "test input", "test_output");
|
||||
// testOp(browser, "Vigenère Encode", "test input", "test_output");
|
||||
testOp(browser, "Whirlpool", "test input", "8a0ee6885ba241353d17cbbe5f06538a7f04c8c955d376c20d6233fd4dd41aaffd13291447090ce781b5f940da266ed6d02cf8b79d4867065d10bdfc04166f38");
|
||||
testOp(
|
||||
browser,
|
||||
"Whirlpool",
|
||||
"test input",
|
||||
"8a0ee6885ba241353d17cbbe5f06538a7f04c8c955d376c20d6233fd4dd41aaffd13291447090ce781b5f940da266ed6d02cf8b79d4867065d10bdfc04166f38"
|
||||
);
|
||||
// testOp(browser, "Windows Filetime to UNIX Timestamp", "test input", "test_output");
|
||||
testOp(browser, "XKCD Random Number", "test input", "4");
|
||||
// testOp(browser, "XML Beautify", "test input", "test_output");
|
||||
// testOp(browser, "XML Minify", "test input", "test_output");
|
||||
// testOp(browser, "XML Beautify", "test input", "test_output");
|
||||
// testOp(browser, "XML Minify", "test input", "test_output");
|
||||
// testOp(browser, "XOR", "test input", "test_output");
|
||||
// testOp(browser, "XOR Brute Force", "test input", "test_output");
|
||||
// testOp(browser, "XPath expression", "test input", "test_output");
|
||||
// testOp(browser, "YARA Rules", "test input", "test_output");
|
||||
// testOp(browser, "XPath expression", "test input", "test_output");
|
||||
// testOp(browser, "YARA Rules", "test input", "test_output");
|
||||
testOp(browser, "Zip", "test input", /^PK\u0003\u0004\u0014\u0000{3}/);
|
||||
// testOp(browser, "Zlib Deflate", "test input", "test_output");
|
||||
// testOp(browser, "Zlib Inflate", "test input", "test_output");
|
||||
},
|
||||
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @function
|
||||
* Clears the current recipe and bakes a new operation.
|
||||
*
|
||||
|
@ -410,8 +597,8 @@ module.exports = {
|
|||
* @param {string} input - input text for test
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function bakeOp(browser, opName, input, args=[]) {
|
||||
browser.perform(function() {
|
||||
function bakeOp(browser, opName, input, args = []) {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, input, args);
|
||||
|
@ -428,7 +615,7 @@ function bakeOp(browser, opName, input, args=[]) {
|
|||
* @param {string} output - expected output
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOp(browser, opName, input, output, args=[]) {
|
||||
function testOp(browser, opName, input, output, args = []) {
|
||||
bakeOp(browser, opName, input, args);
|
||||
utils.expectOutput(browser, output);
|
||||
}
|
||||
|
@ -443,7 +630,7 @@ function testOp(browser, opName, input, output, args=[]) {
|
|||
* @param {string} output - expected output
|
||||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpHtml(browser, opName, input, cssSelector, output, args=[]) {
|
||||
function testOpHtml(browser, opName, input, cssSelector, output, args = []) {
|
||||
bakeOp(browser, opName, input, args);
|
||||
|
||||
if (typeof output === "string") {
|
||||
|
@ -462,7 +649,7 @@ function testOpHtml(browser, opName, input, cssSelector, output, args=[]) {
|
|||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpImage(browser, opName, filename, args) {
|
||||
browser.perform(function() {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, "", args);
|
||||
|
@ -472,7 +659,9 @@ function testOpImage(browser, opName, filename, args) {
|
|||
|
||||
browser
|
||||
.waitForElementVisible("#output-html img")
|
||||
.expect.element("#output-html img").to.have.css("width").which.matches(/^[^0]\d*px/);
|
||||
.expect.element("#output-html img")
|
||||
.to.have.css("width")
|
||||
.which.matches(/^[^0]\d*px/);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -486,7 +675,7 @@ function testOpImage(browser, opName, filename, args) {
|
|||
* @param {Array<string>|Array<Array<string>>} args - arguments, nested if multiple ops
|
||||
*/
|
||||
function testOpFile(browser, opName, filename, cssSelector, output, args) {
|
||||
browser.perform(function() {
|
||||
browser.perform(function () {
|
||||
console.log(`Current test: ${opName}`);
|
||||
});
|
||||
utils.loadRecipe(browser, opName, "", args);
|
||||
|
|
|
@ -17,7 +17,8 @@ function clear(browser) {
|
|||
.click("#clr-recipe")
|
||||
.click("#clr-io")
|
||||
.waitForElementNotPresent("#rec-list li.operation")
|
||||
.expect.element("#input-text .cm-content").text.that.equals("");
|
||||
.expect.element("#input-text .cm-content")
|
||||
.text.that.equals("");
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -28,17 +29,17 @@ function clear(browser) {
|
|||
* @param {boolean} [type=true] - Whether to type the characters in by using sendKeys,
|
||||
* or to set the value of the editor directly (useful for special characters)
|
||||
*/
|
||||
function setInput(browser, input, type=true) {
|
||||
function setInput(browser, input, type = true) {
|
||||
clear(browser);
|
||||
if (type) {
|
||||
browser
|
||||
.useCss()
|
||||
.sendKeys("#input-text .cm-content", input)
|
||||
.pause(100);
|
||||
browser.useCss().sendKeys("#input-text .cm-content", input).pause(100);
|
||||
} else {
|
||||
browser.execute(text => {
|
||||
window.app.setInput(text);
|
||||
}, [input]);
|
||||
browser.execute(
|
||||
(text) => {
|
||||
window.app.setInput(text);
|
||||
},
|
||||
[input]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +70,8 @@ function setChrEnc(browser, io, enc) {
|
|||
.waitForElementVisible(io + " .chr-enc-select .cm-status-bar-select-scroll")
|
||||
.click("link text", enc)
|
||||
.waitForElementNotVisible(io + " .chr-enc-select .cm-status-bar-select-scroll")
|
||||
.expect.element(io + " .chr-enc-value").text.that.equals(enc);
|
||||
.expect.element(io + " .chr-enc-value")
|
||||
.text.that.equals(enc);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -87,7 +89,8 @@ function setEOLSeq(browser, io, eol) {
|
|||
.waitForElementVisible(io + " .eol-select .cm-status-bar-select-content")
|
||||
.click(`${io} .cm-status-bar-select-content a[data-val=${eol}]`)
|
||||
.waitForElementNotVisible(io + " .eol-select .cm-status-bar-select-content")
|
||||
.expect.element(io + " .eol-value").text.that.equals(eol);
|
||||
.expect.element(io + " .eol-value")
|
||||
.text.that.equals(eol);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -96,8 +99,8 @@ function setEOLSeq(browser, io, eol) {
|
|||
* @param {Browser} browser - Nightwatch client
|
||||
*/
|
||||
function copy(browser) {
|
||||
browser.perform(function() {
|
||||
const actions = this.actions({async: true});
|
||||
browser.perform(function () {
|
||||
const actions = this.actions({ async: true });
|
||||
|
||||
// Ctrl + Ins used as this works on Windows, Linux and Mac
|
||||
return actions
|
||||
|
@ -117,8 +120,8 @@ function copy(browser) {
|
|||
function paste(browser, el) {
|
||||
browser
|
||||
.click(el)
|
||||
.perform(function() {
|
||||
const actions = this.actions({async: true});
|
||||
.perform(function () {
|
||||
const actions = this.actions({ async: true });
|
||||
|
||||
// Shift + Ins used as this works on Windows, Linux and Mac
|
||||
return actions
|
||||
|
@ -141,11 +144,13 @@ function paste(browser, el) {
|
|||
function loadRecipe(browser, opName, input, args) {
|
||||
let recipeConfig;
|
||||
|
||||
if (typeof(opName) === "string") {
|
||||
recipeConfig = JSON.stringify([{
|
||||
"op": opName,
|
||||
"args": args
|
||||
}]);
|
||||
if (typeof opName === "string") {
|
||||
recipeConfig = JSON.stringify([
|
||||
{
|
||||
"op": opName,
|
||||
"args": args
|
||||
}
|
||||
]);
|
||||
} else if (opName instanceof Array) {
|
||||
recipeConfig = JSON.stringify(
|
||||
opName.map((op, i) => {
|
||||
|
@ -156,14 +161,12 @@ function loadRecipe(browser, opName, input, args) {
|
|||
})
|
||||
);
|
||||
} else {
|
||||
throw new Error("Invalid operation type. Must be string or array of strings. Received: " + typeof(opName));
|
||||
throw new Error("Invalid operation type. Must be string or array of strings. Received: " + typeof opName);
|
||||
}
|
||||
|
||||
clear(browser);
|
||||
setInput(browser, input, false);
|
||||
browser
|
||||
.urlHash("recipe=" + recipeConfig)
|
||||
.waitForElementPresent("#rec-list li.operation");
|
||||
browser.urlHash("recipe=" + recipeConfig).waitForElementPresent("#rec-list li.operation");
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -173,14 +176,17 @@ function loadRecipe(browser, opName, input, args) {
|
|||
* @param {string|RegExp} expected - The expected output value
|
||||
*/
|
||||
function expectOutput(browser, expected) {
|
||||
browser.execute(expected => {
|
||||
const output = window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
} else {
|
||||
return expected === output;
|
||||
}
|
||||
}, [expected]);
|
||||
browser.execute(
|
||||
(expected) => {
|
||||
const output = window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
} else {
|
||||
return expected === output;
|
||||
}
|
||||
},
|
||||
[expected]
|
||||
);
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
@ -197,10 +203,7 @@ function uploadFile(browser, filename) {
|
|||
browser.execute(() => {
|
||||
document.getElementById("open-file").style.display = "block";
|
||||
});
|
||||
browser
|
||||
.pause(100)
|
||||
.setValue("#open-file", filepath)
|
||||
.pause(100);
|
||||
browser.pause(100).setValue("#open-file", filepath).pause(100);
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-file").style.display = "none";
|
||||
});
|
||||
|
@ -221,17 +224,13 @@ function uploadFolder(browser, foldername) {
|
|||
browser.execute(() => {
|
||||
document.getElementById("open-folder").style.display = "block";
|
||||
});
|
||||
browser
|
||||
.pause(100)
|
||||
.setValue("#open-folder", folderpath)
|
||||
.pause(500);
|
||||
browser.pause(100).setValue("#open-folder", folderpath).pause(500);
|
||||
browser.execute(() => {
|
||||
document.getElementById("open-folder").style.display = "none";
|
||||
});
|
||||
browser.waitForElementVisible("#input-text .cm-file-details");
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
clear: clear,
|
||||
setInput: setInput,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue