Script to scan (via TCP) ports. Optional to set a range or single port and/or to show closed ports.
- you can use Python virtualenv
- Python3.x is needed
- root rights required (or via sudo)
# install needed packages
$ sudo apt install python3-pip python3-venv
# or
$ sudo pip3 install virtualenv
# create and change into Project directory
$ mkdir -p ~/Projects/TCPPortScanner && cd ~/Projects/TCPPortScanner
# create virtualenv
$ virtualenv -p python3 venv
# or
$ python3 -m venv venv
# activate virtualenv
$ . venv/bin/activate
# install requirements
(venv) $ pip install -r requirements.txt
# or
(venv) $ pip install scapy
# list packages (optional)
(venv) $ pip freeze
# make file executable
(venv) $ chmod u+x TCPPortScan.py
just run it...
# show help (optional)
(venv) $ sudo venv/bin/python ./TCPPortScan.py --help
# start single port scan
(venv) $ sudo venv/bin/python ./TCPPortScan.py mydomain.tld -p 80
# start single port scan and show closed
(venv) $ sudo venv/bin/python ./TCPPortScan.py mydomain.tld -p 443 --all
# start port scan of range and show closed
(venv) $ sudo venv/bin/python ./TCPPortScan.py mydomain.tld -r 22-443 --all
to interrupt press [CTRL + c]
some example from my terminal...
Start scanning port 80 on target example.com
Port 80 is open