cyberchef 9.50.1 → 9.50.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyberchef",
|
|
3
|
-
"version": "9.50.
|
|
3
|
+
"version": "9.50.3",
|
|
4
4
|
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
|
5
5
|
"author": "n1474335 <n1474335@gmail.com>",
|
|
6
6
|
"homepage": "https://gchq.github.io/CyberChef",
|
|
@@ -11133,9 +11133,11 @@
|
|
|
11133
11133
|
"name": "By",
|
|
11134
11134
|
"type": "option",
|
|
11135
11135
|
"value": [
|
|
11136
|
+
"Byte",
|
|
11136
11137
|
"Character",
|
|
11137
11138
|
"Line"
|
|
11138
|
-
]
|
|
11139
|
+
],
|
|
11140
|
+
"defaultIndex": 1
|
|
11139
11141
|
}
|
|
11140
11142
|
]
|
|
11141
11143
|
},
|
package/src/core/lib/Hex.mjs
CHANGED
|
@@ -105,13 +105,17 @@ export function fromHex(data, delim="Auto", byteLen=2) {
|
|
|
105
105
|
throw new OperationError("Byte length must be a positive integer");
|
|
106
106
|
|
|
107
107
|
if (delim !== "None") {
|
|
108
|
-
const delimRegex = delim === "Auto" ? /[^a-f\d]|
|
|
109
|
-
data = data.
|
|
108
|
+
const delimRegex = delim === "Auto" ? /[^a-f\d]|0x/gi : Utils.regexRep(delim);
|
|
109
|
+
data = data.split(delimRegex);
|
|
110
|
+
} else {
|
|
111
|
+
data = [data];
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
const output = [];
|
|
113
|
-
for (let i = 0; i < data.length; i
|
|
114
|
-
|
|
115
|
+
for (let i = 0; i < data.length; i++) {
|
|
116
|
+
for (let j = 0; j < data[i].length; j += byteLen) {
|
|
117
|
+
output.push(parseInt(data[i].substr(j, byteLen), 16));
|
|
118
|
+
}
|
|
115
119
|
}
|
|
116
120
|
return output;
|
|
117
121
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import Operation from "../Operation.mjs";
|
|
8
|
+
import Utils from "../Utils.mjs";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Reverse operation
|
|
@@ -26,7 +27,8 @@ class Reverse extends Operation {
|
|
|
26
27
|
{
|
|
27
28
|
"name": "By",
|
|
28
29
|
"type": "option",
|
|
29
|
-
"value": ["Character", "Line"]
|
|
30
|
+
"value": ["Byte", "Character", "Line"],
|
|
31
|
+
"defaultIndex": 1
|
|
30
32
|
}
|
|
31
33
|
];
|
|
32
34
|
}
|
|
@@ -57,6 +59,24 @@ class Reverse extends Operation {
|
|
|
57
59
|
result.push(0x0a);
|
|
58
60
|
}
|
|
59
61
|
return result.slice(0, input.length);
|
|
62
|
+
} else if (args[0] === "Character") {
|
|
63
|
+
const inputString = Utils.byteArrayToUtf8(input);
|
|
64
|
+
let result = "";
|
|
65
|
+
for (let i = inputString.length - 1; i >= 0; i--) {
|
|
66
|
+
const c = inputString.charCodeAt(i);
|
|
67
|
+
if (i > 0 && 0xdc00 <= c && c <= 0xdfff) {
|
|
68
|
+
const c2 = inputString.charCodeAt(i - 1);
|
|
69
|
+
if (0xd800 <= c2 && c2 <= 0xdbff) {
|
|
70
|
+
// surrogates
|
|
71
|
+
result += inputString.charAt(i - 1);
|
|
72
|
+
result += inputString.charAt(i);
|
|
73
|
+
i--;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
result += inputString.charAt(i);
|
|
78
|
+
}
|
|
79
|
+
return Utils.strToUtf8ByteArray(result);
|
|
60
80
|
} else {
|
|
61
81
|
return input.reverse();
|
|
62
82
|
}
|
|
@@ -45,10 +45,10 @@ TestRegister.addApiTests([
|
|
|
45
45
|
const result = chef.ADD("sample input", {
|
|
46
46
|
key: {
|
|
47
47
|
string: "some key",
|
|
48
|
-
option: "
|
|
48
|
+
option: "utf8"
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
assert.equal(result.toString(), "
|
|
51
|
+
assert.equal(result.toString(), "\xe6\xd0\xda\xd5\x8c\xd0\x85\xe2\xe1\xdf\xe2\xd9");
|
|
52
52
|
}),
|
|
53
53
|
|
|
54
54
|
|
|
@@ -121,10 +121,10 @@ Tiger-128`;
|
|
|
121
121
|
const result = chef.AND("Scot-free", {
|
|
122
122
|
key: {
|
|
123
123
|
string: "Raining Cats and Dogs",
|
|
124
|
-
option: "
|
|
124
|
+
option: "utf8",
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
assert.strictEqual(result.toString(), "
|
|
127
|
+
assert.strictEqual(result.toString(), "Raid)fb A");
|
|
128
128
|
}),
|
|
129
129
|
|
|
130
130
|
it("atBash Cipher", () => {
|
|
@@ -371,10 +371,10 @@ color: white;
|
|
|
371
371
|
},
|
|
372
372
|
salt: {
|
|
373
373
|
string: "Market",
|
|
374
|
-
option: "
|
|
374
|
+
option: "utf8",
|
|
375
375
|
},
|
|
376
376
|
});
|
|
377
|
-
assert.strictEqual(result.toString(), "
|
|
377
|
+
assert.strictEqual(result.toString(), "4930d5d200e80f18c96b5550d13c6af8");
|
|
378
378
|
}),
|
|
379
379
|
|
|
380
380
|
it("Derive PBKDF2 Key", () => {
|