pkg

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

execute a command, and take care to sanitize the child process environment (conditionally)

Index

Examples

Constants

View Source
const EMO_CHECK = "✅"

nolint

View Source
const EMO_FAILED = "❌"

nolint

View Source
const EMO_TIME = "⌛️"

nolint

View Source
const FILE_ENV_KEY = "PF_FILE_LOOKUP"

nolint

View Source
const MD5 = "md5"
View Source
const SHA1 = "sha1"
View Source
const VT_ENV_KEY = "PF_VT_TOKEN"

nolint

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	LookupResult    *LookupResult
	ValidDigest     *Signature
	ExpectedDigests []Signature
	ActualDigest    Digest
	Ok              bool
}

func (*CheckResult) Error

func (c *CheckResult) Error() error

func (*CheckResult) HasLookupVulns added in v1.1.0

func (c *CheckResult) HasLookupVulns() bool

func (*CheckResult) HasValidationVulns added in v1.1.0

func (c *CheckResult) HasValidationVulns() bool

type Digest

type Digest struct {
	SHA1   string
	SHA256 string
	MD5    string
}

func (*Digest) For added in v1.1.2

func (d *Digest) For(kind string) string

func (*Digest) String added in v1.1.0

func (d *Digest) String() string

func (*Digest) Verify

func (d *Digest) Verify(s Signature) (ok bool, expectedHash string)

type FileLookup

type FileLookup struct {
	// contains filtered or unexported fields
}
Example
lookup, _ := NewFileLookup("../file_lookup_list.txt")
pf := NewPreflight([]Lookup{&NoLookup{}, lookup})
pf.ExecPiped("echo 'hello'", "3b084aa6ad2246428c9270825d8631e077b7e7c9bb16f6cafb482bc7fd63e348")
Output:

⌛️ Preflight starting with file lookup: ../file_lookup_list.txt
✅ Preflight verified
hello

func (*FileLookup) Hash

func (p *FileLookup) Hash(digest Digest) (LookupResult, error)

func (*FileLookup) Name

func (p *FileLookup) Name() string

type Lookup

type Lookup interface {
	Hash(digest Digest) (LookupResult, error)
	Name() string
}

func GetLookup

func GetLookup() ([]Lookup, error)

func NewFileLookup

func NewFileLookup(f string) (Lookup, error)

func NewVirusTotalLookup added in v1.1.0

func NewVirusTotalLookup(f string) (Lookup, error)

type LookupResult

type LookupResult struct {
	Vulnerable bool
	Message    string
	Link       string
}

type NoLookup

type NoLookup struct {
}

func (*NoLookup) Hash

func (p *NoLookup) Hash(digest Digest) (LookupResult, error)

func (*NoLookup) Name

func (p *NoLookup) Name() string

type Porcelain

type Porcelain struct {
}

func (*Porcelain) CheckFailed

func (p *Porcelain) CheckFailed(check *CheckResult)

func (*Porcelain) RunOk

func (p *Porcelain) RunOk()

func (*Porcelain) Start

func (p *Porcelain) Start(pf *Preflight)

type Preflight

type Preflight struct {
	Lookup    []Lookup
	Porcelain *Porcelain
}

func NewPreflight

func NewPreflight(lookup []Lookup) *Preflight

func (*Preflight) Check

func (a *Preflight) Check(script, siglist string) (*CheckResult, error)

func (*Preflight) Exec

func (a *Preflight) Exec(args []string, sig string) error

func (*Preflight) ExecPiped

func (a *Preflight) ExecPiped(script, sig string) error

XXX: windows/powershell needs a different function

type Signature

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

func (*Signature) String added in v1.1.0

func (s *Signature) String() string

type VirusTotalLookup added in v1.1.0

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

func (*VirusTotalLookup) Hash added in v1.1.0

func (p *VirusTotalLookup) Hash(digest Digest) (LookupResult, error)

func (*VirusTotalLookup) Name added in v1.1.0

func (p *VirusTotalLookup) Name() string

Jump to

Keyboard shortcuts

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