cyberchef 9.39.6 → 9.40.0
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 +1 -1
- package/src/core/config/Categories.json +1 -0
- package/src/core/config/OperationConfig.json +11 -1
- package/src/core/config/modules/Default.mjs +2 -0
- package/src/core/operations/PLISTViewer.mjs +133 -0
- package/src/core/operations/Subsection.mjs +1 -1
- package/src/core/operations/index.mjs +2 -0
- package/src/node/index.mjs +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyberchef",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.40.0",
|
|
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",
|
|
@@ -8770,6 +8770,16 @@
|
|
|
8770
8770
|
}
|
|
8771
8771
|
]
|
|
8772
8772
|
},
|
|
8773
|
+
"P-list Viewer": {
|
|
8774
|
+
"module": "Default",
|
|
8775
|
+
"description": "In the macOS, iOS, NeXTSTEP, and GNUstep programming frameworks, property list files are files that store serialized objects. Property list files use the filename extension .plist, and thus are often referred to as p-list files.<br><br>This operation displays plist files in a human readable format.",
|
|
8776
|
+
"infoURL": "https://wikipedia.org/wiki/Property_list",
|
|
8777
|
+
"inputType": "string",
|
|
8778
|
+
"outputType": "string",
|
|
8779
|
+
"flowControl": false,
|
|
8780
|
+
"manualBake": false,
|
|
8781
|
+
"args": []
|
|
8782
|
+
},
|
|
8773
8783
|
"Pad lines": {
|
|
8774
8784
|
"module": "Default",
|
|
8775
8785
|
"description": "Add the specified number of the specified character to the beginning or end of each line",
|
|
@@ -12947,7 +12957,7 @@
|
|
|
12947
12957
|
},
|
|
12948
12958
|
"Subsection": {
|
|
12949
12959
|
"module": "Default",
|
|
12950
|
-
"description": "Select a part of the input data using a regular expression (regex), and run all subsequent operations on each match separately.<br><br>You can use up to one capture group, where the recipe will only be run on the data in the capture group. If there's more than one capture group, only the first one will be operated on.",
|
|
12960
|
+
"description": "Select a part of the input data using a regular expression (regex), and run all subsequent operations on each match separately.<br><br>You can use up to one capture group, where the recipe will only be run on the data in the capture group. If there's more than one capture group, only the first one will be operated on.<br><br>Use the Merge operation to reset the effects of subsection.",
|
|
12951
12961
|
"infoURL": "",
|
|
12952
12962
|
"inputType": "string",
|
|
12953
12963
|
"outputType": "string",
|
|
@@ -92,6 +92,7 @@ import OR from "../../operations/OR.mjs";
|
|
|
92
92
|
import OffsetChecker from "../../operations/OffsetChecker.mjs";
|
|
93
93
|
import PEMToHex from "../../operations/PEMToHex.mjs";
|
|
94
94
|
import PHPDeserialize from "../../operations/PHPDeserialize.mjs";
|
|
95
|
+
import PLISTViewer from "../../operations/PLISTViewer.mjs";
|
|
95
96
|
import PadLines from "../../operations/PadLines.mjs";
|
|
96
97
|
import ParseColourCode from "../../operations/ParseColourCode.mjs";
|
|
97
98
|
import ParseDateTime from "../../operations/ParseDateTime.mjs";
|
|
@@ -261,6 +262,7 @@ OpModules.Default = {
|
|
|
261
262
|
"Offset checker": OffsetChecker,
|
|
262
263
|
"PEM to Hex": PEMToHex,
|
|
263
264
|
"PHP Deserialize": PHPDeserialize,
|
|
265
|
+
"P-list Viewer": PLISTViewer,
|
|
264
266
|
"Pad lines": PadLines,
|
|
265
267
|
"Parse colour code": ParseColourCode,
|
|
266
268
|
"Parse DateTime": ParseDateTime,
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author n1073645 [n1073645@gmail.com]
|
|
3
|
+
* @copyright Crown Copyright 2019
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Operation from "../Operation.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* P-list Viewer operation
|
|
11
|
+
*/
|
|
12
|
+
class PlistViewer extends Operation {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* PlistViewer constructor
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
this.name = "P-list Viewer";
|
|
21
|
+
this.module = "Default";
|
|
22
|
+
this.description = "In the macOS, iOS, NeXTSTEP, and GNUstep programming frameworks, property list files are files that store serialized objects. Property list files use the filename extension .plist, and thus are often referred to as p-list files.<br><br>This operation displays plist files in a human readable format.";
|
|
23
|
+
this.infoURL = "https://wikipedia.org/wiki/Property_list";
|
|
24
|
+
this.inputType = "string";
|
|
25
|
+
this.outputType = "string";
|
|
26
|
+
this.args = [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} input
|
|
31
|
+
* @param {Object[]} args
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
run(input, args) {
|
|
35
|
+
|
|
36
|
+
// Regexes are designed to transform the xml format into a more readable string format.
|
|
37
|
+
input = input.slice(input.indexOf("<plist"))
|
|
38
|
+
.replace(/<plist.+>/g, "plist => ")
|
|
39
|
+
.replace(/<dict>/g, "{")
|
|
40
|
+
.replace(/<\/dict>/g, "}")
|
|
41
|
+
.replace(/<array>/g, "[")
|
|
42
|
+
.replace(/<\/array>/g, "]")
|
|
43
|
+
.replace(/<key>.+<\/key>/g, m => `${m.slice(5, m.indexOf(/<\/key>/g)-5)}\t=> `)
|
|
44
|
+
.replace(/<real>.+<\/real>/g, m => `${m.slice(6, m.indexOf(/<\/real>/g)-6)}\n`)
|
|
45
|
+
.replace(/<string>.+<\/string>/g, m => `"${m.slice(8, m.indexOf(/<\/string>/g)-8)}"\n`)
|
|
46
|
+
.replace(/<integer>.+<\/integer>/g, m => `${m.slice(9, m.indexOf(/<\/integer>/g)-9)}\n`)
|
|
47
|
+
.replace(/<false\/>/g, m => "false")
|
|
48
|
+
.replace(/<true\/>/g, m => "true")
|
|
49
|
+
.replace(/<\/plist>/g, "/plist")
|
|
50
|
+
.replace(/<date>.+<\/date>/g, m => `${m.slice(6, m.indexOf(/<\/integer>/g)-6)}`)
|
|
51
|
+
.replace(/<data>(\s|.)+?<\/data>/g, m => `${m.slice(6, m.indexOf(/<\/data>/g)-6)}`)
|
|
52
|
+
.replace(/[ \t\r\f\v]/g, "");
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Depending on the type of brace, it will increment the depth and amount of arrays accordingly.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} elem
|
|
58
|
+
* @param {array} vals
|
|
59
|
+
* @param {number} offset
|
|
60
|
+
*/
|
|
61
|
+
function braces(elem, vals, offset) {
|
|
62
|
+
const temp = vals.indexOf(elem);
|
|
63
|
+
if (temp !== -1) {
|
|
64
|
+
depthCount += offset;
|
|
65
|
+
if (temp === 1)
|
|
66
|
+
arrCount += offset;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let result = "";
|
|
71
|
+
let arrCount = 0;
|
|
72
|
+
let depthCount = 0;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Formats the input after the regex has replaced all of the relevant parts.
|
|
76
|
+
*
|
|
77
|
+
* @param {array} input
|
|
78
|
+
* @param {number} index
|
|
79
|
+
*/
|
|
80
|
+
function printIt(input, index) {
|
|
81
|
+
if (!(input.length))
|
|
82
|
+
return;
|
|
83
|
+
|
|
84
|
+
let temp = "";
|
|
85
|
+
const origArr = arrCount;
|
|
86
|
+
let currElem = input[0];
|
|
87
|
+
|
|
88
|
+
// If the current position points at a larger dynamic structure.
|
|
89
|
+
if (currElem.indexOf("=>") !== -1) {
|
|
90
|
+
|
|
91
|
+
// If the LHS also points at a larger structure (nested plists in a dictionary).
|
|
92
|
+
if (input[1].indexOf("=>") !== -1)
|
|
93
|
+
temp = currElem.slice(0, -2) + " => " + input[1].slice(0, -2) + " =>\n";
|
|
94
|
+
else
|
|
95
|
+
temp = currElem.slice(0, -2) + " => " + input[1] + "\n";
|
|
96
|
+
|
|
97
|
+
input = input.slice(1);
|
|
98
|
+
} else {
|
|
99
|
+
// Controls the tab depth for how many closing braces there have been.
|
|
100
|
+
|
|
101
|
+
braces(currElem, ["}", "]"], -1);
|
|
102
|
+
|
|
103
|
+
// Has to be here since the formatting breaks otherwise.
|
|
104
|
+
temp = currElem + "\n";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
currElem = input[0];
|
|
108
|
+
|
|
109
|
+
// Tab out to the correct distance.
|
|
110
|
+
result += ("\t".repeat(depthCount));
|
|
111
|
+
|
|
112
|
+
// If it is enclosed in an array show index.
|
|
113
|
+
if (arrCount > 0 && currElem !== "]")
|
|
114
|
+
result += index.toString() + " => ";
|
|
115
|
+
|
|
116
|
+
result += temp;
|
|
117
|
+
|
|
118
|
+
// Controls the tab depth for how many opening braces there have been.
|
|
119
|
+
braces(currElem, ["{", "["], 1);
|
|
120
|
+
|
|
121
|
+
// If there has been a new array then reset index.
|
|
122
|
+
if (arrCount > origArr)
|
|
123
|
+
return printIt(input.slice(1), 0);
|
|
124
|
+
return printIt(input.slice(1), ++index);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
input = input.split("\n").filter(e => e !== "");
|
|
128
|
+
printIt(input, 0);
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default PlistViewer;
|
|
@@ -22,7 +22,7 @@ class Subsection extends Operation {
|
|
|
22
22
|
this.name = "Subsection";
|
|
23
23
|
this.flowControl = true;
|
|
24
24
|
this.module = "Default";
|
|
25
|
-
this.description = "Select a part of the input data using a regular expression (regex), and run all subsequent operations on each match separately.<br><br>You can use up to one capture group, where the recipe will only be run on the data in the capture group. If there's more than one capture group, only the first one will be operated on.";
|
|
25
|
+
this.description = "Select a part of the input data using a regular expression (regex), and run all subsequent operations on each match separately.<br><br>You can use up to one capture group, where the recipe will only be run on the data in the capture group. If there's more than one capture group, only the first one will be operated on.<br><br>Use the Merge operation to reset the effects of subsection.";
|
|
26
26
|
this.infoURL = "";
|
|
27
27
|
this.inputType = "string";
|
|
28
28
|
this.outputType = "string";
|
|
@@ -220,6 +220,7 @@ import PGPEncrypt from "./PGPEncrypt.mjs";
|
|
|
220
220
|
import PGPEncryptAndSign from "./PGPEncryptAndSign.mjs";
|
|
221
221
|
import PGPVerify from "./PGPVerify.mjs";
|
|
222
222
|
import PHPDeserialize from "./PHPDeserialize.mjs";
|
|
223
|
+
import PLISTViewer from "./PLISTViewer.mjs";
|
|
223
224
|
import PadLines from "./PadLines.mjs";
|
|
224
225
|
import ParseASN1HexString from "./ParseASN1HexString.mjs";
|
|
225
226
|
import ParseColourCode from "./ParseColourCode.mjs";
|
|
@@ -594,6 +595,7 @@ export {
|
|
|
594
595
|
PGPEncryptAndSign,
|
|
595
596
|
PGPVerify,
|
|
596
597
|
PHPDeserialize,
|
|
598
|
+
PLISTViewer,
|
|
597
599
|
PadLines,
|
|
598
600
|
ParseASN1HexString,
|
|
599
601
|
ParseColourCode,
|
package/src/node/index.mjs
CHANGED
|
@@ -221,6 +221,7 @@ import {
|
|
|
221
221
|
PGPEncryptAndSign as core_PGPEncryptAndSign,
|
|
222
222
|
PGPVerify as core_PGPVerify,
|
|
223
223
|
PHPDeserialize as core_PHPDeserialize,
|
|
224
|
+
PLISTViewer as core_PLISTViewer,
|
|
224
225
|
PadLines as core_PadLines,
|
|
225
226
|
ParseASN1HexString as core_ParseASN1HexString,
|
|
226
227
|
ParseColourCode as core_ParseColourCode,
|
|
@@ -595,6 +596,7 @@ function generateChef() {
|
|
|
595
596
|
"PGPEncryptAndSign": _wrap(core_PGPEncryptAndSign),
|
|
596
597
|
"PGPVerify": _wrap(core_PGPVerify),
|
|
597
598
|
"PHPDeserialize": _wrap(core_PHPDeserialize),
|
|
599
|
+
"PLISTViewer": _wrap(core_PLISTViewer),
|
|
598
600
|
"padLines": _wrap(core_PadLines),
|
|
599
601
|
"parseASN1HexString": _wrap(core_ParseASN1HexString),
|
|
600
602
|
"parseColourCode": _wrap(core_ParseColourCode),
|
|
@@ -986,6 +988,7 @@ const PGPEncrypt = chef.PGPEncrypt;
|
|
|
986
988
|
const PGPEncryptAndSign = chef.PGPEncryptAndSign;
|
|
987
989
|
const PGPVerify = chef.PGPVerify;
|
|
988
990
|
const PHPDeserialize = chef.PHPDeserialize;
|
|
991
|
+
const PLISTViewer = chef.PLISTViewer;
|
|
989
992
|
const padLines = chef.padLines;
|
|
990
993
|
const parseASN1HexString = chef.parseASN1HexString;
|
|
991
994
|
const parseColourCode = chef.parseColourCode;
|
|
@@ -1362,6 +1365,7 @@ const operations = [
|
|
|
1362
1365
|
PGPEncryptAndSign,
|
|
1363
1366
|
PGPVerify,
|
|
1364
1367
|
PHPDeserialize,
|
|
1368
|
+
PLISTViewer,
|
|
1365
1369
|
padLines,
|
|
1366
1370
|
parseASN1HexString,
|
|
1367
1371
|
parseColourCode,
|
|
@@ -1742,6 +1746,7 @@ export {
|
|
|
1742
1746
|
PGPEncryptAndSign,
|
|
1743
1747
|
PGPVerify,
|
|
1744
1748
|
PHPDeserialize,
|
|
1749
|
+
PLISTViewer,
|
|
1745
1750
|
padLines,
|
|
1746
1751
|
parseASN1HexString,
|
|
1747
1752
|
parseColourCode,
|