Expand description
A Rust Library about Cybersecurity.
§SYN Port Scan Example
use pistol::Host;
use pistol::Target;
use pistol::scan::tcp_syn_scan;
use std::net::Ipv4Addr;
use std::time::Duration;
fn main() {
// When using scanning, please use a real local address to get the return packet.
// And for flood attacks, please consider using a fake address.
// If the value here is None, the programme will automatically look up the available addresses from the existing interfaces on the device.
let src_ipv4 = None;
// If the value of `source port` is `None`, the program will generate the source port randomly.
let src_port = None;
// The destination address is required.
let dst_ipv4 = Ipv4Addr::new(192, 168, 1, 51);
let timeout = Some(Duration::new(3, 0));
// Test with an open port `22` and a closed port `99`.
let host = Host::new(dst_ipv4.into(), Some(vec![22, 99]));
// Users should build the `target` themselves.
let target = Target::new(vec![host]);
// Number of tests
let tests = 4;
let threads_num = Some(8);
let ret = tcp_syn_scan(
&target,
threads_num,
src_ipv4,
src_port,
timeout,
tests
).unwrap();
println!("{}", ret);
}
Re-exports§
pub use scan::arp_scan;
pub use scan::arp_scan_raw;
pub use scan::scan;
pub use scan::scan_raw;
pub use scan::tcp_ack_scan;
pub use scan::tcp_ack_scan_raw;
pub use scan::tcp_connect_scan;
pub use scan::tcp_connect_scan_raw;
pub use scan::tcp_fin_scan;
pub use scan::tcp_fin_scan_raw;
pub use scan::tcp_idle_scan;
pub use scan::tcp_idle_scan_raw;
pub use scan::tcp_maimon_scan;
pub use scan::tcp_maimon_scan_raw;
pub use scan::tcp_null_scan;
pub use scan::tcp_null_scan_raw;
pub use scan::tcp_syn_scan;
pub use scan::tcp_syn_scan_raw;
pub use scan::tcp_window_scan;
pub use scan::tcp_window_scan_raw;
pub use scan::tcp_xmas_scan;
pub use scan::tcp_xmas_scan_raw;
pub use scan::udp_scan;
pub use scan::udp_scan_raw;
pub use ping::icmp_ping;
pub use ping::icmp_ping_raw;
pub use ping::ping;
pub use ping::tcp_ack_ping;
pub use ping::tcp_ack_ping_raw;
pub use ping::tcp_syn_ping;
pub use ping::tcp_syn_ping_raw;
pub use ping::udp_ping;
pub use ping::udp_ping_raw;
pub use flood::flood;
pub use flood::flood_raw;
pub use flood::icmp_flood;
pub use flood::icmp_flood_raw;
pub use flood::tcp_ack_flood;
pub use flood::tcp_ack_flood_raw;
pub use flood::tcp_ack_psh_flood;
pub use flood::tcp_ack_psh_flood_raw;
pub use flood::tcp_syn_flood;
pub use flood::tcp_syn_flood_raw;
pub use flood::udp_flood;
pub use flood::udp_flood_raw;
pub use os::os_detect;
pub use os::os_detect_raw;
pub use vs::vs_scan;
pub use vs::vs_scan_raw;
Modules§
Structs§
Constants§
Functions§
- dns_
query - Queries the IP address of a domain name and returns.