Merge pull request #64 from ivre/enh-quiet

Add quiet mode
This commit is contained in:
_Frky 2022-09-20 15:12:00 +02:00 committed by GitHub
commit 3122d4e362
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -98,6 +98,7 @@ OPTIONS:
--ip-addr <iplist> Inline list of IP addresses to impersonate, comma-separated --ip-addr <iplist> Inline list of IP addresses to impersonate, comma-separated
--ip-addr-file <ipfile> File with the list of IP addresses to impersonate --ip-addr-file <ipfile> File with the list of IP addresses to impersonate
-m, --mac-addr <mac> MAC address to use in the response packets -m, --mac-addr <mac> MAC address to use in the response packets
-q, --quiet Quiet mode: does not output anything on stdout
-v Increase message verbosity -v Increase message verbosity
-V, --version Print version information -V, --version Print version information
``` ```

View file

@ -139,6 +139,13 @@ fn main() {
.multiple_occurrences(true) .multiple_occurrences(true)
.help("Increase message verbosity"), .help("Increase message verbosity"),
) )
.arg(
Arg::new("quiet")
.long("quiet")
.short('q')
.help("Quiet mode: do not output anything on stdout")
.takes_value(false),
)
.get_matches(); .get_matches();
let verbose = args.occurrences_of("verbosity") as usize; let verbose = args.occurrences_of("verbosity") as usize;
/* initialise logger */ /* initialise logger */
@ -210,8 +217,10 @@ fn main() {
}; };
info!("interface......{}", masscanned.iface.unwrap().name); info!("interface......{}", masscanned.iface.unwrap().name);
info!("mac address....{}", masscanned.mac); info!("mac address....{}", masscanned.mac);
if !args.contains_id("quiet") {
masscanned.log.add(Box::new(ConsoleLogger::new())); masscanned.log.add(Box::new(ConsoleLogger::new()));
masscanned.log.init(); masscanned.log.init();
}
let (mut tx, mut rx) = get_channel(masscanned.iface.unwrap()); let (mut tx, mut rx) = get_channel(masscanned.iface.unwrap());
loop { loop {
/* check if network interface is still up */ /* check if network interface is still up */