netscan

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package netscan provides functionality for running network enumeration scans. currently the scanner provides two modes:

ModeHTTP: useful when the services needing enumeration are HTTP servers, and a traditional portscan would fail

ModeTCP: a traditional portscan using DialWithTimeout. this performs a full-connect scan of the target.

Index

Constants

View Source
const (
	/* ModeHTTP refers to a scanning mode that uses HTTP requests/responses
	   to determine if a port is open and serving HTTP content, useful in a
	   situation (like we've run into here) where an IP may report all ports
	   open, but you are interested in locating particular HTTP service.
	*/
	ModeHTTP = "http"

	/* ModeTCP refers to a more traditional mode of port scan that uses tcp
	   connections to determine if a port is open
	*/
	ModeTCP = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string

Mode is a string alias to refer to the currently supported scanner modes

type Option

type Option func(*ScanJob)

Option is a type alias for a function that takes a ScanJob reference and modifies it

func WithTLS

func WithTLS() Option

WithTLS returns a function that modifies the referenced scanner to enable TLS

type ScanJob

type ScanJob struct {
	// contains filtered or unexported fields
}

ScanJob describes a run of a particular scanner. jobs can consist of multiple

hosts and ports and will produce a scan of all combinations.

func New

func New(mode Mode, hosts []string, ports []string, opts ...Option) (*ScanJob, error)

New returns a *ScanJob configured with a list of hosts, ports, and any

additional options. for synchronization, a semaphore is initialized with the
value 256, which is intended to govern the number of open file handles that a
scanner can make at a time. this value was chosen by running a ulimit command
on a macbook, and seemed okay to us...

func (*ScanJob) Scan

func (s *ScanJob) Scan(timeout time.Duration) chan string

Scan executes the defined scan job, iterating over all hosts/port

combinations and attempting to connect to them using the defined scan mode.
it returns results over a string channel.

type Scanner

type Scanner interface {
	/* Scan accepts an address in the format of <host>:<port> and returns
	   whether or not that port is open. the method by which it determines
	   this is up to the implementation of the interface.
	*/
	Scan(addr string, timeout time.Duration) bool
}

Scanner provides an abstraction for various network scanning methods.

Jump to

Keyboard shortcuts

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