catalog

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	UnixPathSeparator    = "/"
	WindowsPathSeparator = "\\"
)

Variables

View Source
var Separator = string(os.PathSeparator)

Separator evaluated at runtime

Functions

func GetFiles

func GetFiles(root string) ([]string, error)

GetFiles within a folder

func HomeDirOrDefault

func HomeDirOrDefault(defaultDirectory string) string

HomeDirectory

func IsUnixOS

func IsUnixOS() bool

func IsWindowsOS

func IsWindowsOS() bool

Types

type Catalog

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

Catalog is a poc catalog helper implementation

func New

func New(directory string) *Catalog

New creates a new Catalog structure using provided input items

func (*Catalog) GetPocPath

func (c *Catalog) GetPocPath(target string) ([]string, error)

GetPocPath parses the specified input template path and returns a compiled list of finished absolute paths to the pocs evaluating any glob patterns or folders provided as in.

func (*Catalog) GetPocsPath

func (c *Catalog) GetPocsPath(definitions []string) []string

GetPocsPath returns a list of absolute paths for the provided template list.

func (*Catalog) ResolvePath

func (c *Catalog) ResolvePath(pocName, second string) (string, error)

ResolvePath resolves the path to an absolute one in various ways.

It checks if the filename is an absolute path, looks in the current directory or checking the nuclei pocs directory. If a second path is given, it also tries to find paths relative to that second path.

type PathInfo

type PathInfo struct {
	IsAbsolute         bool
	RootPath           string
	Parts              []string
	PartsWithSeparator []string
}

PathInfo about a folder

func NewPathInfo

func NewPathInfo(path string) (PathInfo, error)

NewPathInfo returns info about a given path

func (PathInfo) MeshWith

func (pathInfo PathInfo) MeshWith(anotherPath string) ([]string, error)

MeshWith combine all values from Path with another provided path

func (PathInfo) Paths

func (pathInfo PathInfo) Paths() ([]string, error)

Returns all possible combination of the various levels of the path parts

Jump to

Keyboard shortcuts

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