mirror of
https://github.com/gchq/CyberChef.git
synced 2026-05-23 12:39:11 -07:00
Parse IPv4 Header HTML formatting fix (#2401)
This commit is contained in:
parent
cf6912f640
commit
1baef27e9b
3 changed files with 25 additions and 1 deletions
|
|
@ -138,7 +138,7 @@ class ParseIPv4Header extends Operation {
|
|||
} else if (outputFormat === "Data (hex)") {
|
||||
return toHex(data);
|
||||
} else if (outputFormat === "Data (raw)") {
|
||||
return Utils.byteArrayToChars(data);
|
||||
return Utils.escapeHtml(Utils.byteArrayToChars(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ import "./tests/NormaliseUnicode.mjs";
|
|||
import "./tests/NTLM.mjs";
|
||||
import "./tests/OTP.mjs";
|
||||
import "./tests/ParseEthernetFrame.mjs";
|
||||
import "./tests/ParseIPv4Header.mjs";
|
||||
import "./tests/ParseIPRange.mjs";
|
||||
import "./tests/ParseObjectIDTimestamp.mjs";
|
||||
import "./tests/ParseQRCode.mjs";
|
||||
|
|
|
|||
23
tests/operations/tests/ParseIPv4Header.mjs
Normal file
23
tests/operations/tests/ParseIPv4Header.mjs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Parse IPv4 header tests.
|
||||
*
|
||||
* @author C85297 [95289555+C85297@users.noreply.github.com]
|
||||
* @copyright Crown Copyright 2026
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Parse IPv4 header: Correctly formatted HTML output",
|
||||
input: "45 00 00 3c 1c 46 40 00 40 06 b1 e6 c0 a8 00 01 c0 a8 00 02 3c 73 63 72 69 70 74 3e 61 6c 65 72 74 28 31 33 33 37 29 3c 2f 73 63 72 69 70 74 3e",
|
||||
expectedOutput: "<script>alert(1337)</script>",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Parse IPv4 header",
|
||||
args: ["Hex", "Data (raw)"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue