MCPcopy
hub / github.com/gchq/CyberChef / run

Method run

src/core/operations/TextEncodingBruteForce.mjs:52–70  ·  view source on GitHub ↗

* @param {string} input * @param {Object[]} args * @returns {json}

(input, args)

Source from the content-addressed store, hash-verified

50 * @returns {json}
51 */
52 run(input, args) {
53 const output = {},
54 charsets = Object.keys(CHR_ENC_CODE_PAGES),
55 mode = args[0];
56
57 charsets.forEach(charset => {
58 try {
59 if (mode === "Decode") {
60 output[charset] = cptable.utils.decode(CHR_ENC_CODE_PAGES[charset], input);
61 } else {
62 output[charset] = Utils.arrayBufferToStr(cptable.utils.encode(CHR_ENC_CODE_PAGES[charset], input));
63 }
64 } catch (err) {
65 output[charset] = "Could not decode.";
66 }
67 });
68
69 return output;
70 }
71
72 /**
73 * Displays the encodings in an HTML table for web apps.

Callers

nothing calls this directly

Calls 3

decodeMethod · 0.80
arrayBufferToStrMethod · 0.80
encodeMethod · 0.80

Tested by

no test coverage detected