goscope

package module
v0.0.0-...-bca2454 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 7 Imported by: 2

README

goscope

goscope is a lightweight Go library for managing scopes of hosts and IPv4 addresses, ideal for penetration testing tools and similar Go programs.

Installation

go get github.com/root4loot/goscope@latest

Usage

See example.go


## Contributing

Contributions to goscope are welcome. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scope

type Scope struct {
	Includes map[string]bool
	Excludes map[string]bool
	Targets  *Targets
}

Scope represents a set of includes, excludes, and targets. It must be initialized using NewScope() before use.

func NewScope

func NewScope() *Scope

NewScope returns a new Scope.

func (*Scope) AddExclude

func (s *Scope) AddExclude(targets ...string) error

AddExclude adds one or more targets to the scope's Excludes list.

func (*Scope) AddInclude

func (s *Scope) AddInclude(targets ...string) error

AddInclude adds one or more targets to the scope's Includes list.

func (*Scope) AddTargetToScope

func (s *Scope) AddTargetToScope(targets ...string) error

AddTargetToScope adds one or more targets to the scope's Targets list.

func (*Scope) GetAllTargets

func (s *Scope) GetAllTargets() (targets []string)

GetAllTargets returns all hosts as a string slice

func (*Scope) GetExcludes

func (s *Scope) GetExcludes() (excludes []string)

GetExcludes returns a string slice representation of the scope's Excludes list.

func (*Scope) GetIncludes

func (s *Scope) GetIncludes() (includes []string)

GetIncludes returns a string slice representation of the scope's Includes list.

func (*Scope) GetTargetCIDRs

func (s *Scope) GetTargetCIDRs() (cidrs []string, err error)

GetTargetsCIDR returns a string slice representation of the scope's Targets CIDR list.

func (*Scope) GetTargetDomains

func (s *Scope) GetTargetDomains() (domains []string)

GetTargetDomains returns all domains as a string slice

func (*Scope) GetTargetIPs

func (s *Scope) GetTargetIPs() (ips []string)

GetTargetIPs returns all IPs as a string slice

func (*Scope) GetTargetOther

func (s *Scope) GetTargetOther() (other []string)

GetTargetOther returns all other targets as a string slice

func (*Scope) IsTargetAdded

func (s *Scope) IsTargetAdded(target string) bool

IsTargetAdded returns true if the target is in the scope's Targets list.

func (*Scope) IsTargetExcluded

func (s *Scope) IsTargetExcluded(target string) bool

IsTargetExcluded returns true if the target is in the scope's Excludes list.

func (*Scope) IsTargetInScope

func (s *Scope) IsTargetInScope(target string) bool

IsTargetInScope returns true if the target is in the scope's Includes list and not in the Excludes list.

func (*Scope) IsTargetIncluded

func (s *Scope) IsTargetIncluded(target string) bool

IsTargetIncluded returns true if the target is in the scope's Includes list.

func (*Scope) RemoveTargetFromScope

func (s *Scope) RemoveTargetFromScope(target string) error

RemoveTargetFromScope removes a target from the scope's Targets list.

type Targets

type Targets struct {
	IPs     []string
	Domains []string
	Other   []string
}

Targets represents a set of IPs, domains, and other targets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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