Table of Contents
Go Port Scanner is a lightweight and extremely fast port & host scanner.
Port Scan
Host Discovery
I decided to build this port scanner using Golang because of the concurrency provided by Go. I am using goroutines to check the status of multiple ports/hosts simulatenously. This leads to higher resource efficiency and speed to complete the scan. On an average Go Port Scanner was able to get the result in 50% less time compared to Nmap's fast scan.
Instructions to set up this project in your local environment are listed down below.
- Go v1.18
https://go.dev/doc/install
- Git
https://git-scm.com/
Get the repository with go get
go get github.com/shahnitav/Go-Port-Scanner
Or get the pre-build binary from the Releases.
To build the project
- Clone the repository
git clone https://github.com/shahnitav/Go-Port-Scanner.git
- Run make
Or build the binary using
make
go build -o bin/ cmd/main.go
Target IP Address/es whose Ports need to be scanned. It can parse single IP Address for Port Scanning as well as CIDR which can be used for Host Discovery.
For example:
--ip 192.168.126.131 || --ip 192.168.126.131
Specifies the ports to be scanned for to get their status. It can be a single value, a range of values, or multiple values. Port Numbers are required for Port Scanning and will not be considered during Host Discovery.
For example:
-p 80 || --port 1-9000 || -p 80,443,21
Used to configure the timeout in Milliseconds while connecting with a Port. Not required, the default value is 500ms.
It is a flag to be passed with a Single/CIDR IP Address to scan for hosts. ICMP Mode sends ICMP Ping packets to the hosts to check their status.
For example:
./main --ip 192.168.126.0/24 -i
Shows the Help page
Go Port Scanner can be used to conduct follow tasks:
It will scan for open port 3306 on the host.
./main --ip 192.168.126.131 -p 3306
It will scan for open ports from 1-9000 and also label the common ports.
./main --ip 192.168.126.131 -p 1-9000
It will scan for multiple open ports 80,443,1202 on the host.
./main --ip 192.168.126.131 -p 80,443,1202 -t 1000
It will scan for open ports from 1-9000 and also label the common ports.
./main --ip 192.168.126.128/28 -i
- Parallel Port Scanning with Goroutines
- Host discovery with ICMP Pings
- SYN Stealth Scanning
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU License. See LICENSE
for more information.
Nitav Shah - @shah_nitav - shahnitav@gmail.com