portscanner

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const SOCKFMT = "/opt/scanner/%s/executor.sock"

SOCKFMT is the unix domain socket to bind to

Variables

This section is empty.

Functions

func CreateSequence

func CreateSequence(ip net.IP, port uint32) uint32

Types

type Executor

type Executor interface {
	Init(config []byte) error
	PortScan(ctx context.Context, targetIP string, packetsPerSecond int, ports []int32) (*ScanResults, error)
}

type LocalClient

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

func NewLocalClient

func NewLocalClient() *LocalClient

func (*LocalClient) Init

func (e *LocalClient) Init(config []byte) error

Init the scanner (config not used atm)

func (*LocalClient) PortScan

func (e *LocalClient) PortScan(ctx context.Context, targetIP string, packetsPerSecond int, ports []int32) (*ScanResults, error)

type ScanResults

type ScanResults struct {
	Open   []int32 `json:"open"`
	Closed []int32 `json:"closed"`
}

type Scanner

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

func New

func New() *Scanner

New returns a new scanner with a default timeout of 1 minute after send completion

func NewWithMAC

func NewWithMAC(srcMac, dstMac net.HardwareAddr, device, srcIP string) *Scanner

NewWithMAC builds a new scanner with provided src/dst macs for routing with a default timeout of 1 minute after send completion

func (*Scanner) Init

func (s *Scanner) Init() error

Init the scanner with the provided device

func (*Scanner) ScanIPv4

func (s *Scanner) ScanIPv4(ctx context.Context, targetIP string, packetsPerSecond int, ports []int32) (*ScanResults, error)

ScanIPv4 scans an IPv4 address

func (*Scanner) SetTimeout

func (s *Scanner) SetTimeout(timeout time.Duration)

SetTimeout for when to shutdown the pcap handle after send completes (default is 1 minute or if all ports respond)

type Service

type Service struct {
	Env  string
	Sock string
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func (*Service) Init

func (s *Service) Init(env string) error

func (*Service) Scan

func (s *Service) Scan(w http.ResponseWriter, r *http.Request)

func (*Service) Serve

func (s *Service) Serve() error

func (*Service) Shutdown

func (s *Service) Shutdown()

type SocketClient

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

SocketClient portscans by calling over domain socket

func NewSocketClient

func NewSocketClient(env string) *SocketClient

NewSocketClient builds a client to the socket server to issue port scan requests

func (*SocketClient) Init

func (e *SocketClient) Init(config []byte) error

Init the scanner (config not used atm)

func (*SocketClient) PortScan

func (e *SocketClient) PortScan(ctx context.Context, targetIP string, packetsPerSecond int, ports []int32) (*ScanResults, error)

PortScan by calling the socket server to scan for us, marshal results and return

Jump to

Keyboard shortcuts

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