https://github.com/mlesniak/port-scanner
Port scanner in Go
https://github.com/mlesniak/port-scanner
go golang port-scanner tools unix-command
Last synced: 5 months ago
JSON representation
Port scanner in Go
- Host: GitHub
- URL: https://github.com/mlesniak/port-scanner
- Owner: mlesniak
- License: apache-2.0
- Created: 2018-02-23T05:21:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T16:20:12.000Z (over 8 years ago)
- Last Synced: 2024-06-20T12:42:18.136Z (about 2 years ago)
- Topics: go, golang, port-scanner, tools, unix-command
- Language: Go
- Size: 642 KB
- Stars: 33
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://travis-ci.org/mlesniak/port-scanner)
[](CODE_OF_CONDUCT.md)
# Overview
Implementation of a simple port scanner in Go, mirroring the output of nmap.
## Example
> port-scanner -hostname mlesniak.com -parallel 20 -port 75-85 -timeout 1
PORT STATUS SERVICE
75/tcp closed
76/tcp closed deos
77/tcp closed
78/tcp closed vettcp
79/tcp closed finger
80/tcp open www-http
81/tcp closed
82/tcp closed xfer
83/tcp closed mit-ml-dev
84/tcp closed ctf
85/tcp closed mit-ml-dev
## Help
A list of available command line options can be obtained by executing
> port-scanner -help
A simple port scanner in go.
-hostname string
hostname of the target system
-parallel int
Maximum number of parallel connections (default 1)
-port string
a single port (80) or a single range (80-1024)
-timeout float
Timeout in seconds. Fractional values, e.g. 0.5 are allowed (default 1)
## Building
To build and install port-scanner under `$GOPATH` you have to
git clone git@github.com:mlesniak/port-scanner.git
go install
We use [go-bindata](https://github.com/a-urth/go-bindata) to embed files in `data/`, hence to build
`bindata.go`, you have to
go-bindata data/
If you have not installed `go-bindata`, use
go get -u github.com/a-urth/go-bindata/...
beforehand.
To reduce the file size, use [upx](https://upx.github.io/) and
go build && strip port-scanner && upx -9 port-scanner
to create a 1MB single static file, e.g. for using it in docker containers.
### Build with Docker
Building port-scanner with Docker is simple
git clone git@github.com:mlesniak/port-scanner.git
cd port-scanner
docker build -t port-scanner .
docker run --rm port-scanner -hostname mlesniak.com -parallel 20 -port 75-85 -timeout 1
To export the static binary simply run
docker run --rm --entrypoint="" port-scanner cat /usr/local/bin/port-scanner > port-scanner
## Limitations
While this application is feature complete for my usages, the following limitations apply:
- Scanning of TCP ports only.
- Service list maps only single range ports, i.e. xwindow's definition from 6000-6003 is currently not correctly mapped
If these limitations annoy you, either fix this yourself and write a pull request :-) or open an issue.
## Organization
A Trello Board can be found [here](https://trello.com/b/opzPa3fd/port-scanner).
## License
The source code is licensed under the [Apache license](https://raw.githubusercontent.com/mlesniak/port-scanner/master/LICENSE)