Merge branch 'master' of https://github.com/benediktwerner/CyberChef
This commit is contained in:
commit
b71e3241be
@ -1,3 +1,5 @@
|
|||||||
|
import Utils from "../Utils.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base85 resources.
|
* Base85 resources.
|
||||||
*
|
*
|
||||||
@ -32,13 +34,12 @@ export const ALPHABET_OPTIONS = [
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function alphabetName(alphabet) {
|
export function alphabetName(alphabet) {
|
||||||
alphabet = alphabet.replace(/'/g, "'");
|
alphabet = escape(alphabet);
|
||||||
alphabet = alphabet.replace(/"/g, """);
|
|
||||||
alphabet = alphabet.replace(/\\/g, "\");
|
|
||||||
let name;
|
let name;
|
||||||
|
|
||||||
ALPHABET_OPTIONS.forEach(function(a) {
|
ALPHABET_OPTIONS.forEach(function(a) {
|
||||||
if (escape(alphabet) === escape(a.value)) name = a.name;
|
const expanded = Utils.expandAlphRange(a.value).join("");
|
||||||
|
if (alphabet === escape(expanded)) name = a.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
@ -38,6 +38,35 @@ class FromBase85 extends Operation {
|
|||||||
value: true
|
value: true
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
this.checks = [
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
"^\\s*(?:<~)?" + // Optional whitespace and starting marker
|
||||||
|
"[\\s!-uz]*" + // Any amount of base85 characters and whitespace
|
||||||
|
"[!-uz]{15}" + // At least 15 continoues base85 characters without whitespace
|
||||||
|
"[\\s!-uz]*" + // Any amount of base85 characters and whitespace
|
||||||
|
"(?:~>)?\\s*$", // Optional ending marker and whitespace
|
||||||
|
args: ["!-u"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
"^" +
|
||||||
|
"[\\s0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]*" +
|
||||||
|
"[0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]{15}" + // At least 15 continoues base85 characters without whitespace
|
||||||
|
"[\\s0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]*" +
|
||||||
|
"$",
|
||||||
|
args: ["0-9a-zA-Z.\\-:+=^!/*?&<>()[]{}@%$#"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
"^" +
|
||||||
|
"[\\s0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]*" +
|
||||||
|
"[0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]{15}" + // At least 15 continoues base85 characters without whitespace
|
||||||
|
"[\\s0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]*" +
|
||||||
|
"$",
|
||||||
|
args: ["0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~"],
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,8 +93,12 @@ class FromBase85 extends Operation {
|
|||||||
|
|
||||||
if (input.length === 0) return [];
|
if (input.length === 0) return [];
|
||||||
|
|
||||||
const matches = input.match(/<~(.+?)~>/);
|
input = input.replace(/\s+/g, "");
|
||||||
if (matches !== null) input = matches[1];
|
|
||||||
|
if (encoding === "Standard") {
|
||||||
|
const matches = input.match(/<~(.+?)~>/);
|
||||||
|
if (matches !== null) input = matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let block, blockBytes;
|
let block, blockBytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user