cmd

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPPrefix     = "http://"
	HTTPSPrefix    = "https://"
	ConfigFilename = "config.yaml"
)

Variables

This section is empty.

Functions

func ContainsInt added in v0.15.15

func ContainsInt(s []int, e int) bool

ContainsInt checks for ints

func Execute

func Execute()

Execute is the global command

func FileExists added in v0.15.15

func FileExists(filename string) bool

FileExists check if file exists

func FileToBase64 added in v0.15.15

func FileToBase64(filepath string) string

func FindMatchingString added in v0.15.15

func FindMatchingString(s1 string, s2 string, delim string) bool

func GenerateApiSARIF added in v0.15.15

func GenerateApiSARIF()

func GenerateComplianceSarif added in v0.15.15

func GenerateComplianceSarif(results InterceptComplianceOutput)

func GenerateSarif added in v0.15.15

func GenerateSarif(calledby string)

generates SARIF output from rg intercept results

func GetExecutablePath added in v0.15.15

func GetExecutablePath() string

GetExecutablePath returns where the main executable is running from

func GetHomeDir added in v0.15.15

func GetHomeDir() string

GetHomeDir returns home directory

func GetWd added in v0.15.15

func GetWd() string

GetWd returns working directory

func LogError added in v0.15.15

func LogError(err error)

LogError does that

func PrintClose added in v0.15.15

func PrintClose()

PrintClose prints the command ending

func PrintStart added in v0.15.15

func PrintStart()

PrintStart prints the command banner

func ProcessOutput added in v0.15.15

func ProcessOutput(filename string, ruleId string, ruleType string, ruleName string, ruleDescription string, ruleError string, ruleSolution string, ruleFatal bool)

processes ripgrep output into intercept meaningfull results

func ReaderFromURL added in v0.15.15

func ReaderFromURL(path string) (io.ReadCloser, error)

ReaderFromURL grabs de config from URL

func RunCommandWithArgs added in v0.15.15

func RunCommandWithArgs(binaryPath string, argsStr string) error

func WriteLinesOnFile added in v0.15.15

func WriteLinesOnFile(lines []string, filepath string) error

WriteLinesOnFile does that

Types

type InterceptCompliance added in v0.15.15

type InterceptCompliance struct {
	RuleFindings    []InterceptComplianceFinding `json:"ruleFindings"`
	RuleDescription string                       `json:"ruleDescription"`
	RuleError       string                       `json:"ruleError"`
	RuleFatal       bool                         `json:"ruleFatal"`
	RuleID          string                       `json:"ruleId"`
	RuleName        string                       `json:"ruleName"`
	RuleSolution    string                       `json:"ruleSolution"`
	RuleType        string                       `json:"ruleType"`
	Type            string                       `json:"type"`
}

type InterceptComplianceFinding added in v0.15.15

type InterceptComplianceFinding struct {
	FileName  string `yaml:"filename"`
	FileHash  string `yaml:"filehash"`
	Output    string `yaml:"output"`
	Compliant bool   `yaml:"compliant"`
	Missing   bool   `yaml:"missing"`
	ParentID  int    `yaml:"parentID"`
}

type InterceptComplianceOutput added in v0.15.15

type InterceptComplianceOutput []InterceptCompliance

type InterceptOutput added in v0.15.15

type InterceptOutput []InterceptResult

type InterceptResult added in v0.15.15

type InterceptResult struct {
	Data struct {
		AbsoluteOffset int `json:"absolute_offset"`
		LineNumber     int `json:"line_number"`
		Lines          struct {
			Text string `json:"text"`
		} `json:"lines"`
		Path struct {
			Text string `json:"text"`
		} `json:"path"`
		Submatches []struct {
			End   int `json:"end"`
			Match struct {
				Text string `json:"text"`
			} `json:"match"`
			Start int `json:"start"`
		} `json:"submatches"`
	} `json:"data"`
	RuleDescription string `json:"ruleDescription"`
	RuleError       string `json:"ruleError"`
	RuleFatal       bool   `json:"ruleFatal"`
	RuleID          string `json:"ruleId"`
	RuleName        string `json:"ruleName"`
	RuleSolution    string `json:"ruleSolution"`
	RuleType        string `json:"ruleType"`
	Type            string `json:"type"`
}

type KeyArray added in v0.15.15

type KeyArray struct {
	Keys []string `json:"keys"`
}

type Rule added in v0.15.15

type Rule struct {
	ID               int      `yaml:"id"`
	Name             string   `yaml:"name"`
	Description      string   `yaml:"description"`
	Solution         string   `yaml:"solution"`
	Error            string   `yaml:"error"`
	Type             string   `yaml:"type"`
	Environment      string   `yaml:"environment"`
	Enforcement      bool     `yaml:"enforcement"`
	Fatal            bool     `yaml:"fatal"`
	Tags             string   `yaml:"tags,omitempty"`
	Impact           string   `yaml:"impact,omitempty"`
	Confidence       string   `yaml:"confidence,omitempty"`
	Api_Endpoint     string   `yaml:"api_endpoint,omitempty"`
	Api_Request      string   `yaml:"api_request,omitempty"`
	Api_Insecure     bool     `yaml:"api_insecure"`
	Api_Body         string   `yaml:"api_body,omitempty"`
	Api_Auth         string   `yaml:"api_auth,omitempty"`
	Api_Auth_Basic   *string  `yaml:"api_auth_basic,omitempty"`
	Api_Auth_Token   *string  `yaml:"api_auth_token,omitempty"`
	Api_Trace        bool     `yaml:"api_trace,omitempty"`
	Filepattern      string   `yaml:"filepattern,omitempty"`
	Yml_Filepattern  string   `yaml:"yml_filepattern,omitempty"`
	Yml_Structure    string   `yaml:"yml_structure,omitempty"`
	Toml_Filepattern string   `yaml:"toml_filepattern,omitempty"`
	Toml_Structure   string   `yaml:"toml_structure,omitempty"`
	Json_Filepattern string   `yaml:"json_filepattern,omitempty"`
	Json_Structure   string   `yaml:"json_structure,omitempty"`
	Patterns         []string `yaml:"patterns"`
}

type SARIF added in v0.15.15

type SARIF struct {
	Version string        `json:"version"`
	Schema  string        `json:"$schema"`
	Runs    []interface{} `json:"runs"`
}

func MergeSARIFFiles added in v0.15.15

func MergeSARIFFiles(file1, file2 string) (*SARIF, error)

type ScannedFile added in v0.15.15

type ScannedFile struct {
	Path   string `json:"path"`
	Sha256 string `json:"sha256"`
}

func PathSHA256 added in v0.15.15

func PathSHA256(root string) ([]ScannedFile, error)

Jump to

Keyboard shortcuts

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