Adding From Char(hex) feature

This commit is contained in:
windhamwong@nva-hk.com 2017-03-24 11:36:15 +00:00
parent 112af3c74b
commit 8b546e61b2
4 changed files with 33 additions and 1 deletions

View file

@ -6,11 +6,14 @@ This is a fork of original CyberChef by GCHQ. This project has implemented my ow
- opeartion **nTcpdump**: tcpdump hexdump convert - opeartion **nTcpdump**: tcpdump hexdump convert
- operation **From 0x[Hex]**: e.g. <code>0x217e21</code> to <code>!~!</code> - operation **From 0x[Hex]**: e.g. <code>0x217e21</code> to <code>!~!</code>
- operation **From char(hex)**:
- e.g. <code>chr(33)</code> to <code>!</code>
- This operation supports char() and chr()
- Combining the usage of **From 0x[Hex]** and **From char(hex)** can decode <code>chr(0x3333)</code> to <code>!</code>
## Todo ## Todo
- operation GZip HTTP data - operation GZip HTTP data
- operation char() data
- operation SQL comment strip function - operation SQL comment strip function

View file

@ -29,6 +29,7 @@ var Categories = [
"From Hexdump", "From Hexdump",
"From nTcpdump", "From nTcpdump",
"From 0x[Hex]", "From 0x[Hex]",
"From Char(Hex)",
"To Hex", "To Hex",
"From Hex", "From Hex",
"To Charcode", "To Charcode",

View file

@ -400,6 +400,15 @@ var OperationConfig = {
outputType: "string", outputType: "string",
args: [] args: []
}, },
"From Char(Hex)": {
description: "Converts a hexadecimal byte string back into a its raw value.<br><br>e.g. <code>chr(33)</code> becomes the UTF-8 encoded string <code>!</code>",
run: ByteRepr.runFromCharHex,
highlight: ByteRepr.highlightFrom,
highlightReverse: ByteRepr.highlightTo,
inputType: "string",
outputType: "string",
args: []
},
"From Hex": { "From Hex": {
description: "Converts a hexadecimal byte string back into a its raw value.<br><br>e.g. <code>ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a</code> becomes the UTF-8 encoded string <code>Γειά σου</code>", description: "Converts a hexadecimal byte string back into a its raw value.<br><br>e.g. <code>ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a</code> becomes the UTF-8 encoded string <code>Γειά σου</code>",
run: ByteRepr.runFromHex, run: ByteRepr.runFromHex,

View file

@ -69,6 +69,25 @@ var ByteRepr = {
}); });
return data; return data;
}, },
/**
* From char(hex) operation.
*
* @param {string} input (Starting with chr or char only in the raw input)
* @param {Object[]} args
* @returns {byteArray}
*/
runFromCharHex: function(input, args) {
var data = input.replace(/cha?r\((\d{1,3})\)/ig,
function(match, p1) {
if (p1) {
console.log(p1);
return Utils.byteArrayToChars([parseInt(p1)]);
};
});
return data;
},
/** /**