mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 15:07:11 -04:00
0x[Hex] operation added
This commit is contained in:
parent
f1449ac869
commit
112af3c74b
4 changed files with 29 additions and 0 deletions
|
@ -5,6 +5,7 @@ This is a fork of original CyberChef by GCHQ. This project has implemented my ow
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- opeartion **nTcpdump**: tcpdump hexdump convert
|
- opeartion **nTcpdump**: tcpdump hexdump convert
|
||||||
|
- operation **From 0x[Hex]**: e.g. <code>0x217e21</code> to <code>!~!</code>
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ var Categories = [
|
||||||
"To Hexdump",
|
"To Hexdump",
|
||||||
"From Hexdump",
|
"From Hexdump",
|
||||||
"From nTcpdump",
|
"From nTcpdump",
|
||||||
|
"From 0x[Hex]",
|
||||||
"To Hex",
|
"To Hex",
|
||||||
"From Hex",
|
"From Hex",
|
||||||
"To Charcode",
|
"To Charcode",
|
||||||
|
|
|
@ -391,6 +391,15 @@ var OperationConfig = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"From 0x[Hex]": {
|
||||||
|
description: "Converts a hexadecimal byte string back into a its raw value.<br><br>e.g. <code>0x217e21</code> becomes the UTF-8 encoded string <code>!~!</code>",
|
||||||
|
run: ByteRepr.runFrom0xHex,
|
||||||
|
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,
|
||||||
|
|
|
@ -51,6 +51,24 @@ var ByteRepr = {
|
||||||
var delim = args[0] || "Space";
|
var delim = args[0] || "Space";
|
||||||
return Utils.fromHex(input, delim, 2);
|
return Utils.fromHex(input, delim, 2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From 0xHex operation.
|
||||||
|
*
|
||||||
|
* @param {string} input (Starting with 0x only in the raw input)
|
||||||
|
* @param {Object[]} args
|
||||||
|
* @returns {byteArray}
|
||||||
|
*/
|
||||||
|
runFrom0xHex: function(input, args) {
|
||||||
|
var data = input.replace(/0x([0-9a-f]{2,})/ig,
|
||||||
|
function(match, p1) {
|
||||||
|
if (p1) {
|
||||||
|
return Utils.byteArrayToChars(Utils.fromHex(p1));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue