cyberchef 9.50.8 → 9.50.10
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.10",
|
|
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",
|
|
@@ -14427,7 +14427,7 @@
|
|
|
14427
14427
|
},
|
|
14428
14428
|
"To Table": {
|
|
14429
14429
|
"module": "Default",
|
|
14430
|
-
"description": "Data can be split on different characters and rendered as an HTML or
|
|
14430
|
+
"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
14431
|
"infoURL": "https://wikipedia.org/wiki/Comma-separated_values",
|
|
14432
14432
|
"inputType": "string",
|
|
14433
14433
|
"outputType": "html",
|
|
@@ -14454,7 +14454,8 @@
|
|
|
14454
14454
|
"type": "option",
|
|
14455
14455
|
"value": [
|
|
14456
14456
|
"ASCII",
|
|
14457
|
-
"HTML"
|
|
14457
|
+
"HTML",
|
|
14458
|
+
"Markdown"
|
|
14458
14459
|
]
|
|
14459
14460
|
}
|
|
14460
14461
|
]
|
|
@@ -46,7 +46,7 @@ class ParseASN1HexString extends Operation {
|
|
|
46
46
|
run(input, args) {
|
|
47
47
|
const [index, truncateLen] = args;
|
|
48
48
|
return r.ASN1HEX.dump(input.replace(/\s/g, "").toLowerCase(), {
|
|
49
|
-
"
|
|
49
|
+
"ommit_long_octet": truncateLen
|
|
50
50
|
}, index);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -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
|
}
|