netscan Crates.io License

Cross-platform network scan library
with the aim of being lightweight and fast.

Features

Usage

Add netscan to your dependencies
toml:Cargo.toml [dependencies] netscan = "0.1.0"

Example

Port Scan Example ```rust extern crate netscan; use netscan::PortScanner; use netscan::PortScanType; use netscan::ScanStatus; use std::time::Duration;

fn main() { let mut portscanner = match PortScanner::new(None) { Ok(scanner) => (scanner), Err(e) => panic!("Error creating scanner: {}", e), }; portscanner.settargetipaddr("192.168.1.8"); portscanner.setrange(1, 1000); //portscanner.addtargetport(22); //portscanner.addtargetport(80); //portscanner.addtargetport(443); portscanner.setscantype(PortScanType::SynScan); portscanner.settimeout(Duration::frommillis(10000)); //portscanner.setwaittime(Duration::frommillis(100)); portscanner.runscan(); let result = portscanner.getresult(); print!("Status: "); match result.scanstatus { ScanStatus::Done => {println!("Normal end")}, ScanStatus::Timeout => {println!("Timed out")}, _ => {println!("Error")}, } println!("Open Ports:"); for port in result.openports { println!("{}", port); } println!("Scan Time: {:?}", result.scantime); if portscanner.getwaittime() > Duration::frommillis(0) { println!("(Including {:?} of wait time)", portscanner.getwait_time()); } } ```

For more details see Examples

Supported platform

TODO

Additional Notes

This library requires the ability to create raw sockets. Execute with root user privileges.