use std::net::TcpStream;
fn tcp_scan(host: String){
for port in 1..1024{
let mut ip = String::from(&host);
ip.push_str(":");
ip.push_str(&port.to_string());
if let Ok(_) = TcpStream::connect(&ip){
println!("This {} port is open", ip);
} else {
continue;
}
}
}
fn main(){
let my_host = String::from("192.168.1.0");
tcp_scan(my_host);
}
TcpStream::connect(&ip)
} else {
println!("Could't connect to {}", ip);
continue;
}