The script's main objective is to check if ports from a given IP address are open.
Script follows these steps
- Checking if variables are properly used.
- Creating function
scan_portwithtimeout 1 bash -c "echo > /dev/tcp/$host/$port" 2>/dev/null, which avoid dependence on external tools. - Scanning from start port to end port with
scan_portfunction and displaying which ports are open.
- Clone the repository:
git clone - Make the script executable:
chmod +x port_scanner.sh - Run the script:
./port_scanner<target_ip_address> <starting_port> <end_port>
To make the script available system-wide, move it to your local binary directory, e.g.:
e.g. mv port_scanner.sh /usr/local/bin/portscanner
- Linux OS
- Bash
- Save scan results to a text file.