:globe_with_meridians:What is tcp-scan?
A very simplistic port scanner. Enter an IP, the ports to be scanned, a timeout time, and the open ports are returned in a list.
:stars:Features
Simply scans ports for a given IP address and timeout value and returns whether they are open. Can scan an individual port, a list of ports, or a range of ports.
:pencil:Setup
Include tcp-scan under dependencies in cargo.toml. When importing the module, use tcp_scan.
Each function call needs to end with .await and run inside of an async function.
To call a function within the main() function tokio can be used as follows. In the cargo.toml file, include tokio = { version = "1.38", features = ["macros"] } under the dependencies section. Additionally, include #[tokio::main] immediately before the main() function and it will allow you to declare main() as async.
:pencil:Usage
The following are example usage calls of the port scanning functions.
// Scan an individual port to check if it is open.
// A variable of the bool data type is returned - true for open and false for not.
let is_open: bool = scan_port.await;
// Scan an array of ports to check if any of them are open.
// A variable of the Vec<u16\> data type is returned which stores the list of open ports.
let open_ports: = scan_ports_list.await;
// Scan all ports in the range from 0 to 1000 (where 1000 is included).
// A Vec<u16\> is returned.
let all_open_ports: = scan_ports_range.await;
// Scan every available port.
// A Vec<u16\> is returned.
let all_open_ports: = scan_ports_range.await;
:mag:Why use this library?
This library is meant to be used simply when one needs to know whether a singular port or number of ports are open or not. This library includes only the minimum amount of code for an implementation of this, nothing more.
If more information is needed on ports, it is recommended to use another more extensive library.
:heart:Support
You can support me or my projects by donating to my bitcoin address: bc1qfavx0pmkul0ekhywxr6xjvjdnzm7y344vhfjem.