cyberchef 9.38.7 → 9.39.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/CHANGELOG.md CHANGED
@@ -13,6 +13,9 @@ All major and minor version changes will be documented in this file. Details of
13
13
 
14
14
  ## Details
15
15
 
16
+ ### [9.39.0] - 2022-06-09
17
+ - Added 'ELF Info' operation [@n1073645] | [#1364]
18
+
16
19
  ### [9.38.0] - 2022-05-30
17
20
  - Added 'Parse TCP' operation [@n1474335] | [a895d1d]
18
21
 
@@ -291,6 +294,7 @@ All major and minor version changes will be documented in this file. Details of
291
294
 
292
295
 
293
296
 
297
+ [9.39.0]: https://github.com/gchq/CyberChef/releases/tag/v9.39.0
294
298
  [9.38.0]: https://github.com/gchq/CyberChef/releases/tag/v9.38.0
295
299
  [9.37.0]: https://github.com/gchq/CyberChef/releases/tag/v9.37.0
296
300
  [9.36.0]: https://github.com/gchq/CyberChef/releases/tag/v9.36.0
@@ -508,3 +512,4 @@ All major and minor version changes will be documented in this file. Details of
508
512
  [#1244]: https://github.com/gchq/CyberChef/pull/1244
509
513
  [#1313]: https://github.com/gchq/CyberChef/pull/1313
510
514
  [#1326]: https://github.com/gchq/CyberChef/pull/1326
515
+ [#1364]: https://github.com/gchq/CyberChef/pull/1364
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberchef",
3
- "version": "9.38.7",
3
+ "version": "9.39.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",
@@ -122,6 +122,7 @@
122
122
  "js-crc": "^0.2.0",
123
123
  "js-sha3": "^0.8.0",
124
124
  "jsesc": "^3.0.2",
125
+ "json5": "^2.2.1",
125
126
  "jsonpath": "^1.1.1",
126
127
  "jsonwebtoken": "^8.5.1",
127
128
  "jsqr": "^1.4.0",
@@ -413,7 +413,8 @@
413
413
  "Extract RGBA",
414
414
  "View Bit Plane",
415
415
  "Randomize Colour Palette",
416
- "Extract LSB"
416
+ "Extract LSB",
417
+ "ELF Info"
417
418
  ]
418
419
  },
419
420
  {
@@ -4141,6 +4141,16 @@
4141
4141
  }
4142
4142
  ]
4143
4143
  },
4144
+ "ELF Info": {
4145
+ "module": "Default",
4146
+ "description": "Implements readelf-like functionality. This operation will extract the ELF Header, Program Headers, Section Headers and Symbol Table for an ELF file.",
4147
+ "infoURL": "https://www.wikipedia.org/wiki/Executable_and_Linkable_Format",
4148
+ "inputType": "ArrayBuffer",
4149
+ "outputType": "string",
4150
+ "flowControl": false,
4151
+ "manualBake": false,
4152
+ "args": []
4153
+ },
4144
4154
  "Encode NetBIOS Name": {
4145
4155
  "module": "Default",
4146
4156
  "description": "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.<br><br>There are two levels of encoding. The first level maps a NetBIOS name into a domain system name. The second level maps the domain system name into the 'compressed' representation required for interaction with the domain name system.<br><br>This operation carries out the first level of encoding. See RFC 1001 for full details.",
@@ -7637,10 +7647,10 @@
7637
7647
  },
7638
7648
  "JSON Beautify": {
7639
7649
  "module": "Code",
7640
- "description": "Indents and prettifies JavaScript Object Notation (JSON) code.",
7650
+ "description": "Indents and pretty prints JavaScript Object Notation (JSON) code.<br><br>Tags: json viewer, prettify, syntax highlighting",
7641
7651
  "infoURL": null,
7642
7652
  "inputType": "string",
7643
- "outputType": "string",
7653
+ "outputType": "html",
7644
7654
  "flowControl": false,
7645
7655
  "manualBake": false,
7646
7656
  "args": [
@@ -7653,6 +7663,11 @@
7653
7663
  "name": "Sort Object Keys",
7654
7664
  "type": "boolean",
7655
7665
  "value": false
7666
+ },
7667
+ {
7668
+ "name": "Formatted",
7669
+ "type": "boolean",
7670
+ "value": true
7656
7671
  }
7657
7672
  ]
7658
7673
  },
@@ -8580,7 +8595,7 @@
8580
8595
  "PEM to Hex": {
8581
8596
  "module": "Default",
8582
8597
  "description": "Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",
8583
- "infoURL": "https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail#Format",
8598
+ "infoURL": "https://wikipedia.org/wiki/Privacy-Enhanced_Mail#Format",
8584
8599
  "inputType": "string",
8585
8600
  "outputType": "string",
8586
8601
  "flowControl": false,
@@ -33,6 +33,7 @@ import DefangURL from "../../operations/DefangURL.mjs";
33
33
  import DetectFileType from "../../operations/DetectFileType.mjs";
34
34
  import Divide from "../../operations/Divide.mjs";
35
35
  import DropBytes from "../../operations/DropBytes.mjs";
36
+ import ELFInfo from "../../operations/ELFInfo.mjs";
36
37
  import EncodeNetBIOSName from "../../operations/EncodeNetBIOSName.mjs";
37
38
  import EscapeString from "../../operations/EscapeString.mjs";
38
39
  import EscapeUnicodeCharacters from "../../operations/EscapeUnicodeCharacters.mjs";
@@ -201,6 +202,7 @@ OpModules.Default = {
201
202
  "Detect File Type": DetectFileType,
202
203
  "Divide": Divide,
203
204
  "Drop bytes": DropBytes,
205
+ "ELF Info": ELFInfo,
204
206
  "Encode NetBIOS Name": EncodeNetBIOSName,
205
207
  "Escape string": EscapeString,
206
208
  "Escape Unicode Characters": EscapeUnicodeCharacters,
@@ -131,7 +131,7 @@ const getFeature = function() {
131
131
 
132
132
  // PR IDs
133
133
  prIDs.forEach(prID => {
134
- changelogData = changelogData.replace(/(\n\[#[^\]]+\]: https:\/\/github.com\/gchq\/CyberChef\/pull\/[^\n]+\n)\n/, "$1" + prID + "\n\n");
134
+ changelogData = changelogData.replace(/(\n\[#[^\]]+\]: https:\/\/github.com\/gchq\/CyberChef\/pull\/[^\n]+\n)\n*$/, "$1" + prID + "\n\n");
135
135
  });
136
136
 
137
137
  fs.writeFileSync(path.join(process.cwd(), "CHANGELOG.md"), changelogData);
@@ -9,35 +9,25 @@
9
9
  import { toHex, fromHex } from "./Hex.mjs";
10
10
 
11
11
  /**
12
- * Formats Distinguished Name (DN) strings.
12
+ * Formats Distinguished Name (DN) objects to strings.
13
13
  *
14
- * @param {string} dnStr
14
+ * @param {Object} dnObj
15
15
  * @param {number} indent
16
16
  * @returns {string}
17
17
  */
18
- export function formatDnStr(dnStr, indent) {
19
- const fields = dnStr.substr(1).replace(/([^\\])\//g, "$1$1/").split(/[^\\]\//);
20
- let output = "",
21
- maxKeyLen = 0,
22
- key,
23
- value,
24
- i,
25
- str;
26
-
27
- for (i = 0; i < fields.length; i++) {
28
- if (!fields[i].length) continue;
29
-
30
- key = fields[i].split("=")[0];
18
+ export function formatDnObj(dnObj, indent) {
19
+ let output = "";
31
20
 
32
- maxKeyLen = key.length > maxKeyLen ? key.length : maxKeyLen;
33
- }
21
+ const maxKeyLen = dnObj.array.reduce((max, item) => {
22
+ return item[0].type.length > max ? item[0].type.length : max;
23
+ }, 0);
34
24
 
35
- for (i = 0; i < fields.length; i++) {
36
- if (!fields[i].length) continue;
25
+ for (let i = 0; i < dnObj.array.length; i++) {
26
+ if (!dnObj.array[i].length) continue;
37
27
 
38
- key = fields[i].split("=")[0];
39
- value = fields[i].split("=")[1];
40
- str = key.padEnd(maxKeyLen, " ") + " = " + value + "\n";
28
+ const key = dnObj.array[i][0].type;
29
+ const value = dnObj.array[i][0].value;
30
+ const str = `${key.padEnd(maxKeyLen, " ")} = ${value}\n`;
41
31
 
42
32
  output += str.padStart(indent + str.length, " ");
43
33
  }
@@ -48,12 +48,14 @@ export default class Stream {
48
48
  * Interpret the following bytes as a string, stopping at the next null byte or
49
49
  * the supplied limit.
50
50
  *
51
- * @param {number} numBytes
51
+ * @param {number} [numBytes=-1]
52
52
  * @returns {string}
53
53
  */
54
- readString(numBytes) {
54
+ readString(numBytes=-1) {
55
55
  if (this.position > this.length) return undefined;
56
56
 
57
+ if (numBytes === -1) numBytes = this.length - this.position;
58
+
57
59
  let result = "";
58
60
  for (let i = this.position; i < this.position + numBytes; i++) {
59
61
  const currentByte = this.bytes[i];