targetgeneration

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TopTCPPorts = [...]uint16{} /* 8330 elements not displayed */

TopTCPPorts contains a static list of top TCP ports as contained in nmap 7.70 The list is created via sort -r -k3 /usr/share/nmap/nmap-services | grep tcp | awk '{split($2, splitted, "/"); print splitted[1]}'

View Source
var TopUDPPorts = [...]uint16{} /* 19050 elements not displayed */

TopUDPPorts contains a static list of top UDP ports as contained in nmap 7.70, generated the same way as TCP ports

Functions

func GenerateIPStreamFromCIDR

func GenerateIPStreamFromCIDR(ipnet *net.IPNet, blacklist *NrayBlacklist) <-chan net.IP

GenerateIPStreamFromCIDR uses the ZMap algorithm to expand a CIDR network. A blacklist may be specified and hosts contained in there are omitted. Returns a stream of hosts, which is closed when the network has been completely expanded.

func GeneratePortStream

func GeneratePortStream(ports []uint16) <-chan uint16

GeneratePortStream takes a list of ports and returns them in arbitrary order over a channel

func GetNmapTopTCPPorts

func GetNmapTopTCPPorts(topN uint) []uint16

GetNmapTopTCPPorts returns an array containing the topN TCP ports

func GetNmapTopUDPPorts

func GetNmapTopUDPPorts(topN uint) []uint16

GetNmapTopUDPPorts returns an array containing the topN UDP ports

func ParsePorts

func ParsePorts(rawPorts []string, proto string) []uint16

ParsePorts takes the a list of target strings supplied by the user and tries to parse them into a slice of uint32s Errors are sent back over errorChan

Types

type AnyTargets

type AnyTargets struct {
	RemoteHosts []string
	TCPPorts    []uint32
	UDPPorts    []uint32
}

AnyTargets is the most abstract type holding information regarding targets. Any number of hosts, networks, ports etc. is allowed

func (*AnyTargets) TargetCount added in v1.1.0

func (at *AnyTargets) TargetCount() uint64

TargetCount returns the number of targets, meaning individual ports on individual systems

type NrayBlacklist

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

NrayBlacklist allows to add/query ip/net/dns blacklisted items

func NewBlacklist

func NewBlacklist() *NrayBlacklist

NewBlacklist returns a new blacklist

func (*NrayBlacklist) AddDNSNameToBlacklist

func (blacklist *NrayBlacklist) AddDNSNameToBlacklist(dnsName string)

AddDNSNameToBlacklist adds a FQDN to the blacklist

func (*NrayBlacklist) AddNetToBlacklist

func (blacklist *NrayBlacklist) AddNetToBlacklist(network string)

AddNetToBlacklist adds a CIDR network range to the blacklist <ip>/32 achieves the same for a single IP

func (*NrayBlacklist) AddToBlacklist

func (blacklist *NrayBlacklist) AddToBlacklist(element string) uint64

AddToBlacklist can be used if the type of the element is unclear

func (*NrayBlacklist) IsDNSNameBlacklisted

func (blacklist *NrayBlacklist) IsDNSNameBlacklisted(dnsName string) bool

IsDNSNameBlacklisted returns true if a given DNS name is blacklisted

func (*NrayBlacklist) IsIPBlacklisted

func (blacklist *NrayBlacklist) IsIPBlacklisted(ip string) bool

IsIPBlacklisted returns true if the given IP is contained in a network in the blacklist

type TargetGenerator

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

TargetGenerator is the type that unifies all backends and provides central access to all generated targets

func (*TargetGenerator) GetTargetChan

func (tg *TargetGenerator) GetTargetChan() <-chan AnyTargets

GetTargetChan is used to expose a read-only channel to the core

func (*TargetGenerator) Init

func (tg *TargetGenerator) Init(config *viper.Viper)

Init takes the target generation subtree of the configuration and sets up the TargetGenerator to receive targets from

func (*TargetGenerator) TargetCount added in v1.1.0

func (tg *TargetGenerator) TargetCount() uint64

TargetCount returns the total target count of this target generator.

Jump to

Keyboard shortcuts

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