mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 23:15:14 -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) {
|
runFromCharHex: function(input, args) {
|
||||||
var re = /cha?r\((((\d{1,3})(,\s?)?)+)\)/ig;
|
var re = /cha?r\((((\d{1,3})(,\s?)?)+)\)/ig;
|
||||||
var inner_re = /(\d{1,3}),?/g;
|
var inner_re = /(\d{1,3}),?/g
|
||||||
var match, inner_match;
|
var data = input.replace(re,
|
||||||
var result = "";
|
function(match, p1) {
|
||||||
while ((match = re.exec(input)) != null) {
|
if (p1) {
|
||||||
while ((inner_match = inner_re.exec(match[1])) != null) {
|
var result = "", inner_match;
|
||||||
result += Utils.byteArrayToChars([parseInt(inner_match[1])]);
|
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