mirror of
https://github.com/gchq/CyberChef.git
synced 2026-02-22 01:31:43 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d52c49c31 | ||
|
|
d53da4cfb5 | ||
|
|
76204f5f47 | ||
|
|
b68adbd9a8 | ||
|
|
951b168f3a | ||
|
|
53d89af459 | ||
|
|
4f844ea837 | ||
|
|
59a36e77bd | ||
|
|
61d8d4473c | ||
|
|
508a371175 | ||
|
|
b010fd88e8 | ||
|
|
66a93b81c6 | ||
|
|
5b03a84be8 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cyberchef",
|
||||
"version": "5.3.0",
|
||||
"version": "5.3.3",
|
||||
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
||||
"author": "n1474335 <n1474335@gmail.com>",
|
||||
"homepage": "https://gchq.github.io/CyberChef",
|
||||
|
||||
@@ -1401,6 +1401,11 @@ const OperationConfig = {
|
||||
type: "number",
|
||||
value: Cipher.KDF_ITERATIONS
|
||||
},
|
||||
{
|
||||
name: "Hashing function",
|
||||
type: "option",
|
||||
value: Cipher.HASHERS
|
||||
},
|
||||
{
|
||||
name: "Salt (hex)",
|
||||
type: "string",
|
||||
@@ -1434,6 +1439,11 @@ const OperationConfig = {
|
||||
type: "number",
|
||||
value: Cipher.KDF_ITERATIONS
|
||||
},
|
||||
{
|
||||
name: "Hashing function",
|
||||
type: "option",
|
||||
value: Cipher.HASHERS
|
||||
},
|
||||
{
|
||||
name: "Salt (hex)",
|
||||
type: "string",
|
||||
|
||||
@@ -309,6 +309,11 @@ const Cipher = {
|
||||
* @default
|
||||
*/
|
||||
KDF_ITERATIONS: 1,
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
HASHERS: ["MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "RIPEMD160"],
|
||||
|
||||
/**
|
||||
* Derive PBKDF2 key operation.
|
||||
@@ -320,11 +325,16 @@ const Cipher = {
|
||||
runPbkdf2: function (input, args) {
|
||||
let keySize = args[0] / 32,
|
||||
iterations = args[1],
|
||||
salt = CryptoJS.enc.Hex.parse(args[2] || ""),
|
||||
inputFormat = args[3],
|
||||
outputFormat = args[4],
|
||||
hasher = args[2],
|
||||
salt = CryptoJS.enc.Hex.parse(args[3] || ""),
|
||||
inputFormat = args[4],
|
||||
outputFormat = args[5],
|
||||
passphrase = Utils.format[inputFormat].parse(input),
|
||||
key = CryptoJS.PBKDF2(passphrase, salt, { keySize: keySize, iterations: iterations });
|
||||
key = CryptoJS.PBKDF2(passphrase, salt, {
|
||||
keySize: keySize,
|
||||
hasher: CryptoJS.algo[hasher],
|
||||
iterations: iterations,
|
||||
});
|
||||
|
||||
return key.toString(Utils.format[outputFormat]);
|
||||
},
|
||||
@@ -340,11 +350,16 @@ const Cipher = {
|
||||
runEvpkdf: function (input, args) {
|
||||
let keySize = args[0] / 32,
|
||||
iterations = args[1],
|
||||
salt = CryptoJS.enc.Hex.parse(args[2] || ""),
|
||||
inputFormat = args[3],
|
||||
outputFormat = args[4],
|
||||
hasher = args[2],
|
||||
salt = CryptoJS.enc.Hex.parse(args[3] || ""),
|
||||
inputFormat = args[4],
|
||||
outputFormat = args[5],
|
||||
passphrase = Utils.format[inputFormat].parse(input),
|
||||
key = CryptoJS.EvpKDF(passphrase, salt, { keySize: keySize, iterations: iterations });
|
||||
key = CryptoJS.EvpKDF(passphrase, salt, {
|
||||
keySize: keySize,
|
||||
hasher: CryptoJS.algo[hasher],
|
||||
iterations: iterations,
|
||||
});
|
||||
|
||||
return key.toString(Utils.format[outputFormat]);
|
||||
},
|
||||
|
||||
@@ -88,17 +88,12 @@ const Entropy = {
|
||||
runFreqDistrib: function (input, args) {
|
||||
if (!input.length) return "No data";
|
||||
|
||||
let distrib = new Array(256),
|
||||
let distrib = new Array(256).fill(0),
|
||||
percentages = new Array(256),
|
||||
len = input.length,
|
||||
showZeroes = args[0],
|
||||
i;
|
||||
|
||||
// Initialise distrib to 0
|
||||
for (i = 0; i < 256; i++) {
|
||||
distrib[i] = 0;
|
||||
}
|
||||
|
||||
// Count bytes
|
||||
for (i = 0; i < len; i++) {
|
||||
distrib[input[i]]++;
|
||||
|
||||
@@ -713,13 +713,9 @@ const IP = {
|
||||
ip2 = IP._strToIpv6(range[14]);
|
||||
|
||||
let t = "",
|
||||
total = new Array(128),
|
||||
total = new Array(128).fill(),
|
||||
i;
|
||||
|
||||
// Initialise total array to "0"
|
||||
for (i = 0; i < 128; i++)
|
||||
total[i] = "0";
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
t = (ip2[i] - ip1[i]).toString(2);
|
||||
if (t !== "0") {
|
||||
|
||||
@@ -124,10 +124,17 @@ const PublicKey = {
|
||||
}
|
||||
|
||||
// Signature fields
|
||||
if (r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA
|
||||
let breakoutSig = false;
|
||||
try {
|
||||
breakoutSig = r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0;
|
||||
} catch (err) {
|
||||
// Error processing signature, output without further breakout
|
||||
}
|
||||
|
||||
if (breakoutSig) { // DSA or ECDSA
|
||||
sigStr = " r: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
|
||||
" s: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
|
||||
} else { // RSA
|
||||
} else { // RSA or unknown
|
||||
sigStr = " Signature: " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ const StrUtils = {
|
||||
runOffsetChecker: function(input, args) {
|
||||
let sampleDelim = args[0],
|
||||
samples = input.split(sampleDelim),
|
||||
outputs = [],
|
||||
outputs = new Array(samples.length),
|
||||
i = 0,
|
||||
s = 0,
|
||||
match = false,
|
||||
@@ -397,9 +397,7 @@ const StrUtils = {
|
||||
}
|
||||
|
||||
// Initialise output strings
|
||||
for (s = 0; s < samples.length; s++) {
|
||||
outputs[s] = "";
|
||||
}
|
||||
outputs.fill("", 0, samples.length);
|
||||
|
||||
// Loop through each character in the first sample
|
||||
for (i = 0; i < samples[0].length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user