Documentation ¶
Index ¶
- Variables
- type AsyncScanner
- type BandwidthUnit
- type BlockingScanner
- type InitOption
- type LogLine
- type Option
- func WithBandwidth(bandwidth string, unit BandwidthUnit) Option
- func WithBlacklistFile(blacklistFile string) Option
- func WithConfigFile(configFile string) Option
- func WithCooldownTime(cooldown string) Option
- func WithCores(cores []string) Option
- func WithCustomArguments(args ...string) Option
- func WithDisableSyslog() Option
- func WithDryrun() Option
- func WithGatewayMAC(gatewayMAC string) Option
- func WithIgnoreInvalidHosts() Option
- func WithInterface(ifa string) Option
- func WithLogDirectory(logDirectory string) Option
- func WithLogFile(logFile string) Option
- func WithMaxResults(maxResults string) Option
- func WithMaxRetries(maxRetries string) Option
- func WithMaxRuntime(maxRuntime string) Option
- func WithMaxSendtoFailures(maxSendtoFailures string) Option
- func WithMaxTargets(maxTarget string, isPercentage bool) Option
- func WithMetadataFile(metadataFile string) Option
- func WithMinHitrate(minHitrate string) Option
- func WithNotes(notes string) Option
- func WithNumberOfProbesPerIP(numberOfProbes string) Option
- func WithOutputArgs(outputArgs string) Option
- func WithOutputFields(fields []string) Option
- func WithOutputFile(outputFile string) Option
- func WithOutputFilter(outputFilter string) Option
- func WithOutputModule(outputModule string) Option
- func WithProbeArgs(probeArgs string) Option
- func WithProbeModule(probeModule string) Option
- func WithQuiet() Option
- func WithRate(rate string) Option
- func WithSeed(seed string) Option
- func WithSenderThreads(senderThreads string) Option
- func WithShardID(shardID string) Option
- func WithSourceIP(sourceIP string) Option
- func WithSourceMAC(sourceMAC string) Option
- func WithSourcePort(sourcePort string) Option
- func WithStatusUpdatesFile(statusUpdateFile string) Option
- func WithTargetPort(targetPort string) Option
- func WithTargets(targets ...string) Option
- func WithTotalShards(shards string) Option
- func WithUserMetadata(userMetadata string) Option
- func WithVPN() Option
- func WithVerbosity(verbosityLevel VerbosityLevel) Option
- func WithWhitelistFile(whitelistFile string) Option
- type OutputField
- type VerbosityLevel
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNmapNotInstalled means that upon trying to manually locate zmap in the user's path, // it was not found. Either use the WithBinaryPath method to set it manually, or make sure that // the nmap binary is present in the user's $PATH. ErrZmapNotInstalled = errors.New("zmap binary was not found") // ErrScanTimeout means that the provided context was done before the scanner finished its scan. ErrScanTimeout = errors.New("zmap scan timed out") )
Functions ¶
This section is empty.
Types ¶
type AsyncScanner ¶
type AsyncScanner interface { AddOptions(options ...Option) error RunAsync() error Wait() error GetTraceMessages() []LogLine GetDebugMessages() []LogLine GetWarningMessages() []LogLine GetInfoMessages() []LogLine GetFatalMessages() []LogLine GetResults() []map[string]interface{} ListProbeModules() ([]string, error) ListOutputModules() ([]string, error) ListOutputFields() ([]OutputField, error) GetVersion() (string, error) }
func NewAsyncScanner ¶
func NewAsyncScanner(initOptions ...InitOption) (AsyncScanner, error)
type BandwidthUnit ¶
type BandwidthUnit string
var ( UnitBandwidthBps BandwidthUnit = "B" UnitBandwidthKbps BandwidthUnit = "K" UnitBandwidthMbps BandwidthUnit = "M" UnitBandwidthGbps BandwidthUnit = "G" )
type BlockingScanner ¶
type BlockingScanner interface { AddOptions(options ...Option) error RunBlocking() (results []map[string]interface{}, traces []LogLine, debugs []LogLine, warnings []LogLine, infos []LogLine, fatals []LogLine, err error) ListProbeModules() ([]string, error) ListOutputModules() ([]string, error) ListOutputFields() ([]OutputField, error) GetVersion() (string, error) }
func NewBlockingScanner ¶
func NewBlockingScanner(initOptions ...InitOption) (BlockingScanner, error)
Creates new Scanner Interface
type InitOption ¶
type InitOption func(*scanner) error
InitOptions is initialization option for the Scanner. Ex: WithBinaryPath, WithContext..
func WithBinaryPath ¶
func WithBinaryPath(binaryPath string) InitOption
WithBinaryPath sets the zmap binary path for a scanner
func WithContext ¶
func WithContext(ctx context.Context) InitOption
WithContext adds a context to a scanner, to make it cancellable and able to use timeout.
type Option ¶
type Option func(*scanner) error
Options is a function that is used for grouping of Scanner options. Option adds or remove zmap command line arguments.
func WithBandwidth ¶
func WithBandwidth(bandwidth string, unit BandwidthUnit) Option
WithBandwidth sets the bandwidth to give to zmap binary. It supports B, K, M and G suffixes. This option overrides --rate flag.
func WithBlacklistFile ¶
WithBlacklistFile sets the blacklist file name to give to the zmap binary. If you are not passing this option, Zmap will use default blacklist file in "/usr/local/etc/zmap/blacklist.conf".
func WithConfigFile ¶
WithConfigFile sets the config file to give to zmap binary. Read a configuration file, which can specify any of these options (default=`/usr/local/etc/zmap/zmap.conf')
func WithCooldownTime ¶
WithCooldownTime sets the cooldown to give to zmap binary. How long to continue receiving after sending last probe (default=`8')
func WithCores ¶
WithCores sets the cores to give to zmap binary. Comma-separated list of cores to pin to
func WithCustomArguments ¶
WithCustomArguments sets custom arguments to give to the zmap binary. There should be no reason to use this, unless you are using a custom build of zmap or that this repository isn't up to date with the latest options of the official zmap release.
func WithDisableSyslog ¶
func WithDisableSyslog() Option
WithDisableSyslog sets the disable syslog to give to zmap binary. Disables logging messages to syslog
func WithDryrun ¶
func WithDryrun() Option
WithDryrun sets the dryrun to give to zmap binary. Don't actually send packets
func WithGatewayMAC ¶
WithGatewayMAC sets the gateway mac to give to zmap binary. Specify gateway MAC address
func WithIgnoreInvalidHosts ¶
func WithIgnoreInvalidHosts() Option
WithIgnoreInvalidHosts sets the ignore invalid hosts to give to zmap binary. Ignore invalid hosts in whitelist/blacklist file
func WithInterface ¶
WithInterface sets the interface to give to zmap binary. Specify network interface to use
func WithLogDirectory ¶
WithLogDirectory sets the log directory to give to zmap binary. Write log entries to a timestamped file in this directory
func WithLogFile ¶
WithLogFile sets the log file to give to zmap binary. Write log entries to file
func WithMaxResults ¶
WithMaxResults set the max results to give to zmap binary.
func WithMaxRetries ¶
WithMaxRetries sets the retries to give to zmap binary. Max number of times to try to send packet if send fails (default=`10')
func WithMaxRuntime ¶
WithMaxRuntime sets the max runtime to give to zmap binary.
func WithMaxSendtoFailures ¶
WithMaxSendtoFailures sets the max sendto failures to give to zmap binary. Maximum NIC sendto failures before scan is aborted (default=`-1')
func WithMaxTargets ¶
WithMaxTargets sets the max targets to give to zmap binary.
func WithMetadataFile ¶
WithMetadataFile sets the metadata file to give to zmap binary. Output file for scan metadata (JSON)
func WithMinHitrate ¶
WithMinHitrate sets the min hitrate to give to zmap binary. Minimum hitrate that scan can hit before scan is aborted (default=`0.0')
func WithNotes ¶
WithNotes sets the notes to give to zmap binary. Inject user-specified notes into scan metadata
func WithNumberOfProbesPerIP ¶
WithNumberOfProbesPerIP set the probes to give to zmap binary.
func WithOutputArgs ¶
WithOutputArgs sets the output args to give to zmap binary. Arguments to pass to output module
func WithOutputFields ¶
WithOutputFields sets the output fields to give to zmap binary. Fields that should be output in result set
func WithOutputFile ¶
WithOutputFile sets the output file name to give to the zmap binary. If you are not passing this option, We will use "-" as value to read from stdout by default.
func WithOutputFilter ¶
WithOutputFilter sets the output filter to give to zmap binary. Specify a filter over the response fields to limit what responses get sent to the output module
func WithOutputModule ¶
WithOutputModule sets the output module to give to zmap binary. Select output module (default=`default')
func WithProbeArgs ¶
WithProbeArgs sets the probe args to give to zmap binary. Arguments to pass to probe module
func WithProbeModule ¶
WithProbeModule sets the probe module to give to zmap binary. Select probe module (default=`tcp_synscan')
func WithQuiet ¶
func WithQuiet() Option
WithQuiet sets the quiet to give to zmap binary. Do not print status updates
func WithSeed ¶
WithSeed sets the seed to give to zmap binary. Seed used to select address permutation
func WithSenderThreads ¶
WithSenderThreads sets the sender threads to give to zmap binary. Threads used to send packets (default=`1')
func WithShardID ¶
WithShardID sets the shard to give to zmap binary. Set which shard this scan is (0 indexed) (default=`0')
func WithSourceIP ¶
WithSourceIP sets the source ip to give to zmap binary. Source address(es) for scan packets Can be one ip (192.168.1.1) or ip range (Ex: 192.168.1.1-192.168.1.5)
func WithSourceMAC ¶
WithSourceMAC sets the source mac to give to zmap binary. Source MAC address
func WithSourcePort ¶
WithSourcePort sets the source port to give to zmap binary. Source port(s) for scan packets Can be one port (50000) or port range (Ex: 50000-50010)
func WithStatusUpdatesFile ¶
WithStatusUpdatesFile sets the status updates file to give to zmap binary. Write scan progress updates to CSV file
func WithTargetPort ¶
WithTargetPort sets the target port to give to the zmap binary. This is required option. And should be used for ones. Zmap does not support multiple ports
func WithTargets ¶
WithTargets sets the target informations to give to the zmap binary. Targets can be ip address or cidr notation
func WithTotalShards ¶
WithTotalShards sets the shards to give to zmap binary. Set the total number of shards (default=`1')
func WithUserMetadata ¶
WithUserMetadata sets the user metadata to give to zmap binary. Inject user-specified JSON metadata into scan metadata
func WithVPN ¶
func WithVPN() Option
WithVPN sets the vpn to give to zmap binary. Sends IP packets instead of Ethernet (for VPNs)
func WithVerbosity ¶
func WithVerbosity(verbosityLevel VerbosityLevel) Option
WithVerbosity sets the verbosity to give to zmap binary. Level of log detail (0-5) (default=`3')
func WithWhitelistFile ¶
WithWhitelistFile sets the whitelist file name to give to the zmap binary.
type OutputField ¶
type VerbosityLevel ¶
type VerbosityLevel string
var ( VerbosityLevel1 VerbosityLevel = "1" VerbosityLevel2 VerbosityLevel = "2" VerbosityLevel3 VerbosityLevel = "3" VerbosityLevel4 VerbosityLevel = "4" VerbosityLevel5 VerbosityLevel = "5" )