mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Merged upstream master
This commit is contained in:
commit
559e32a16a
10 changed files with 70 additions and 169 deletions
|
@ -34,6 +34,7 @@ const Base64 = {
|
|||
{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: "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"},
|
||||
],
|
||||
|
||||
/**
|
||||
|
@ -105,7 +106,7 @@ const Base64 = {
|
|||
enc3 = (chr2 >> 1) & 31;
|
||||
enc4 = ((chr2 & 1) << 4) | (chr3 >> 4);
|
||||
enc5 = ((chr3 & 15) << 1) | (chr4 >> 7);
|
||||
enc6 = (chr4 >> 2) & 63;
|
||||
enc6 = (chr4 >> 2) & 31;
|
||||
enc7 = ((chr4 & 3) << 3) | (chr5 >> 5);
|
||||
enc8 = chr5 & 31;
|
||||
|
||||
|
|
|
@ -327,9 +327,8 @@ const Compress = {
|
|||
files = [];
|
||||
|
||||
filenames.forEach(function(fileName) {
|
||||
var contents = unzip.decompress(fileName);
|
||||
|
||||
contents = Utils.byteArrayToUtf8(contents);
|
||||
var bytes = unzip.decompress(fileName);
|
||||
var contents = Utils.byteArrayToUtf8(bytes);
|
||||
|
||||
var file = {
|
||||
fileName: fileName,
|
||||
|
@ -338,6 +337,7 @@ const Compress = {
|
|||
|
||||
var isDir = contents.length === 0 && fileName.endsWith("/");
|
||||
if (!isDir) {
|
||||
file.bytes = bytes;
|
||||
file.contents = contents;
|
||||
}
|
||||
|
||||
|
@ -495,6 +495,13 @@ const Compress = {
|
|||
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) {
|
||||
var result = "";
|
||||
for (var i = this.position; i < this.position + numBytes; i++) {
|
||||
|
@ -553,11 +560,9 @@ const Compress = {
|
|||
endPosition += 512 - (file.size % 512);
|
||||
}
|
||||
|
||||
file.contents = "";
|
||||
|
||||
while (stream.position < endPosition) {
|
||||
file.contents += stream.readString(512);
|
||||
}
|
||||
file.bytes = stream.getBytes(file.size);
|
||||
file.contents = Utils.byteArrayToUtf8(file.bytes);
|
||||
stream.position = endPosition;
|
||||
} else if (file.type === "5") {
|
||||
// Directory
|
||||
files.push(file);
|
||||
|
|
|
@ -20,8 +20,8 @@ const HTTP = {
|
|||
* @returns {string}
|
||||
*/
|
||||
runStripHeaders: function(input, args) {
|
||||
var headerEnd = input.indexOf("\r\n\r\n") +
|
||||
(headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
|
||||
var headerEnd = input.indexOf("\r\n\r\n");
|
||||
headerEnd = (headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
|
||||
|
||||
return (headerEnd < 2) ? input : input.slice(headerEnd, input.length);
|
||||
},
|
||||
|
|
|
@ -212,6 +212,22 @@ const IP = {
|
|||
output += "\nThis is a reserved multicast address.";
|
||||
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 {
|
||||
return "Invalid IPv6 address";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue