cyberchef 9.50.9 → 9.50.11
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.11",
|
|
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",
|
|
@@ -13086,7 +13086,8 @@
|
|
|
13086
13086
|
"Alphabetical (case insensitive)",
|
|
13087
13087
|
"IP address",
|
|
13088
13088
|
"Numeric",
|
|
13089
|
-
"Numeric (hexadecimal)"
|
|
13089
|
+
"Numeric (hexadecimal)",
|
|
13090
|
+
"Length"
|
|
13090
13091
|
]
|
|
13091
13092
|
}
|
|
13092
13093
|
]
|
|
@@ -14427,7 +14428,7 @@
|
|
|
14427
14428
|
},
|
|
14428
14429
|
"To Table": {
|
|
14429
14430
|
"module": "Default",
|
|
14430
|
-
"description": "Data can be split on different characters and rendered as an HTML or
|
|
14431
|
+
"description": "Data can be split on different characters and rendered as an HTML, ASCII or Markdown table with an optional header row.<br><br>Supports the CSV (Comma Separated Values) file format by default. Change the cell delimiter argument to <code>\\t</code> to support TSV (Tab Separated Values) or <code>|</code> for PSV (Pipe Separated Values).<br><br>You can enter as many delimiters as you like. Each character will be treat as a separate possible delimiter.",
|
|
14431
14432
|
"infoURL": "https://wikipedia.org/wiki/Comma-separated_values",
|
|
14432
14433
|
"inputType": "string",
|
|
14433
14434
|
"outputType": "html",
|
|
@@ -14454,7 +14455,8 @@
|
|
|
14454
14455
|
"type": "option",
|
|
14455
14456
|
"value": [
|
|
14456
14457
|
"ASCII",
|
|
14457
|
-
"HTML"
|
|
14458
|
+
"HTML",
|
|
14459
|
+
"Markdown"
|
|
14458
14460
|
]
|
|
14459
14461
|
}
|
|
14460
14462
|
]
|
package/src/core/lib/Sort.mjs
CHANGED
|
@@ -103,3 +103,15 @@ export function hexadecimalSort(a, b) {
|
|
|
103
103
|
|
|
104
104
|
return a.localeCompare(b);
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Comparison operation for sorting by length
|
|
109
|
+
*
|
|
110
|
+
* @param {string} a
|
|
111
|
+
* @param {string} b
|
|
112
|
+
* @returns {number}
|
|
113
|
+
*/
|
|
114
|
+
export function lengthSort(a, b) {
|
|
115
|
+
return a.length - b.length;
|
|
116
|
+
}
|
|
117
|
+
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import Operation from "../Operation.mjs";
|
|
8
8
|
import Utils from "../Utils.mjs";
|
|
9
9
|
import {INPUT_DELIM_OPTIONS} from "../lib/Delim.mjs";
|
|
10
|
-
import {caseInsensitiveSort, ipSort, numericSort, hexadecimalSort} from "../lib/Sort.mjs";
|
|
10
|
+
import {caseInsensitiveSort, ipSort, numericSort, hexadecimalSort, lengthSort} from "../lib/Sort.mjs";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Sort operation
|
|
@@ -39,7 +39,7 @@ class Sort extends Operation {
|
|
|
39
39
|
{
|
|
40
40
|
"name": "Order",
|
|
41
41
|
"type": "option",
|
|
42
|
-
"value": ["Alphabetical (case sensitive)", "Alphabetical (case insensitive)", "IP address", "Numeric", "Numeric (hexadecimal)"]
|
|
42
|
+
"value": ["Alphabetical (case sensitive)", "Alphabetical (case insensitive)", "IP address", "Numeric", "Numeric (hexadecimal)", "Length"]
|
|
43
43
|
}
|
|
44
44
|
];
|
|
45
45
|
}
|
|
@@ -65,6 +65,8 @@ class Sort extends Operation {
|
|
|
65
65
|
sorted = sorted.sort(numericSort);
|
|
66
66
|
} else if (order === "Numeric (hexadecimal)") {
|
|
67
67
|
sorted = sorted.sort(hexadecimalSort);
|
|
68
|
+
} else if (order === "Length") {
|
|
69
|
+
sorted = sorted.sort(lengthSort);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
if (sortReverse) sorted.reverse();
|
|
@@ -20,7 +20,7 @@ class ToTable extends Operation {
|
|
|
20
20
|
|
|
21
21
|
this.name = "To Table";
|
|
22
22
|
this.module = "Default";
|
|
23
|
-
this.description = "Data can be split on different characters and rendered as an HTML or
|
|
23
|
+
this.description = "Data can be split on different characters and rendered as an HTML, ASCII or Markdown table with an optional header row.<br><br>Supports the CSV (Comma Separated Values) file format by default. Change the cell delimiter argument to <code>\\t</code> to support TSV (Tab Separated Values) or <code>|</code> for PSV (Pipe Separated Values).<br><br>You can enter as many delimiters as you like. Each character will be treat as a separate possible delimiter.";
|
|
24
24
|
this.infoURL = "https://wikipedia.org/wiki/Comma-separated_values";
|
|
25
25
|
this.inputType = "string";
|
|
26
26
|
this.outputType = "html";
|
|
@@ -43,7 +43,7 @@ class ToTable extends Operation {
|
|
|
43
43
|
{
|
|
44
44
|
"name": "Format",
|
|
45
45
|
"type": "option",
|
|
46
|
-
"value": ["ASCII", "HTML"]
|
|
46
|
+
"value": ["ASCII", "HTML", "Markdown"]
|
|
47
47
|
}
|
|
48
48
|
];
|
|
49
49
|
}
|
|
@@ -66,6 +66,9 @@ class ToTable extends Operation {
|
|
|
66
66
|
case "ASCII":
|
|
67
67
|
return asciiOutput(tableData);
|
|
68
68
|
case "HTML":
|
|
69
|
+
return htmlOutput(tableData);
|
|
70
|
+
case "Markdown":
|
|
71
|
+
return markdownOutput(tableData);
|
|
69
72
|
default:
|
|
70
73
|
return htmlOutput(tableData);
|
|
71
74
|
}
|
|
@@ -183,6 +186,59 @@ class ToTable extends Operation {
|
|
|
183
186
|
return output;
|
|
184
187
|
}
|
|
185
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Outputs an array of data as a Markdown table.
|
|
192
|
+
*
|
|
193
|
+
* @param {string[][]} tableData
|
|
194
|
+
* @returns {string}
|
|
195
|
+
*/
|
|
196
|
+
function markdownOutput(tableData) {
|
|
197
|
+
const headerDivider = "-";
|
|
198
|
+
const verticalBorder = "|";
|
|
199
|
+
|
|
200
|
+
let output = "";
|
|
201
|
+
const longestCells = [];
|
|
202
|
+
|
|
203
|
+
// Find longestCells value per column to pad cells equally.
|
|
204
|
+
tableData.forEach(function(row, index) {
|
|
205
|
+
row.forEach(function(cell, cellIndex) {
|
|
206
|
+
if (longestCells[cellIndex] === undefined || cell.length > longestCells[cellIndex]) {
|
|
207
|
+
longestCells[cellIndex] = cell.length;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Ignoring the checkbox, as current Mardown renderer in CF doesn't handle table without headers
|
|
213
|
+
const row = tableData.shift();
|
|
214
|
+
output += outputRow(row, longestCells);
|
|
215
|
+
let rowOutput = verticalBorder;
|
|
216
|
+
row.forEach(function(cell, index) {
|
|
217
|
+
rowOutput += " " + headerDivider + " " + verticalBorder;
|
|
218
|
+
});
|
|
219
|
+
output += rowOutput += "\n";
|
|
220
|
+
|
|
221
|
+
// Add the rest of the table rows.
|
|
222
|
+
tableData.forEach(function(row, index) {
|
|
223
|
+
output += outputRow(row, longestCells);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return output;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Outputs a row of correctly padded cells.
|
|
230
|
+
*/
|
|
231
|
+
function outputRow(row, longestCells) {
|
|
232
|
+
let rowOutput = verticalBorder;
|
|
233
|
+
row.forEach(function(cell, index) {
|
|
234
|
+
rowOutput += " " + cell + " ".repeat(longestCells[index] - cell.length) + " " + verticalBorder;
|
|
235
|
+
});
|
|
236
|
+
rowOutput += "\n";
|
|
237
|
+
return rowOutput;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
186
242
|
}
|
|
187
243
|
|
|
188
244
|
}
|