mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 06:57:12 -04:00
Fix bug on char()
This commit is contained in:
parent
93d47630b8
commit
0299f23363
1 changed files with 11 additions and 8 deletions
|
@ -82,15 +82,18 @@ const ByteRepr = {
|
|||
*/
|
||||
runFromCharHex: function(input, args) {
|
||||
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])]);
|
||||
var inner_re = /(\d{1,3}),?/g
|
||||
var data = input.replace(re,
|
||||
function(match, p1) {
|
||||
if (p1) {
|
||||
var result = "", inner_match;
|
||||
while ((inner_match = inner_re.exec(p1)) != null) {
|
||||
result += Utils.byteArrayToChars([parseInt(inner_match[1])]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return input.replace(re, result);
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue