cli
E. Almqvist 2 years ago
parent 17af660117
commit ac2352de10
  1. 3
      src/ipv4.rs
  2. 6
      src/main.rs
  3. 4
      src/scanner.rs
  4. 2
      src/util.rs

@ -22,7 +22,6 @@ impl IPv4 {
let mut base = Convert::new(10, 256);
let id_vec = util::number_to_vec(id); // push all digits into a vec
println!("########## {:?}", id_vec);
let ip = base.convert::<u8, u16>(&id_vec);
Self { id, ip }
@ -30,7 +29,7 @@ impl IPv4 {
}
pub fn ipv4(blacklist: Option<Vec<[u8; 4]>>) -> Result<Vec<[u8; 4]>> {
pub fn get_all(blacklist: Option<Vec<[u8; 4]>>) -> Result<Vec<[u8; 4]>> {
let blacklist = blacklist.unwrap_or(Vec::new());
let ips: Vec<u32> = (0..u32::max_value()).collect(); // 32 bit max value is the last IP

@ -6,12 +6,14 @@
mod util;
mod scanner;
mod permutations;
mod ipv4;
use ipv4::IPv4;
fn main() {
// scanner::start_scan(100);
// permutations::ipv4(None);
let ip = permutations::IPv4::new(256);
let ip = IPv4::new(256);
println!("{:?}", ip);
}

@ -1,7 +1,7 @@
use std::{net::{TcpStream, SocketAddr}, thread::JoinHandle};
use log::info;
use std::thread;
use crate::permutations;
use crate::ipv4;
async fn check_ack(dest: &SocketAddr) -> bool {
if let Ok(res) = TcpStream::connect(dest) {
@ -12,7 +12,7 @@ async fn check_ack(dest: &SocketAddr) -> bool {
}
pub fn start_scan(depth: u32) {
let ip_list = permutations::ipv4(None);
let ip_list = ipv4::get_all(None);
let mut threads: Vec<JoinHandle<()>> = Vec::new();

@ -33,11 +33,9 @@ pub fn number_to_vec(num: u64) -> Vec<u8> {
let mut out: Vec<u8> = Vec::new();
let len = numlen(num);
println!("len={len}");
for idx in 0..len {
let digit = digit(num, idx as u32);
println!("\t{:?}", digit);
out.push(digit);
}

Loading…
Cancel
Save