Skip to main content

seeding/
cli.rs

1use clap::Parser;
2use navigator::protocol::Protocols;
3
4#[derive(Parser, Debug, Clone)]
5#[command(
6    version,
7    about,
8    long_about = "Generates fuzzing seed data in a bespoke binary format from an ExchangeDataset msgpack file. Uses the provided protocol to sort request-response pairs by function code & length of response bytes required."
9)]
10pub struct SeedingArgs {
11    /// Path to an "ExchangeDataset", saved as a .msgpack file.
12    #[arg(long)]
13    pub dataset_path: String,
14    /// Path used to save the output chunked file.
15    #[arg(long)]
16    pub output_path: String,
17    /// The protocol of the traffic in the dataset. E.g. "Modbus" or "Unknown"
18    #[arg(long, value_parser = protocol_parser)]
19    pub protocol: Protocols,
20}
21
22fn protocol_parser(s: &str) -> Result<Protocols, String> {
23    Protocols::try_from(s)
24}