mirror of
https://github.com/gchq/CyberChef.git
synced 2026-02-06 11:06:45 +00:00
Fix: Correctly parse xxd odd byte hexdumps (#2058)
Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com>
This commit is contained in:
parent
1542cadde8
commit
fa34e2fafc
@ -43,7 +43,7 @@ class FromHexdump extends Operation {
|
||||
*/
|
||||
run(input, args) {
|
||||
const output = [],
|
||||
regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )*[\dA-F]{4}|(?:[\dA-F]{2} )*[\dA-F]{2})/igm;
|
||||
regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )+(?:[\dA-F]{2})?|(?:[\dA-F]{2} )*[\dA-F]{2})/igm;
|
||||
let block, line;
|
||||
|
||||
while ((block = regex.exec(input))) {
|
||||
|
||||
@ -152,6 +152,17 @@ TestRegister.addTests([
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: xxd format, odd number of bytes",
|
||||
input: "00000000: 6162 6364 65 abcde",
|
||||
expectedOutput: "abcde",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "From Hexdump",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "From Hexdump: Wireshark",
|
||||
input: `00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ........ ........
|
||||
|
||||
Loading…
Reference in New Issue
Block a user