Merge branch 'master' into feature-magic

This commit is contained in:
n1474335 2018-01-22 20:04:51 +00:00
commit 57314b77e5
8 changed files with 46 additions and 21 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "cyberchef", "name": "cyberchef",
"version": "7.5.1", "version": "7.5.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "cyberchef", "name": "cyberchef",
"version": "7.5.1", "version": "7.5.4",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>", "author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef", "homepage": "https://gchq.github.io/CyberChef",

View File

@ -903,9 +903,9 @@ const Utils = {
* "Pretty" CyberChef recipe formats are designed to be included in the fragment (#) or query (?) * "Pretty" CyberChef recipe formats are designed to be included in the fragment (#) or query (?)
* parts of the URL. They can also be loaded into CyberChef through the 'Load' interface. In order * parts of the URL. They can also be loaded into CyberChef through the 'Load' interface. In order
* to make this format as readable as possible, various special characters are used unescaped. This * to make this format as readable as possible, various special characters are used unescaped. This
* reduces the amount of percent-encoding included in the URL which is typically difficult to read, * reduces the amount of percent-encoding included in the URL which is typically difficult to read
* as well as substantially increasing the overall length. These characteristics can be quite * and substantially increases the overall length. These characteristics can be quite off-putting
* offputting for users. * for users.
* *
* @param {Object[]} recipeConfig * @param {Object[]} recipeConfig
* @param {boolean} newline - whether to add a newline after each operation * @param {boolean} newline - whether to add a newline after each operation
@ -922,12 +922,11 @@ const Utils = {
name = op.op.replace(/ /g, "_"); name = op.op.replace(/ /g, "_");
args = JSON.stringify(op.args) args = JSON.stringify(op.args)
.slice(1, -1) // Remove [ and ] as they are implied .slice(1, -1) // Remove [ and ] as they are implied
// We now need to switch double-quoted (") strings to single-quotes (') as these do not // We now need to switch double-quoted (") strings to single quotes (') as single quotes
// need to be percent-encoded. // do not need to be percent-encoded.
.replace(/'/g, "\\'") // Escape single quotes .replace(/'/g, "\\'") // Escape single quotes
.replace(/\\"/g, '"') // Unescape double quotes .replace(/"((?:[^"\\]|\\.)*)"/g, "'$1'") // Replace opening and closing " with '
.replace(/(^|,|{|:)"/g, "$1'") // Replace opening " with ' .replace(/\\"/g, '"'); // Unescape double quotes
.replace(/"(,|:|}|$)/g, "'$1"); // Replace closing " with '
disabled = op.disabled ? "/disabled": ""; disabled = op.disabled ? "/disabled": "";
bp = op.breakpoint ? "/breakpoint" : ""; bp = op.breakpoint ? "/breakpoint" : "";

View File

@ -2411,13 +2411,13 @@ const OperationConfig = {
args: [ args: [
{ {
name: "Split delimiter", name: "Split delimiter",
type: "binaryShortString", type: "editableOption",
value: StrUtils.SPLIT_DELIM value: StrUtils.SPLIT_DELIM_OPTIONS
}, },
{ {
name: "Join delimiter", name: "Join delimiter",
type: "option", type: "editableOption",
value: StrUtils.DELIMITER_OPTIONS value: StrUtils.JOIN_DELIM_OPTIONS
} }
] ]
}, },
@ -2440,7 +2440,7 @@ const OperationConfig = {
{ {
name: "Invert condition", name: "Invert condition",
type: "boolean", type: "boolean",
value: SeqUtils.SORT_REVERSE value: false
}, },
] ]
}, },

View File

@ -65,12 +65,28 @@ const StrUtils = {
* @constant * @constant
* @default * @default
*/ */
SPLIT_DELIM: ",", SPLIT_DELIM_OPTIONS: [
{name: "Comma", value: ","},
{name: "Space", value: " "},
{name: "Line feed", value: "\\n"},
{name: "CRLF", value: "\\r\\n"},
{name: "Semi-colon", value: ";"},
{name: "Colon", value: ":"},
{name: "Nothing (separate chars)", value: ""}
],
/** /**
* @constant * @constant
* @default * @default
*/ */
DELIMITER_OPTIONS: ["Line feed", "CRLF", "Space", "Comma", "Semi-colon", "Colon", "Nothing (separate chars)"], JOIN_DELIM_OPTIONS: [
{name: "Line feed", value: "\\n"},
{name: "CRLF", value: "\\r\\n"},
{name: "Space", value: " "},
{name: "Comma", value: ","},
{name: "Semi-colon", value: ";"},
{name: "Colon", value: ":"},
{name: "Nothing (join chars)", value: ""}
],
/** /**
* Split operation. * Split operation.
@ -80,14 +96,20 @@ const StrUtils = {
* @returns {string} * @returns {string}
*/ */
runSplit: function(input, args) { runSplit: function(input, args) {
let splitDelim = args[0] || StrUtils.SPLIT_DELIM, let splitDelim = args[0],
joinDelim = Utils.charRep[args[1]], joinDelim = args[1],
sections = input.split(splitDelim); sections = input.split(splitDelim);
return sections.join(joinDelim); return sections.join(joinDelim);
}, },
/**
* @constant
* @default
*/
DELIMITER_OPTIONS: ["Line feed", "CRLF", "Space", "Comma", "Semi-colon", "Colon", "Nothing (separate chars)"],
/** /**
* Filter operation. * Filter operation.
* *

View File

@ -443,6 +443,7 @@ App.prototype.getRecipeConfig = function() {
/** /**
* Given a recipe configuration, sets the recipe to that configuration. * Given a recipe configuration, sets the recipe to that configuration.
* *
* @fires Manager#statechange
* @param {Object[]} recipeConfig - The recipe configuration * @param {Object[]} recipeConfig - The recipe configuration
*/ */
App.prototype.setRecipeConfig = function(recipeConfig) { App.prototype.setRecipeConfig = function(recipeConfig) {
@ -487,6 +488,7 @@ App.prototype.setRecipeConfig = function(recipeConfig) {
// Unpause auto bake // Unpause auto bake
this.autoBakePause = false; this.autoBakePause = false;
window.disptchEent(this.manager.statechange);
}; };

View File

@ -64,6 +64,7 @@ InputWaiter.prototype.set = function(input) {
this.setInputInfo(input.size, null); this.setInputInfo(input.size, null);
} else { } else {
inputText.value = input; inputText.value = input;
this.closeFile();
window.dispatchEvent(this.manager.statechange); window.dispatchEvent(this.manager.statechange);
const lines = input.length < (this.app.options.ioDisplayThreshold * 1024) ? const lines = input.length < (this.app.options.ioDisplayThreshold * 1024) ?
input.count("\n") + 1 : null; input.count("\n") + 1 : null;

View File

@ -167,7 +167,8 @@ OperationsWaiter.prototype.opListCreate = function(e) {
OperationsWaiter.prototype.enableOpsListPopovers = function(el) { OperationsWaiter.prototype.enableOpsListPopovers = function(el) {
$(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]") $(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]")
.popover({trigger: "manual"}) .popover({trigger: "manual"})
.on("mouseenter", function() { .on("mouseenter", function(e) {
if (e.buttons > 0) return; // Mouse button held down - likely dragging an opertion
const _this = this; const _this = this;
$(this).popover("show"); $(this).popover("show");
$(".popover").on("mouseleave", function () { $(".popover").on("mouseleave", function () {
@ -178,7 +179,7 @@ OperationsWaiter.prototype.enableOpsListPopovers = function(el) {
setTimeout(function() { setTimeout(function() {
// Determine if the popover associated with this element is being hovered over // Determine if the popover associated with this element is being hovered over
if ($(_this).data("bs.popover") && if ($(_this).data("bs.popover") &&
!$(_this).data("bs.popover").$tip.is(":hover")) { ($(_this).data("bs.popover").$tip && !$(_this).data("bs.popover").$tip.is(":hover"))) {
$(_this).popover("hide"); $(_this).popover("hide");
} }
}, 50); }, 50);