IPv4 permutations

cli
E. Almqvist 2 years ago
parent ef563d0b1a
commit cda30bd819
  1. 1
      Cargo.toml
  2. 4
      src/ipv4_gen.rs
  3. 4
      src/main.rs
  4. 11
      src/permutations.rs
  5. 8
      src/scanner.rs

@ -9,3 +9,4 @@ edition = "2021"
# packet = "0.1.4"
anyhow = "1"
log = "0.4"
permutator = "0.4.3"

@ -1,4 +0,0 @@
pub fn generate_ips() -> Vec<Vec<u8>> {
}

@ -5,8 +5,8 @@
)]
mod scanner;
mod ipv4_gen;
mod permutations;
fn main() {
println!("Hello, world!");
scanner::start_scan(100);
}

@ -0,0 +1,11 @@
use permutator::Permutation;
pub fn get_ipv4_permutations(start_pos: [u8; 4]) -> Vec<Vec<u8>> {
let perms: Vec<Vec<u8>> = Vec::new();
// (2^8)^4 = 2^32 => 32bit
let range: Box<[u8; u32::max_value() as usize]> = (0..u8::max_value()).collect::<Box<[u8]>>().try_into().expect("nope");
perms
}

@ -1,23 +1,25 @@
use std::{net::{TcpStream, SocketAddr}, thread::JoinHandle};
use log::info;
use std::thread;
use crate::ipv4_gen;
use crate::permutations;
async fn check_ack(dest: &SocketAddr) -> bool {
if let Ok(res) = TcpStream::connect(dest) {
info!("Got TCP ack from: {:?}", dest);
return true;
}
return false;
false
}
pub fn start_scan(depth: u32) {
let threads: Vec<JoinHandle<()>> = Vec::new();
let mut threads: Vec<JoinHandle<()>> = Vec::new();
for i in 0..depth {
let thread = thread::spawn(|| {
println!("hi");
// do scan
});
threads.push(thread);
}
}

Loading…
Cancel
Save