mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Adds hexEncode transformation
This commit is contained in:
parent
0ae09201f5
commit
93c3bc804e
@ -21,6 +21,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include "modsecurity/assay.h"
|
#include "modsecurity/assay.h"
|
||||||
#include "actions/transformations/transformation.h"
|
#include "actions/transformations/transformation.h"
|
||||||
@ -37,15 +38,14 @@ HexEncode::HexEncode(std::string action)
|
|||||||
|
|
||||||
std::string HexEncode::evaluate(std::string value,
|
std::string HexEncode::evaluate(std::string value,
|
||||||
Assay *assay) {
|
Assay *assay) {
|
||||||
/**
|
|
||||||
* @todo Implement the transformation HexEncode
|
std::stringstream result;
|
||||||
*/
|
for (std::size_t i=0; i < value.length(); i++) {
|
||||||
if (assay) {
|
int ii = (char)value[i];
|
||||||
#ifndef NO_LOGS
|
result << std::setw(2) << std::setfill('0') << std::hex << ii;
|
||||||
assay->debug(4, "Transformation HexEncode is not implemented yet.");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return value;
|
|
||||||
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace transformations
|
} // namespace transformations
|
||||||
|
@ -81,7 +81,7 @@ Transformation* Transformation::instantiate(std::string a) {
|
|||||||
IF_MATCH(cssDecode) { return new CssDecode(a); }
|
IF_MATCH(cssDecode) { return new CssDecode(a); }
|
||||||
IF_MATCH(escape_seq_decode) { return new EscapeSeqDecode(a); }
|
IF_MATCH(escape_seq_decode) { return new EscapeSeqDecode(a); }
|
||||||
IF_MATCH(hex_decode) { return new HexDecode(a); }
|
IF_MATCH(hex_decode) { return new HexDecode(a); }
|
||||||
IF_MATCH(hex_encode) { return new HexEncode(a); }
|
IF_MATCH(hexEncode) { return new HexEncode(a); }
|
||||||
IF_MATCH(htmlEntityDecode) { return new HtmlEntityDecode(a); }
|
IF_MATCH(htmlEntityDecode) { return new HtmlEntityDecode(a); }
|
||||||
IF_MATCH(jsDecode) { return new JsDecode(a); }
|
IF_MATCH(jsDecode) { return new JsDecode(a); }
|
||||||
IF_MATCH(length) { return new Length(a); }
|
IF_MATCH(length) { return new Length(a); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user