mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 23:15:14 -04:00
char() operation now supports multiple values inside bracket. i.e. CHAR(45,120,49,45,81,45)
This commit is contained in:
parent
1e60054fe3
commit
93d47630b8
1 changed files with 15 additions and 12 deletions
|
@ -81,13 +81,16 @@ const ByteRepr = {
|
|||
* @returns {byteArray}
|
||||
*/
|
||||
runFromCharHex: function(input, args) {
|
||||
var data = input.replace(/cha?r\((\d{1,3})\)/ig,
|
||||
function(match, p1) {
|
||||
if (p1) {
|
||||
return Utils.byteArrayToChars([parseInt(p1)]);
|
||||
};
|
||||
});
|
||||
return data;
|
||||
var re = /cha?r\((((\d{1,3})(,\s?)?)+)\)/ig;
|
||||
var inner_re = /(\d{1,3}),?/g;
|
||||
var match, inner_match;
|
||||
var result = "";
|
||||
while ((match = re.exec(input)) != null) {
|
||||
while ((inner_match = inner_re.exec(match[1])) != null) {
|
||||
result += Utils.byteArrayToChars([parseInt(inner_match[1])]);
|
||||
}
|
||||
}
|
||||
return input.replace(re, result);
|
||||
},
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue