Skip to content

Commit 3fb4626

Browse files
committed
merged dev
2 parents 33df973 + b9e75c0 commit 3fb4626

File tree

6 files changed

+554
-99
lines changed

6 files changed

+554
-99
lines changed

libafl/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ default = ["std", "anymap_debug", "derive", "llmp_compression"]
3838
std = [] # print, sharedmap, ... support
3939
anymap_debug = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint.
4040
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
41-
llmp_small_maps = [] # reduces initial map size for llmp
41+
llmp_bind_public = [] # If set, llmp will bind to 0.0.0.0, allowing cross-device communication. Binds to localhost by default.
42+
llmp_compression = [] # llmp compression using GZip
4243
llmp_debug = ["backtrace"] # Enables debug output for LLMP
44+
llmp_small_maps = [] # reduces initial map size for llmp
4345
introspection = [] # Include performance statistics of the fuzzing pipeline
44-
llmp_compression = [] #llmp compression using GZip
4546

4647
[[example]]
4748
name = "llmp_test"
@@ -62,6 +63,7 @@ libafl_derive = { version = "0.1.0", optional = true, path = "../libafl_derive"
6263
serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap
6364
compression = { version = "0.1.5" }
6465
num_enum = "0.5.1"
66+
hostname = "^0.3" # Is there really no gethostname in the stdlib?
6567

6668
[target.'cfg(target_os = "android")'.dependencies]
6769
backtrace = { version = "0.3", optional = true, default-features = false, features = ["std", "libbacktrace"] } # for llmp_debug

libafl/examples/llmp_test/main.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn large_msg_loop(port: u16) -> ! {
8383
fn broker_message_hook(
8484
client_id: u32,
8585
tag: llmp::Tag,
86-
_flags: llmp::Flag,
86+
_flags: llmp::Flags,
8787
message: &[u8],
8888
) -> Result<llmp::LlmpMsgHookResult, Error> {
8989
match tag {
@@ -120,22 +120,31 @@ fn main() {
120120

121121
let mode = std::env::args()
122122
.nth(1)
123-
.expect("no mode specified, chose 'broker', 'ctr', 'adder', or 'large'");
123+
.expect("no mode specified, chose 'broker', 'b2b', 'ctr', 'adder', or 'large'");
124124
let port: u16 = std::env::args()
125125
.nth(2)
126126
.unwrap_or("1337".into())
127127
.parse::<u16>()
128128
.unwrap();
129+
// in the b2b use-case, this is our "own" port, we connect to the "normal" broker node on startup.
130+
let b2b_port: u16 = std::env::args()
131+
.nth(3)
132+
.unwrap_or("4242".into())
133+
.parse::<u16>()
134+
.unwrap();
129135
println!("Launching in mode {} on port {}", mode, port);
130136

131137
match mode.as_str() {
132138
"broker" => {
133139
let mut broker = llmp::LlmpBroker::new(StdShMemProvider::new().unwrap()).unwrap();
134-
broker
135-
.launch_listener(llmp::Listener::Tcp(
136-
std::net::TcpListener::bind(format!("127.0.0.1:{}", port)).unwrap(),
137-
))
138-
.unwrap();
140+
broker.launch_tcp_listener_on(port).unwrap();
141+
broker.loop_forever(&mut broker_message_hook, Some(Duration::from_millis(5)))
142+
}
143+
"b2b" => {
144+
let mut broker = llmp::LlmpBroker::new(StdShMemProvider::new().unwrap()).unwrap();
145+
broker.launch_tcp_listener_on(b2b_port).unwrap();
146+
// connect back to the main broker.
147+
broker.connect_b2b(("127.0.0.1", port)).unwrap();
139148
broker.loop_forever(&mut broker_message_hook, Some(Duration::from_millis(5)))
140149
}
141150
"ctr" => {

libafl/src/bolts/compress.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl GzipCompressor {
4242

4343
/// Decompression.
4444
/// Flag is used to indicate if it's compressed or not
45+
#[allow(clippy::unused_self)]
4546
pub fn decompress(&self, buf: &[u8]) -> Result<Vec<u8>, Error> {
4647
Ok(buf
4748
.iter()

0 commit comments

Comments
 (0)