cvebaser

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 17 Imported by: 0

README

cvebaser Go Report

cvebaser is a tool for interacting with cvebase/cvebase.com data, built in Go.

Install

cvebaser requires go1.15+ for installation.

GO111MODULE=on go get -u -v github.com/cvebase/cvebaser/cmd/cvebaser

Usage

Lint all files:

cvebaser lint -r <path to cvebase.com repo>

Lint files from a specific commit:

cvebaser lint -r <path to cvebase.com repo> -c <git commit hash>

Export all cvebase PoCs to json file:

cvebaser export -r <path to cvebase.com repo> -o pocs.json

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CVESubPath

func CVESubPath(cveID string) (string, error)

CVESubPath converts a CVE ID to cve relative path starting with year subdirectory

func CompileToFile

func CompileToFile(
	f *os.File,
	path string,
	t interface{},
) error

func CvebaseURL

func CvebaseURL(cveID string) string

func DirExists

func DirExists(path string) (bool, error)

DirExists checks if a path exists and is a directory.

func Exists

func Exists(path string) (bool, error)

Exists check if a file or directory exists.

func ParseMDFile

func ParseMDFile(r io.Reader, tPtr interface{}) error

ParseMDFile reads markdown file contents containing YAML and markdown and returns either CVE or Researcher data struct

func PathIsType

func PathIsType(p string) (string, error)

PathIsType returns either "cve" or "researcher" based on directory structure of given relative path to cve or researcher file

func ResearcherSubPath

func ResearcherSubPath(rAlias string) string

func SortUniqStrings

func SortUniqStrings(inSlice []string) []string

SortUniqStrings sorts and removes duplicates of a string slice

func UniqStrings

func UniqStrings(s []string) []string

UniqStrings improves implementation of removeDuplicates avoids the excess work done by your use of append to remove elements

func WantPath

func WantPath(p string) (string, error)

WantPath attempts to repair a provided cve or researcher filepath for cases where the file was linted and moved in a later commit. Returns a relative path to cve or researcher file.

Types

type CVE

type CVE struct {
	CVEID    string   `json:"-" yaml:"id"`
	Pocs     []string `json:"pocs,omitempty" yaml:"pocs,omitempty"`
	Courses  []string `json:"courses,omitempty" yaml:"courses,omitempty"`
	Writeups []string `json:"writeups,omitempty" yaml:"writeups,omitempty"`
	Advisory string   `json:"advisory,omitempty" yaml:"-"`
}

func ParseCVEMDFile

func ParseCVEMDFile(reader io.Reader) (cve CVE, err error)

ParseCVEMDFile reads markdown file contents containing YAML and markdown and returns CVE data struct

type GitOpts

type GitOpts struct {
	Clone bool
	Pull  bool
}

type Repo

type Repo struct {
	DirPath string
	// contains filtered or unexported fields
}

func NewRepo

func NewRepo(p string, g *GitOpts) (*Repo, error)

func (*Repo) CheckFilenamesFromCommit

func (r *Repo) CheckFilenamesFromCommit(h string) ([]string, error)

func (*Repo) GetFullPath

func (r *Repo) GetFullPath(p string) string

GetFullPath converts relative file path to full path including the base directory

func (*Repo) ScanCVE

func (r *Repo) ScanCVE(ctx context.Context) (<-chan CVE, <-chan error)

ScanCVE returns a channel of all CVE objects in the repo. A buffered error channel returns any errors encountered during the dirwalk.

func (*Repo) ScanTree

func (r *Repo) ScanTree(done <-chan struct{}, subDir string, fileExt string) (<-chan string, <-chan error)

ScanTree generates a channel of filepaths from sub-directory in the repo, filtering paths with provided file extension e.g. `.md`. A buffered error channel returns any errors encountered during the dirwalk.

type Researcher

type Researcher struct {
	Name        string   `json:"name" yaml:"name"`
	Alias       string   `json:"alias" yaml:"alias"`
	Nationality string   `json:"nationality" yaml:"nationality,omitempty"`
	Website     string   `json:"website" yaml:"website,omitempty"`
	Twitter     string   `json:"twitter" yaml:"twitter,omitempty"`
	Github      string   `json:"github" yaml:"github,omitempty"`
	Linkedin    string   `json:"linkedin" yaml:"linkedin,omitempty"`
	Hackerone   string   `json:"hackerone" yaml:"hackerone,omitempty"`
	Bugcrowd    string   `json:"bugcrowd" yaml:"bugcrowd,omitempty"`
	CVEs        []string `json:"cves" yaml:"cves"`
	Bio         string   `json:"bio" yaml:"-"`
}

func ParseResearcherMDFile

func ParseResearcherMDFile(reader io.Reader) (researcher Researcher, err error)

ParseResearcherMDFile reads markdown file contents containing YAML and markdown and returns Researcher data struct

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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