Browse Source

Deleted nzmap since zmap has this feature builtin

niels 2 years ago
parent
commit
ac0184676a
2 changed files with 0 additions and 67 deletions
  1. 0 1
      responder-tools/Cargo.toml
  2. 0 66
      responder-tools/src/bin/nzmap.rs

+ 0 - 1
responder-tools/Cargo.toml

@@ -12,4 +12,3 @@ aya-tool = { git = "https://github.com/aya-rs/aya" }
 responder-common = { path = "../responder-common", features=["user"] }
 env_logger = "0.9"
 log = "0.4"
-rayon = "1.7.0"

+ 0 - 66
responder-tools/src/bin/nzmap.rs

@@ -1,66 +0,0 @@
-use std::{time::{UNIX_EPOCH, SystemTime}, process::Command};
-
-use anyhow::{Context, anyhow};
-use clap::Parser;
-use rayon::prelude::{IntoParallelIterator, ParallelIterator};
-
-
-
-#[derive(Debug, Parser)]
-struct Options {
-    #[clap(short = 'n', long, default_value="1")]
-    pub count: u32,
-
-    #[clap(short = 'e', long)]
-    pub seed: Option<String>,
-
-    #[clap(name = "args", last = true)]
-    pub run_args: Vec<String>,
-
-}
-
-fn main() -> Result<(), anyhow::Error> {
-    env_logger::init();
-    let opts = Options::parse();
-    return spawn_zmaps(opts);
-}
-
-fn spawn_zmap(args: &[String], i: u32) -> Result<(), anyhow::Error> {
-    let mut args = Vec::from(args);
-    args.push(format!("--shard={}", i));
-    args.push(format!("--cores=0,{},1",i+2));
-    args.push(format!("-o/tmp/ips{}.csv", i));
-    let result = Command::new("zmap")
-        .args(args)
-        .spawn()?
-        .wait()?;
-    if result.success() {
-        return Ok(());
-    } else if let Some(code) = result.code() {
-        return Err(anyhow!("code: {}", code));
-    } else {
-        return Err(anyhow!(""));
-    }
-}
-
-
-fn spawn_zmaps(opts: Options) -> Result<(), anyhow::Error> {
-    let seed = if let Some(seed) = opts.seed {
-        seed
-    } else {
-        SystemTime::now()
-            .duration_since(UNIX_EPOCH)
-            .context("Attempted to obtain UNIX timestamp for seed")?
-            .as_millis()
-            .to_string()
-    };
-    let mut args = opts.run_args.clone();
-    args.push(format!("--seed={}", seed));
-    args.push(format!("--shards={}", opts.count));
-
-    (0..opts.count).into_par_iter().map(|i| {
-        spawn_zmap(&args, i).context(format!("Shard {} encountered error", i))
-    }).reduce(|| Ok(()), Result::and)?;
-
-    Ok(())
-}