mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 15:07:11 -04:00
Merging with upstream master
This commit is contained in:
commit
b5078599dc
11 changed files with 102 additions and 67 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -151,6 +151,10 @@ var FlowControl = {
|
||||||
jumpNum = ings[0],
|
jumpNum = ings[0],
|
||||||
maxJumps = ings[1];
|
maxJumps = ings[1];
|
||||||
|
|
||||||
|
if (jumpNum < 0) {
|
||||||
|
jumpNum--;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.numJumps >= maxJumps) {
|
if (state.numJumps >= maxJumps) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +182,10 @@ var FlowControl = {
|
||||||
jumpNum = ings[1],
|
jumpNum = ings[1],
|
||||||
maxJumps = ings[2];
|
maxJumps = ings[2];
|
||||||
|
|
||||||
|
if (jumpNum < 0) {
|
||||||
|
jumpNum--;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.numJumps >= maxJumps) {
|
if (state.numJumps >= maxJumps) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1028,20 +1028,37 @@ var Utils = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var formatFile = function(file, i) {
|
var formatFile = function(file, i) {
|
||||||
|
var blob = new Blob(
|
||||||
|
[new Uint8Array(file.bytes)],
|
||||||
|
{type: "octet/stream"}
|
||||||
|
);
|
||||||
|
var blobUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
var downloadAnchorElem = "<a href='" + blobUrl + "' " +
|
||||||
|
"title='Download " + Utils.escapeHtml(file.fileName) + "' " +
|
||||||
|
"download='" + Utils.escapeHtml(file.fileName) + "'>\u21B4</a>";
|
||||||
|
|
||||||
|
var expandFileContentsElem = "<a href='#collapse" + i + "' " +
|
||||||
|
"class='collapsed' " +
|
||||||
|
"data-toggle='collapse' " +
|
||||||
|
"aria-expanded='true' " +
|
||||||
|
"aria-controls='collapse" + i + "' " +
|
||||||
|
"title=\"Show/hide contents of '" + Utils.escapeHtml(file.fileName) + "'\">🔍</a>";
|
||||||
|
|
||||||
var html = "<div class='panel panel-default'>" +
|
var html = "<div class='panel panel-default'>" +
|
||||||
"<div class='panel-heading' role='tab' id='heading" + i + "'>" +
|
"<div class='panel-heading' role='tab' id='heading" + i + "'>" +
|
||||||
"<h4 class='panel-title'>" +
|
"<h4 class='panel-title'>" +
|
||||||
"<a class='collapsed' role='button' data-toggle='collapse' " +
|
"<div>" +
|
||||||
"href='#collapse" + i + "' " +
|
Utils.escapeHtml(file.fileName) +
|
||||||
"aria-expanded='true' aria-controls='collapse" + i +"'>" +
|
" " + expandFileContentsElem +
|
||||||
file.fileName +
|
" " + downloadAnchorElem +
|
||||||
"<span class='pull-right'>" +
|
"<span class='pull-right'>" +
|
||||||
// These are for formatting when stripping HTML
|
// These are for formatting when stripping HTML
|
||||||
"<span style='display: none'>\n</span>" +
|
"<span style='display: none'>\n</span>" +
|
||||||
file.size.toLocaleString() + " bytes" +
|
file.size.toLocaleString() + " bytes" +
|
||||||
"<span style='display: none'>\n</span>" +
|
"<span style='display: none'>\n</span>" +
|
||||||
"</span>" +
|
"</span>" +
|
||||||
"</a>" +
|
"</div>" +
|
||||||
"</h4>" +
|
"</h4>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"<div id='collapse" + i + "' class='panel-collapse collapse' " +
|
"<div id='collapse" + i + "' class='panel-collapse collapse' " +
|
||||||
|
|
|
@ -31,6 +31,7 @@ var Base64 = {
|
||||||
{name: "Xxencoding: +-0-9A-Za-z", value: "+\\-0-9A-Za-z"},
|
{name: "Xxencoding: +-0-9A-Za-z", value: "+\\-0-9A-Za-z"},
|
||||||
{name: "BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r", value: "!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},
|
{name: "BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r", value: "!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},
|
||||||
{name: "ROT13: N-ZA-Mn-za-m0-9+/=", value: "N-ZA-Mn-za-m0-9+/="},
|
{name: "ROT13: N-ZA-Mn-za-m0-9+/=", value: "N-ZA-Mn-za-m0-9+/="},
|
||||||
|
{name: "UNIX crypt: ./0-9A-Za-z", value: "./0-9A-Za-z"},
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -309,9 +309,8 @@ var Compress = {
|
||||||
files = [];
|
files = [];
|
||||||
|
|
||||||
filenames.forEach(function(fileName) {
|
filenames.forEach(function(fileName) {
|
||||||
var contents = unzip.decompress(fileName);
|
var bytes = unzip.decompress(fileName);
|
||||||
|
var contents = Utils.byteArrayToUtf8(bytes);
|
||||||
contents = Utils.byteArrayToUtf8(contents);
|
|
||||||
|
|
||||||
var file = {
|
var file = {
|
||||||
fileName: fileName,
|
fileName: fileName,
|
||||||
|
@ -320,6 +319,7 @@ var Compress = {
|
||||||
|
|
||||||
var isDir = contents.length === 0 && fileName.endsWith("/");
|
var isDir = contents.length === 0 && fileName.endsWith("/");
|
||||||
if (!isDir) {
|
if (!isDir) {
|
||||||
|
file.bytes = bytes;
|
||||||
file.contents = contents;
|
file.contents = contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,6 +477,13 @@ var Compress = {
|
||||||
this.position = 0;
|
this.position = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Stream.prototype.getBytes = function(bytesToGet) {
|
||||||
|
var newPosition = this.position + bytesToGet;
|
||||||
|
var bytes = this.bytes.slice(this.position, newPosition);
|
||||||
|
this.position = newPosition;
|
||||||
|
return bytes;
|
||||||
|
};
|
||||||
|
|
||||||
Stream.prototype.readString = function(numBytes) {
|
Stream.prototype.readString = function(numBytes) {
|
||||||
var result = "";
|
var result = "";
|
||||||
for (var i = this.position; i < this.position + numBytes; i++) {
|
for (var i = this.position; i < this.position + numBytes; i++) {
|
||||||
|
@ -535,11 +542,9 @@ var Compress = {
|
||||||
endPosition += 512 - (file.size % 512);
|
endPosition += 512 - (file.size % 512);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.contents = "";
|
file.bytes = stream.getBytes(file.size);
|
||||||
|
file.contents = Utils.byteArrayToUtf8(file.bytes);
|
||||||
while (stream.position < endPosition) {
|
stream.position = endPosition;
|
||||||
file.contents += stream.readString(512);
|
|
||||||
}
|
|
||||||
} else if (file.type === "5") {
|
} else if (file.type === "5") {
|
||||||
// Directory
|
// Directory
|
||||||
files.push(file);
|
files.push(file);
|
||||||
|
|
|
@ -19,8 +19,8 @@ var HTTP = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runStripHeaders: function(input, args) {
|
runStripHeaders: function(input, args) {
|
||||||
var headerEnd = input.indexOf("\r\n\r\n") +
|
var headerEnd = input.indexOf("\r\n\r\n");
|
||||||
(headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
|
headerEnd = (headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
|
||||||
|
|
||||||
return (headerEnd < 2) ? input : input.slice(headerEnd, input.length);
|
return (headerEnd < 2) ? input : input.slice(headerEnd, input.length);
|
||||||
},
|
},
|
||||||
|
|
|
@ -209,6 +209,22 @@ var IP = {
|
||||||
output += "\nThis is a reserved multicast address.";
|
output += "\nThis is a reserved multicast address.";
|
||||||
output += "\nMulticast addresses range: ff00::/8";
|
output += "\nMulticast addresses range: ff00::/8";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Detect possible EUI-64 addresses
|
||||||
|
if ((ipv6[5] & 0xff === 0xff) && (ipv6[6] >>> 8 === 0xfe)) {
|
||||||
|
output += "\n\nThis IPv6 address contains a modified EUI-64 address, identified by the presence of FF:FE in the 12th and 13th octets.";
|
||||||
|
|
||||||
|
var intIdent = Utils.hex(ipv6[4] >>> 8) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
|
||||||
|
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[5] & 0xff) + ":" +
|
||||||
|
Utils.hex(ipv6[6] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
|
||||||
|
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff),
|
||||||
|
mac = Utils.hex((ipv6[4] >>> 8) ^ 2) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
|
||||||
|
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
|
||||||
|
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff);
|
||||||
|
output += "\nInterface identifier: " + intIdent +
|
||||||
|
"\nMAC address: " + mac;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return "Invalid IPv6 address";
|
return "Invalid IPv6 address";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,21 @@
|
||||||
214 source files
|
214 source files
|
||||||
<<<<<<< HEAD
|
117639 lines
|
||||||
115922 lines
|
4.4M size
|
||||||
4.3M size
|
|
||||||
|
|
||||||
144 JavaScript source files
|
145 JavaScript source files
|
||||||
106730 lines
|
108404 lines
|
||||||
3.8M size
|
3.8M size
|
||||||
=======
|
|
||||||
116142 lines
|
|
||||||
size
|
|
||||||
|
|
||||||
144 JavaScript source files
|
84 third party JavaScript source files
|
||||||
106912 lines
|
87417 lines
|
||||||
4.9M size
|
3.1M size
|
||||||
>>>>>>> 9404f1e0b82fc74a83561a2184ce524f358f375f
|
|
||||||
|
|
||||||
83 third party JavaScript source files
|
|
||||||
86259 lines
|
|
||||||
3.7M size
|
|
||||||
|
|
||||||
61 first party JavaScript source files
|
61 first party JavaScript source files
|
||||||
<<<<<<< HEAD
|
20987 lines
|
||||||
20471 lines
|
780K size
|
||||||
764K size
|
|
||||||
=======
|
|
||||||
20653 lines
|
|
||||||
1.3M size
|
|
||||||
>>>>>>> 9404f1e0b82fc74a83561a2184ce524f358f375f
|
|
||||||
|
|
||||||
uncompressed JavaScript size
|
3.5M uncompressed JavaScript size
|
||||||
compressed JavaScript size
|
1.9M compressed JavaScript size
|
||||||
|
|
||||||
15 categories
|
15 categories
|
||||||
177 operations
|
178 operations
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue