forked from OISF/suricata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Corey Thomas
committed
Oct 7, 2024
1 parent
e0911c2
commit 7bea8ca
Showing
252 changed files
with
27,320 additions
and
1,501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Copyright (c) 2009-2010 Open Information Security Foundation | ||
Copyright (c) 2010-2013 Qualys, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
- Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the Qualys, Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# LibHTP | ||
|
||
--- | ||
|
||
Copyright 2009-2010 Open Information Security Foundation | ||
Copyright 2010-2013 Qualys, Inc. | ||
|
||
--- | ||
|
||
LibHTP is a security-aware parser for the HTTP protocol and the related bits | ||
and pieces. The goals of the project, in the order of importance, are as | ||
follows: | ||
|
||
1. Completeness of coverage; LibHTP must be able to parse virtually all | ||
traffic that is found in practice. | ||
|
||
2. Permissive parsing; LibHTP must never fail to parse a stream that would | ||
be parsed by some other web server. | ||
|
||
3. Awareness of evasion techniques; LibHTP must be able to detect and | ||
effectively deal with various evasion techniques, producing, where | ||
practical, identical or practically identical results as the web | ||
server processing the same traffic stream. | ||
|
||
4. Performance; The performance must be adequate for the desired tasks. | ||
Completeness and security are often detrimental to performance. Our | ||
idea of handling the conflicting requirements is to put the library | ||
user in control, allowing him to choose the most desired library | ||
characteristic. | ||
|
||
| IMPORTANT LIBHTP IS NOT YET CONSIDERED STABLE. USE AT YOUR OWN RISK. DO NOT | ||
| USE IN PRODUCTION. WORK IS CURRENTLY UNDER WAY TO ENSURE THAT | ||
| LIBHTP IS SECURE AND THAT IT PERFORMS WELL. | ||
|
||
| STATUS LIBHTP IS VERY YOUNG AT THIS POINT. IT WILL BE SOME TIME BEFORE | ||
| IT CAN BE CONSIDER COMPLETE. AT THE MOMENT, THE FOCUS OF DEVELOPMENT | ||
| IS ON ACHIEVING THE FIRST TWO GOALS. | ||
|
||
See the LICENSE file distributed with this work for information | ||
regarding licensing, copying and copyright ownership. | ||
|
||
|
||
# Usage | ||
Start using libHTP by including it in your project's `Cargo.toml` | ||
dependencies. The base library will also be required for using common | ||
types. | ||
|
||
**The minimum supported version of `rustc` is `1.58.1`.** | ||
|
||
## Example | ||
``` | ||
[dependencies] | ||
htp = "2.0.0" | ||
``` | ||
|
||
## FFI Support | ||
LibHTP has a foreign function interface for use in C/C++ projects. | ||
FFI Support can be enabled by building with the `cbindgen` feature. | ||
|
||
``` | ||
# Install cbindgen which is required to generate headers | ||
cargo install --force cbindgen | ||
# Build headers and shared objects | ||
make | ||
``` | ||
|
||
## LICENSE | ||
|
||
LibHTP is licensed under the BSD 3-Clause license (also known as "BSD New" and | ||
"BSD Simplified".) The complete text of the license is enclosed in the file LICENSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
language = "C" | ||
|
||
# Header wrapping options | ||
#header = "LICENSE here" | ||
#trailer = "" | ||
include_guard = "_HTP_H" | ||
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Do NOT modify manually */" | ||
#include_version = true | ||
#sys_includes = [] # Sys headers | ||
includes = [] | ||
no_includes = false | ||
cpp_compat = true | ||
#after_includes = "" | ||
|
||
# Code style | ||
#braces = "SameLine" | ||
#line_length = 100 | ||
#tab_wideth = 2 | ||
#documentation_style = auto | ||
|
||
# Codegen | ||
style = "both" | ||
|
||
after_includes = """ | ||
#define htp_status_t HtpStatus | ||
#define htp_server_personality_t HtpServerPersonality | ||
#define htp_protocol_t HtpProtocol | ||
#define htp_unwanted_t HtpUnwanted | ||
#define htp_url_encoding_handling_t HtpUrlEncodingHandling | ||
#define htp_stream_state_t HtpStreamState | ||
#define htp_content_encoding_t HtpContentEncoding | ||
#define htp_log_code_t HtpLogCode | ||
#define htp_log_level_t HtpLogLevel | ||
#define htp_method_t HtpMethod | ||
#define htp_data_source_t HtpDataSource | ||
#define htp_parser_id_t HtpParserId | ||
#define htp_transfer_coding_t HtpTransferCoding | ||
#define htp_res_progress_t HtpResponseProgress | ||
#define htp_req_progress_t HtpRequestProgress | ||
""" | ||
|
||
[export.rename] | ||
"ConnectionFlags" = "HTP_CONNECTION_FLAGS" | ||
"HeaderFlags" = "HTP_HEADER_FLAGS" | ||
"HtpFlags" = "HTP_FLAGS" | ||
"Config" = "htp_cfg_t" | ||
"Connection" = "htp_conn_t" | ||
"ConnectionParser" = "htp_connp_t" | ||
"Header" = "htp_header_t" | ||
"Headers" = "htp_headers_t" | ||
"Param" = "htp_param_t" | ||
"Data" = "htp_tx_data_t" | ||
"Transaction" = "htp_tx_t" | ||
"Transactions" = "htp_txs_t" | ||
"Uri" = "htp_uri_t" | ||
"Bstr" = "bstr" | ||
"Table" = "htp_table_t" | ||
"Log" = "htp_log_t" | ||
"timeval" = "struct timeval" | ||
"Logs" = "htp_logs_t" | ||
|
||
[export] | ||
include = ["HtpStatus", | ||
"HtpServerPersonality", | ||
"HtpProtocol", | ||
"HtpUnwanted", | ||
"HtpUrlEncodingHandling", | ||
"HtpStreamState", | ||
"HtpContentEncoding", | ||
"HtpLogCode", | ||
"HtpLogLevel", | ||
"HtpMethod", | ||
"HtpDataSource", | ||
"HtpParserId", | ||
"HtpTransferCoding", | ||
"HtpResponseProgress", | ||
"HtpRequestProgress", | ||
"HtpFlags", | ||
"HeaderFlags", | ||
"ConnectionFlags"] | ||
|
||
[enum] | ||
rename_variants = "QualifiedScreamingSnakeCase" | ||
prefix_with_name = false | ||
|
||
[macro_expansion] | ||
bitflags = true | ||
|
||
# Rust parsing options | ||
[parse] | ||
parse_deps = false | ||
clean = false | ||
|
||
[parse.expand] | ||
features = ["cbindgen"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![allow(non_snake_case)] | ||
#![no_main] | ||
#[macro_use] extern crate libfuzzer_sys; | ||
|
||
extern crate htp; | ||
|
||
use htp::test::{Test, TestConfig}; | ||
use std::env; | ||
|
||
|
||
fuzz_target!(|data: &[u8]| { | ||
let mut t = Test::new(TestConfig()); | ||
t.run_slice(data); | ||
}); |
Oops, something went wrong.