Merge branch 'v9' of github.com:gchq/CyberChef into node-lib

This commit is contained in:
d98762625 2019-07-05 13:10:44 +01:00
commit 0de89f3145
28 changed files with 386 additions and 303 deletions

View file

@ -77,7 +77,7 @@ class GroupIPAddresses extends Operation {
ip = strToIpv4(match[1]) >>> 0;
network = ip & ipv4Mask;
if (ipv4Networks.hasOwnProperty(network)) {
if (network in ipv4Networks) {
ipv4Networks[network].push(ip);
} else {
ipv4Networks[network] = [ip];
@ -93,7 +93,7 @@ class GroupIPAddresses extends Operation {
networkStr = ipv6ToStr(network, true);
if (ipv6Networks.hasOwnProperty(networkStr)) {
if (networkStr in ipv6Networks) {
ipv6Networks[networkStr].push(ip);
} else {
ipv6Networks[networkStr] = [ip];

View file

@ -50,7 +50,7 @@ class JWTVerify extends Operation {
"none"
]});
if (verified.hasOwnProperty("name") && verified.name === "JsonWebTokenError") {
if (Object.prototype.hasOwnProperty.call(verified, "name") && verified.name === "JsonWebTokenError") {
throw new OperationError(verified.message);
}

View file

@ -96,7 +96,7 @@ class ParseColourCode extends Operation {
cmyk = "cmyk(" + c + ", " + m + ", " + y + ", " + k + ")";
// Generate output
return `<div id="colorpicker" style="display: inline-block"></div>
return `<div id="colorpicker" style="white-space: normal;"></div>
Hex: ${hex}
RGB: ${rgb}
RGBA: ${rgba}
@ -109,12 +109,12 @@ CMYK: ${cmyk}
color: '${rgba}',
container: true,
inline: true,
}).on('changeColor', function(e) {
var color = e.color.toRGB();
document.getElementById('input-text').value = 'rgba(' +
color.r + ', ' + color.g + ', ' + color.b + ', ' + color.a + ')';
useAlpha: true
}).on('colorpickerChange', function(e) {
var color = e.color.string('rgba');
document.getElementById('input-text').value = color;
window.app.autoBake();
}).children(".colorpicker").removeClass('dropdown-menu');
});
</script>`;
}

View file

@ -102,7 +102,7 @@ class Register extends Operation {
args = args.map(arg => {
if (typeof arg !== "string" && typeof arg !== "object") return arg;
if (typeof arg === "object" && arg.hasOwnProperty("string")) {
if (typeof arg === "object" && Object.prototype.hasOwnProperty.call(arg, "string")) {
arg.string = replaceRegister(arg.string);
return arg;
}

View file

@ -59,13 +59,13 @@ class ToHTMLEntity extends Operation {
} else if (convertAll) {
output += byteToEntity[charcodes[i]] || "&#" + charcodes[i] + ";";
} else if (numeric) {
if (charcodes[i] > 255 || byteToEntity.hasOwnProperty(charcodes[i])) {
if (charcodes[i] > 255 || charcodes[i] in byteToEntity) {
output += "&#" + charcodes[i] + ";";
} else {
output += Utils.chr(charcodes[i]);
}
} else if (hexa) {
if (charcodes[i] > 255 || byteToEntity.hasOwnProperty(charcodes[i])) {
if (charcodes[i] > 255 || charcodes[i] in byteToEntity) {
output += "&#x" + Utils.hex(charcodes[i]) + ";";
} else {
output += Utils.chr(charcodes[i]);