Back to godoc.org
github.com/adedayo/tcpscan

Package portscan

v0.5.9
Latest Go to latest

The highest tagged major version is .

Published: Jul 28, 2019 | License: BSD-3-Clause | Module: github.com/adedayo/tcpscan

Index

Variables

var (
	//TCPScanConfigPath is the default config path of the TCPScan service
	TCPScanConfigPath = filepath.Join("data", "config", "TCPScanConfig.yml")
)

func CompactDB

func CompactDB(dayPath, scanID string)

CompactDB reclaims space by pruning the database

func GetNextScanID

func GetNextScanID() string

GetNextScanID returns the next unique scan ID

func PersistScanRequest

func PersistScanRequest(psr PersistedScanRequest)

PersistScanRequest persists scan request

func PersistScans

func PersistScans(psr PersistedScanRequest, server string, scans []PortACK)

PersistScans persists the result of scans per server

func ScanCIDR

func ScanCIDR(config ScanConfig, cidrAddresses ...string) <-chan PortACK

ScanCIDR scans for open TCP ports in IP addresses within a CIDR range

func ScheduleTCPScan

func ScheduleTCPScan(ipSource func() []string)

ScheduleTCPScan runs TCPScan service scan

func Service

func Service(configPath string)

Service main service entry function

type MyPPP

type MyPPP layers.PPP

MyPPP is layers.PPP with CanDecode and other decoding operations implemented

func (*MyPPP) CanDecode

func (ppp *MyPPP) CanDecode() gopacket.LayerClass

CanDecode indicates that we can decode PPP packets

func (*MyPPP) DecodeFromBytes

func (ppp *MyPPP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes as name suggest

func (*MyPPP) LayerType

func (ppp *MyPPP) LayerType() gopacket.LayerType

LayerType -

func (*MyPPP) NextLayerType

func (ppp *MyPPP) NextLayerType() gopacket.LayerType

NextLayerType gets type

type PersistedScanRequest

type PersistedScanRequest struct {
	Request   ScanRequest
	Hosts     []string
	ScanStart time.Time
	ScanEnd   time.Time
	Progress  int
}

PersistedScanRequest persisted version of ScanRequest

func LoadScanRequest

func LoadScanRequest(dir, scanID string) (psr PersistedScanRequest, e error)

LoadScanRequest retrieves persisted scan request from folder following a layout pattern

func UnmasharlPersistedScanRequest

func UnmasharlPersistedScanRequest(data []byte) (PersistedScanRequest, error)

UnmasharlPersistedScanRequest builds PersistedScanRequest from bytes

func (PersistedScanRequest) Marshall

func (psr PersistedScanRequest) Marshall() []byte

Marshall scan request

type PortACK

type PortACK struct {
	Host string
	Port string
	RST  bool
	SYN  bool
}

PortACK describes a port with an ACK after a TCP SYN request

func (PortACK) GetServiceName

func (p PortACK) GetServiceName() string

GetServiceName returns the service name indicated by the port number

func (PortACK) IsClosed

func (p PortACK) IsClosed() bool

IsClosed determines whether the port is filtered by e.g. by a firewall

func (PortACK) IsOpen

func (p PortACK) IsOpen() bool

IsOpen determines whether the port is open or not

func (PortACK) Status

func (p PortACK) Status() string

Status is a string representation of the port status

type PortAckSorter

type PortAckSorter []PortACK

PortAckSorter sorts ack messages

func (PortAckSorter) Len

func (k PortAckSorter) Len() int

func (PortAckSorter) Less

func (k PortAckSorter) Less(i, j int) bool

func (PortAckSorter) Swap

func (k PortAckSorter) Swap(i, j int)

type ScanConfig

type ScanConfig struct {
	//How long to wait listening for TCP ACK/RST responses
	Timeout int
	//Number of Packets per Second to send out during scan
	PacketsPerSecond int
	//Should a running commentary of results be generated?
	Quiet bool
	//If not empty, indicates which network interface to use, bypassing automated guessing
	Interface string
}

ScanConfig describes details of how the port scan should be carried out

type ScanRequest

type ScanRequest struct {
	CIDRs  []string
	Config ScanConfig
	Day    string //Date the scan was run in the format yyyy-mm-dd
	ScanID string //Non-empty ScanID means this is a ScanRequest to resume an existing, possibly incomplete, scan
}

ScanRequest is a model to describe a given TLS Audit scan

func ListScans

func ListScans(rewindDays int, completed bool) (result []ScanRequest)

ListScans returns the ScanID list of persisted scans

type TCPScanConfig

type TCPScanConfig struct {
	DailySchedules   []string `yaml:"dailySchedules"` // in the format 13:45, 01:20 etc
	IsProduction     bool     `yaml:"isProduction"`
	PacketsPerSecond int      `yaml:"packetsPerSecond"`
	Timeout          int      `yaml:"timeout"`
	CIDRRanges       []string `yaml:"cidrRanges"`
}

TCPScanConfig config data structure for the scanner service

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier