nerve Crates.io License

Security scan library with the aim of being lightweight and fast.
nerve provides a cross-platform API for network / security scan using Rust.
It is currently in alpha stage.

Features

Usage

Example

Add some crate to your dependencies: ```toml nerve = "0.1"

For host scan example

ipnet = "2.3"

For uri scan example

tokio = { version = "0.2", features = ["full"] } ```

PORT SCAN
In this example, target ports are 1 to 1000. rust extern crate nerve; use nerve::PortScanner; use nerve::PortScanType; fn main() { let mut port_scanner = match PortScanner::new(None, None){ Ok(scanner) => (scanner), Err(e) => panic!("Error creating scanner: {}", e), }; port_scanner.set_target_ipaddr("192.168.1.92"); port_scanner.set_range(1, 1000); port_scanner.set_scan_type(PortScanType::SynScan); port_scanner.run_scan(); let result = port_scanner.get_result(); println!("Open Ports:"); for port in result.open_ports { println!("{}", port); } println!("Scan Time: {:?}", result.scan_time) }

HOST SCAN
In this example, targeting a host address in the network. ```rust extern crate nerve; use nerve::HostScanner; use std::net::Ipv4Addr; use ipnet::Ipv4Net;

fn main(){ let mut portscanner = match HostScanner::new(){ Ok(scanner) => (scanner), Err(e) => panic!("Error creating scanner: {}", e), }; //Get network address let net: Ipv4Net = Ipv4Net::new(Ipv4Addr::new(192, 168, 1, 2), 24).unwrap(); asserteq!(Ok(net.network()), "192.168.1.0".parse()); let nwaddr = Ipv4Net::new(net.network(), 24).unwrap(); //Get host list let hosts: Vec = nwaddr.hosts().collect(); for host in hosts{ portscanner.addipaddr(&host.tostring()); } portscanner.runscan(); let result = portscanner.getresult(); println!("Up Hosts:"); for host in result.uphosts { println!("{}", host); } println!("Scan Time: {:?}", result.scan_time); } ```

URI SCAN
In this example, common.txt is used as the word list. ```rust extern crate nerve; use nerve::UriScanner; use tokio; use std::fs::readtostring;

[tokio::main]

async fn main(){ let mut uriscanner = match UriScanner::new(){ Ok(scanner) => (scanner), Err(e) => panic!("Error creating scanner: {}", e), }; let baseuri = String::from("http://192.168.1.18/xvwa/"); uriscanner.setbaseuri(baseuri); let data = readtostring("common.txt"); let text = match data { Ok(content) => content, Err(e) => {panic!("Could not open or find file: {}", e);} }; let wordlist: Vec<&str> = text.trim().split("\n").collect(); for word in wordlist { uriscanner.addword(word.tostring()); } uriscanner.runscan().await; let result = uriscanner.getresult(); println!("URI Scan Result:"); for (uri, status) in result.responses { println!("{} {}", uri, status); } println!("Scan Time: {:?}", result.scantime); } ```

Supported platform

Additional Notes

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