HTP
0.5
|
void fprint_bstr | ( | FILE * | stream, |
const char * | name, | ||
bstr * | b | ||
) |
void fprint_raw_data | ( | FILE * | stream, |
const char * | name, | ||
const void * | data, | ||
size_t | len | ||
) |
void fprint_raw_data_ex | ( | FILE * | stream, |
const char * | name, | ||
const void * | _data, | ||
size_t | offset, | ||
size_t | printlen | ||
) |
int htp_chomp | ( | unsigned char * | data, |
size_t * | len | ||
) |
Remove all line terminators (LF or CRLF) from the end of the line provided as input.
char* htp_connp_in_state_as_string | ( | htp_connp_t * | connp | ) |
int htp_connp_is_line_folded | ( | unsigned char * | data, |
size_t | len | ||
) |
Determines if the given line is a continuation (of some previous line).
[in] | data | |
[in] | len |
int htp_connp_is_line_ignorable | ( | htp_connp_t * | connp, |
unsigned char * | data, | ||
size_t | len | ||
) |
Determines if the given line can be ignored when it appears before a request.
[in] | connp | |
[in] | data | |
[in] | len |
int htp_connp_is_line_terminator | ( | htp_connp_t * | connp, |
unsigned char * | data, | ||
size_t | len | ||
) |
Determines if the given line is a request terminator.
[in] | connp | |
[in] | data | |
[in] | len |
char* htp_connp_out_state_as_string | ( | htp_connp_t * | connp | ) |
int htp_convert_method_to_number | ( | bstr * | method | ) |
Converts request method, given as a string, into a number.
[in] | method |
htp_status_t htp_decode_path_inplace | ( | htp_tx_t * | tx, |
bstr * | path | ||
) |
Decode a request path according to the settings in the provided configuration structure.
[in] | cfg | |
[in] | tx | |
[in] | path |
htp_status_t htp_extract_quoted_string_as_bstr | ( | unsigned char * | data, |
size_t | len, | ||
bstr ** | out, | ||
size_t * | endoffset | ||
) |
Parses the provided memory region, extracting the double-quoted string.
[in] | data | |
[in] | len | |
[out] | out | |
[out] | endoffset |
char* htp_get_version | ( | void | ) |
Returns the LibHTP version string.
int htp_is_folding_char | ( | int | c | ) |
int htp_is_line_empty | ( | unsigned char * | data, |
size_t | len | ||
) |
Is the given line empty? This function expects the line to have a terminating LF.
[in] | data | |
[in] | len |
int htp_is_line_whitespace | ( | unsigned char * | data, |
size_t | len | ||
) |
Does line consist entirely of whitespace characters?
[in] | data | |
[in] | len |
int htp_is_lws | ( | int | c | ) |
Is character a linear white space character?
[in] | c |
int htp_is_separator | ( | int | c | ) |
Is character a separator character?
[in] | c |
int htp_is_space | ( | int | c | ) |
Is character a white space character?
[in] | c |
int htp_is_text | ( | int | c | ) |
Is character a text character?
[in] | c |
int htp_is_token | ( | int | c | ) |
Is character a token character?
[in] | c |
void htp_log | ( | htp_connp_t * | connp, |
const char * | file, | ||
int | line, | ||
enum htp_log_level_t | level, | ||
int | code, | ||
const char * | fmt, | ||
... | |||
) |
Records one log message.
[in] | connp | |
[in] | file | |
[in] | line | |
[in] | level | |
[in] | code | |
[in] | fmt |
Normalize request hostname. Convert all characters to lowercase and remove trailing dots from the end, if present.
[in] | hostname |
Normalize a previously-parsed request URI.
[in] | connp | |
[in] | incomplete | |
[in] | normalized |
void htp_normalize_uri_path_inplace | ( | bstr * | s | ) |
Normalize URL path. This function implements the remove dot segments algorithm specified in RFC 3986, section 5.2.4.
[in] | s |
int64_t htp_parse_chunked_length | ( | unsigned char * | data, |
size_t | len | ||
) |
Parses chunk length (positive hexadecimal number). White space is allowed before and after the number. An error will be returned if the chunk length is greater than INT32_MAX.
[in] | data | |
[in] | len |
int64_t htp_parse_content_length | ( | bstr * | b | ) |
Parses Content-Length string (positive decimal number). White space is allowed before and after the number.
[in] | b |
htp_status_t htp_parse_ct_header | ( | bstr * | header, |
bstr ** | ct | ||
) |
htp_status_t htp_parse_header_hostport | ( | bstr * | hostport, |
bstr ** | hostname, | ||
bstr ** | port, | ||
int * | port_number, | ||
uint64_t * | flags | ||
) |
Parses hostport provided in the Host header.
[in] | hostport | |
[out] | hostname | |
[out] | port | |
[out] | port_number | |
[out] | flags |
htp_status_t htp_parse_hostport | ( | bstr * | hostport, |
bstr ** | hostname, | ||
bstr ** | port, | ||
int * | port_number, | ||
int * | invalid | ||
) |
Parses an authority string, which consists of a hostname with an optional port number; username and password are not allowed and will not be handled.
[in] | hostport | |
[out] | hostname | A bstring containing the hostname, or NULL if the hostname is invalid. If this value is not NULL, the caller assumes responsibility for memory management. |
[out] | port | Port as text, or NULL if not provided. |
[out] | port_number | Port number, or -1 if the port is not present or invalid. |
[out] | invalid | Set to 1 if any part of the authority is invalid. |
int64_t htp_parse_positive_integer_whitespace | ( | unsigned char * | data, |
size_t | len, | ||
int | base | ||
) |
A somewhat forgiving parser for a positive integer in a given base. Only LWS is allowed before and after the number.
[in] | data | |
[in] | len | |
[in] | base |
Parses request URI, making no attempt to validate the contents.
[in] | input | |
[in] | uri |
int htp_parse_uri_hostport | ( | htp_connp_t * | connp, |
bstr * | hostport, | ||
htp_uri_t * | uri | ||
) |
Parses hostport provided in the URI.
[in] | connp | |
[in] | hostport | |
[in] | uri |
htp_status_t htp_req_run_hook_body_data | ( | htp_connp_t * | connp, |
htp_tx_data_t * | d | ||
) |
Run the REQUEST_BODY_DATA hook.
[in] | connp | |
[in] | d |
htp_status_t htp_res_run_hook_body_data | ( | htp_connp_t * | connp, |
htp_tx_data_t * | d | ||
) |
Run the RESPONSE_BODY_DATA hook.
[in] | connp | |
[in] | d |
int htp_treat_response_line_as_body | ( | const uint8_t * | data, |
size_t | len | ||
) |
Determine if the information provided on the response line is good enough. Browsers are lax when it comes to response line parsing. In most cases they will only look for the words "http" at the beginning.
[in] | data | pointer to bytearray |
[in] | len | length in bytes of data |
char* htp_tx_request_progress_as_string | ( | htp_tx_t * | tx | ) |
char* htp_tx_response_progress_as_string | ( | htp_tx_t * | tx | ) |
htp_status_t htp_tx_urldecode_params_inplace | ( | htp_tx_t * | tx, |
bstr * | input | ||
) |
htp_status_t htp_tx_urldecode_uri_inplace | ( | htp_tx_t * | tx, |
bstr * | input | ||
) |
htp_uri_t* htp_uri_alloc | ( | void | ) |
Allocates and initializes a new htp_uri_t structure.
void htp_uri_free | ( | htp_uri_t * | uri | ) |
Frees all data contained in the uri, and then the uri itself.
[in] | uri |
htp_status_t htp_urldecode_inplace | ( | htp_cfg_t * | cfg, |
enum htp_decoder_ctx_t | ctx, | ||
bstr * | input, | ||
uint64_t * | flags | ||
) |
Performs in-place decoding of the input string, according to the configuration specified by cfg and ctx. On output, various flags (HTP_URLEN_*) might be set.
[in] | cfg | |
[in] | ctx | |
[in] | input | |
[out] | flags |
htp_status_t htp_urldecode_inplace_ex | ( | htp_cfg_t * | cfg, |
enum htp_decoder_ctx_t | ctx, | ||
bstr * | input, | ||
uint64_t * | flags, | ||
int * | expected_status_code | ||
) |
Performs in-place decoding of the input string, according to the configuration specified by cfg and ctx. On output, various flags (HTP_URLEN_*) might be set. If something in the input would cause a particular server to respond with an error, the appropriate status code will be set.
[in] | cfg | |
[in] | ctx | |
[in] | input | |
[out] | flags | |
[out] | expected_status_code | 0 by default, or status code as necessary |
Decode a UTF-8 encoded path. Overlong characters will be decoded, invalid characters will be left as-is. Best-fit mapping will be used to convert UTF-8 into a single-byte stream.
[in] | cfg | |
[in] | tx | |
[in] | path |
Validate a path that is quite possibly UTF-8 encoded.
[in] | tx | |
[in] | path |
int htp_validate_hostname | ( | bstr * | hostname | ) |
Implements relaxed (not strictly RFC) hostname validation.
[in] | hostname |