poke

package module
v0.0.0-...-0bf2aa0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2016 License: MIT Imports: 7 Imported by: 0

README

This is a port scanner that I wrote for fun. The primary design goal here is simplicity. Currently, it has the following features:

  • Scan a hostname or IP
  • Use goroutines to scan
  • Supports IPv6
  • Tries to guess service names (using a library that I wrote)

Caveats

  • UDP support is not fully implemented yet
  • TCP SYN and UDP scans use raw sockets, so these modes need root permission
  • CLI error reporting has not been tested well

Usage

Since this uses goroutines, the host system might run out of file descriptors. Please increase ulimit.

ulimit -n 100000

Scanning a single IP

# ./poke -host 159.203.228.218 -ports 1:65535 -scanner s
Scanning 159.203.228.239...
5672/tcp open amqp
80/tcp open http
3306/tcp open mysql
3260/tcp open iscsi-target
22/tcp open ssh
4369/tcp open epmd
5000/tcp: open
53/tcp open domain
35357/tcp: open
37729/tcp: open

Scanning a host

# ./poke -host google.com -ports 1:100 -scanner s
Scanning 216.58.192.14...
80/tcp open http

Scanning a CIDR

# ./poke -host 159.203.228.239/30 -ports 1:100 -scanner s
Scanning 159.203.228.236...
80/tcp open http
22/tcp open ssh
21/tcp open fsp
Scanning 159.203.228.237...
22/tcp open ssh
80/tcp open http
Scanning 159.203.228.238...
80/tcp open http
Scanning 159.203.228.239...
22/tcp open ssh
80/tcp open http
53/tcp open domain

IPv6 scanning

# ./poke -host 2604:a880:1:20::9f9:9001 -ports 1:100 -scanner s
Scanning 2604:a880:1:20::9f9:9001...
53/tcp open domain
22/tcp open ssh
80/tcp open http

Developing

This uses glide to manage packages. The update makefile target installs and gets all dependencies if they are not present. Tests can be run by:

make test

Building

make build

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortRange

type PortRange struct {
	Start uint64
	End   uint64
}

Represents a range of ports

func (*PortRange) String

func (pr *PortRange) String() string

type ScanResult

type ScanResult struct {
	Port    uint64
	Success bool // True if the port is open
	Err     error
}

Container for scan results from workers

type Scanner

type Scanner interface {
	Scan() *ScanResult
}

An interface for all the scanners

func NewTcpConnectScanner

func NewTcpConnectScanner(host string, port uint64, ipver bool) Scanner

func NewTcpSynScanner

func NewTcpSynScanner(host string, port uint64, ipver bool) Scanner

func NewUdpScanner

func NewUdpScanner(host string, port uint64, ipver bool) Scanner

type TcpConnectScanner

type TcpConnectScanner struct {
	Host string
	Port uint64
	Isv4 bool
}

func (TcpConnectScanner) Scan

func (tcpcs TcpConnectScanner) Scan() *ScanResult

type TcpSynScanner

type TcpSynScanner struct {
	Host   string
	Port   uint64
	IsIPv4 bool
	Conn   net.PacketConn
}

func (TcpSynScanner) Scan

func (tcpcs TcpSynScanner) Scan() *ScanResult

type UdpScanner

type UdpScanner struct {
	Host   string
	Port   uint64
	IsIPv4 bool
	Conn   net.PacketConn
}

func (UdpScanner) Scan

func (us UdpScanner) Scan() *ScanResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL