diff --git a/src/main.rs b/src/main.rs index a35dcce..e279319 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,39 +21,28 @@ impl Config { let mut use_discord = false; - let discord_channel_id = match matches.value_of("channel") { - Some(channel) => { + let discord_channel_id = match env::var("DISCORD_CHANNEL_ID") { + Ok(channel) => { use_discord = true; channel.to_string() }, - None => match env::var("DISCORD_CHANNEL_ID") { - Ok(channel) => { - use_discord = true; - channel.to_string() - }, - Err(_) => { - use_discord = false; - String::from("") - } + Err(_) => { + use_discord = false; + String::from("") } }; - - let discord_token = match matches.value_of("token") { - Some(value) => { + + let discord_token = match env::var("DISCORD_TOKEN") { + Ok(value) => { use_discord = true; value.to_string() }, - None => match env::var("DISCORD_TOKEN") { - Ok(value) => { - use_discord = true; - value.to_string() - }, - Err(_) => { - use_discord = false; - String::from("") - } - } - }; + Err(_) => { + use_discord = false; + String::from("") + } + }; + // Instantiate Offender HitCounter with Threshold of 10 packets. let threshold: u32 = matches.value_of("threshold").unwrap_or("5").parse() diff --git a/src/utils.rs b/src/utils.rs index 4073025..6716fe0 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -15,16 +15,6 @@ pub fn parse_args() -> clap::ArgMatches<'static> { .long("discord") .takes_value(false) .help("Use discord bot to notify of scanning activity")) - .arg(clap::Arg::with_name("token") - .short("k") - .long("token") - .takes_value(true) - .help("Discord Bot Auth token (or set DISCORD_TOKEN env var")) - .arg(clap::Arg::with_name("channel") - .short("c") - .long("channel") - .takes_value(true) - .help("Discord Bot channel ID (or set DISCORD_CHANNEL_ID env var)" )) .arg(clap::Arg::with_name("wait") .short("w") .long("wait")