From 483dda0bb69a1c5a9a339ba32701eefcad6d84e3 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Thu, 11 Aug 2022 00:33:24 +0200 Subject: [PATCH] CLI arguments --- Cargo.toml | 2 +- src/cli.rs | 17 ++++++++++++++--- src/main.rs | 9 +++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5c71906..4560d34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mcmap" +name = "wwmap" version = "0.1.0" edition = "2021" diff --git a/src/cli.rs b/src/cli.rs index fb71c50..dd448e6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,7 +1,18 @@ use clap::Parser; +use std::path::PathBuf; #[derive(Parser, Debug)] -struct Args { - name: String, - count: u8 +#[clap(name = "World Wide Mapping", version, about = "Scan the world wide web for a certian port.", long_about = None)] +pub struct Args { + #[clap(help = "Which port to scan for.", short = 'p', long = "port")] + pub port: u16, + + #[clap(help = "Amount of threads that will be used when scanning for the specified port.", short = 'n', long = "threads", default_value_t = 1)] + pub threads: u8, + + #[clap(help = "A file containing ignored IPv4 addresses (seperated by linebreaks).", short = 'i', long = "ignore-ip-list", default_value = "ignore-ips-list.txt")] + pub ignorelist: PathBuf, + + #[clap(help = "Enable verbose (debug) output", short = 'v', long = "verbose", takes_value = false, required = false)] + pub verbose: bool } diff --git a/src/main.rs b/src/main.rs index a5ea142..db65208 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,11 @@ mod scanner; mod util; mod cli; -//use ipv4::IPv4; +use clap::Parser; +use cli::Args; -fn main() {} +fn main() { + let args = Args::parse(); + + println!("{:?}", args); +}