Documentation ¶
Overview ¶
Package net is the main module to handle all network-related metadata collection actions.
It is capable of running each module individually (except port scan, which requires a ping scan), where the absense of data will simply return an empty object corresponding to that module (PingScan, HostScan, or the whole net object).
Its main focus is the Network.Build() method, responsible for queueing and orchestrating all the network-related tasks, but it also contains the PingScan.ExpandCIDR() method, which is responsible for breaking down subnets into slices of strings, for the respective hosts in it.
Index ¶
- type Alive
- type HostScan
- type Network
- type PingScan
- func (p *PingScan) Burst(mwg *sync.WaitGroup, addr []string) *PingScan
- func (p *PingScan) ExpandCIDR(target string) ([]string, error)
- func (p *PingScan) Get() []string
- func (p *PingScan) New(wg *sync.WaitGroup, ct int, t time.Duration, h string)
- func (p *PingScan) Paced(mwg *sync.WaitGroup, addr []string) *PingScan
- type PortScan
- type Scan
- type ScanResults
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostScan ¶
type HostScan struct { Target string `json:"target"` Protocol string `json:"proto"` Ports []int `json:"ports"` }
HostScan struct will contain the probe results for a single host. It will hold the target IP address, the protocol used, and the open ports in a slice of ints.
type Network ¶
type Network struct { System System `json:"sys"` Ping PingScan `json:"ping"` Ports []HostScan `json:"ports"` }
Network type will be converted to JSON containing important information for this module
type PingScan ¶
PingScan struct will contain the ping results from the last scan
func (*PingScan) Burst ¶
Burst method - will take advantage of goroutines to issue all ping requests concurrently Go will automatically manage this sequence, which is aimed for performance, not order
func (*PingScan) ExpandCIDR ¶
ExpandCIDR method - expands (simple) CIDR addresses taking the example from https://gist.github.com/kotakanbe/d3059af990252ba89a82 Fixed issue with /32 CIDR addresses
func (*PingScan) Get ¶
Get method will return the slice of addresses (strings) for all alive hosts. This is being used on the port scan routines, to skip running through all addresses again
type PortScan ¶
PortScan struct will contain the results for a single port scan. The Port key will contain an int with the port while the Open key will contain a boolean for open / closed status
type ScanResults ¶
type ScanResults struct {
Results []HostScan `json:"results"`
}
ScanResults struct will hold a list of HostScans. This is the placeholder for all host queries
func (*ScanResults) Create ¶
func (s *ScanResults) Create(mwg *sync.WaitGroup, hosts []string, scanScope int) *ScanResults
Create method will initialize a set of HostScan.New() events, based on the provided hosts, which are being fed as a slice of strings.