From ef563d0b1aadf9ebc8a70f8828d876f0295a9bca Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 8 Aug 2022 01:24:42 +0200 Subject: [PATCH] Minor stuff --- Cargo.toml | 3 +++ src/ipv4_gen.rs | 4 ++++ src/main.rs | 9 +++++++++ src/scanner.rs | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 src/ipv4_gen.rs create mode 100644 src/scanner.rs diff --git a/Cargo.toml b/Cargo.toml index 2a848fb..26960ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +# packet = "0.1.4" +anyhow = "1" +log = "0.4" diff --git a/src/ipv4_gen.rs b/src/ipv4_gen.rs new file mode 100644 index 0000000..a7f2a16 --- /dev/null +++ b/src/ipv4_gen.rs @@ -0,0 +1,4 @@ + +pub fn generate_ips() -> Vec> { + +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..1756a81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,12 @@ +#![allow( + dead_code, + unused_variables, + //unused_imports, // TODO: rm +)] + +mod scanner; +mod ipv4_gen; + fn main() { println!("Hello, world!"); } diff --git a/src/scanner.rs b/src/scanner.rs new file mode 100644 index 0000000..1f62648 --- /dev/null +++ b/src/scanner.rs @@ -0,0 +1,35 @@ +use std::{net::{TcpStream, SocketAddr}, thread::JoinHandle}; +use log::info; +use std::thread; +use crate::ipv4_gen; + +async fn check_ack(dest: &SocketAddr) -> bool { + if let Ok(res) = TcpStream::connect(dest) { + info!("Got TCP ack from: {:?}", dest); + return true; + } + return false; +} + +pub fn start_scan(depth: u32) { + let threads: Vec> = Vec::new(); + + for i in 0..depth { + let thread = thread::spawn(|| { + println!("hi"); + }); + } +} + + +/* + +depth: u32 +blacklist_ips: Vec + +pre: + # generate IPs + ALL_IPS: Vec> = ... + +*/ +