Documentation
¶
Index ¶
- Constants
- Variables
- func ContainsBlacklistedString(input []byte) bool
- func CreateRecursiveDir(completePath string) error
- func DeleteFiles(path string, wildCard string)
- func DeleteTmpDir(outputDir string) error
- func GetCurrentTime() string
- func GetEntropy(data string) (entropy float64)
- func GetHash(s string) string
- func GetJsonFilepath(input string) (string, error)
- func GetTimestamp() int64
- func GetTmpDir(imageName string) (string, error)
- func IsSkippableDir(path string, baseDir string) bool
- func IsSkippableFileExtension(path string) bool
- func IsSymLink(path string) bool
- func LogIfError(text string, err error)
- func PathExists(path string) bool
- func Pluralize(count int, singular string, plural string) string
- func UpdateDirsPermissionsRW(dir string)
- type Config
- type ConfigSignature
- type Logger
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) Fatal(format string, args ...interface{})
- func (l *Logger) Important(format string, args ...interface{})
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Log(level int, format string, args ...interface{})
- func (l *Logger) SetDebugLevel(d string)
- func (l *Logger) Warn(format string, args ...interface{})
- type MatchFile
- type Options
- type Session
Constants ¶
const ( FATAL = 5 ERROR = 4 IMPORTANT = 3 WARN = 2 INFO = 1 DEBUG = 0 )
const ( TempDirSuffix = "SecretScanning" ExtractedImageFilesDir = "ExtractedFiles" )
Variables ¶
Functions ¶
func ContainsBlacklistedString ¶
ContainsBlacklistedString Checks if the input contains a blacklisted string
func CreateRecursiveDir ¶
CreateRecursiveDir Create directory structure recursively, if they do not exist @parameters completePath - Complete path of directory which needs to be created @returns Error - Errors if any. Otherwise, returns nil
func DeleteFiles ¶
DeleteFiles Delete all the files and dirs recursively in specified directory @parameters path - Directory whose contents need to be deleted wildcard - patterns to match the filenames (e.g. '*')
func DeleteTmpDir ¶
DeleteTmpDir Delete the temporary directory @parameters outputDir - Directory which need to be deleted @returns Error - Errors if any. Otherwise, returns nil
func GetCurrentTime ¶
func GetCurrentTime() string
func GetEntropy ¶
func GetJsonFilepath ¶
GetJsonFilepath Return complete path and filename for json output file @parameters image - Name of the container image or dir, for which json filename and path will be created @returns string - Sanitized string which can used as path and filename of json output file Error - Errors if path can't be created. Otherwise, returns nil
func GetTimestamp ¶
func GetTimestamp() int64
func GetTmpDir ¶
GetTmpDir Create a temporrary directory to extract the conetents of container image @parameters imageName - Name of the container image @returns String - Complete path of the based directory where image will be extracted, empty string if error Error - Errors if any. Otherwise, returns nil
func IsSkippableDir ¶
IsSkippableFile Checks if the path is blacklisted
func IsSkippableFileExtension ¶
IsSkippableFileExtension Checks if the file extension is blacklisted
func IsSymLink ¶
IsSymLink Check if input is a symLink, not normal file/dir path - Pathname which needs to be checked for symbolic link @returns bool - Return true if input is a symLink
func LogIfError ¶
func PathExists ¶
func UpdateDirsPermissionsRW ¶
func UpdateDirsPermissionsRW(dir string)
UpdateDirsPermissionsRW Update permissions for dirs in container images, so that they can be properly deleted
Types ¶
type Config ¶
type Config struct {
BlacklistedStrings []string `yaml:"blacklisted_strings"`
BlacklistedExtensions []string `yaml:"blacklisted_extensions"`
BlacklistedPaths []string `yaml:"blacklisted_paths"`
BlacklistedEntropyExtensions []string `yaml:"blacklisted_entropy_extensions"`
Signatures []ConfigSignature `yaml:"signatures"`
}
func ParseConfig ¶
func (*Config) UnmarshalYAML ¶
type ConfigSignature ¶
type ConfigSignature struct {
Name string `yaml:"name"`
Part string `yaml:"part"`
Match string `yaml:"match,omitempty"`
Regex string `yaml:"regex,omitempty"`
RegexType string `yaml:"regextype,omitempty"`
CompiledRegex *regexp.Regexp
Verifier string `yaml:"verifier,omitempty"`
Severity string `yaml:"severity,omitempty"`
SeverityScore float64 `yaml:"severityscore,omitempty"`
ID int `yaml:"ID,omitempty"`
}
type Logger ¶
func (*Logger) SetDebugLevel ¶
type MatchFile ¶
func NewMatchFile ¶
NewMatchFile Creates a new Matchfile data structure
func (MatchFile) CanCheckEntropy ¶
CanCheckEntropy Checks if entropy based scanning is appropriate for this file
type Options ¶
type Options struct {
Threads *int
DebugLevel *string
MaximumFileSize *uint
TempDirectory *string
Local *string
HostMountPath *string
ConfigPath *string
OutputPath *string
JsonFilename *string
ImageName *string
MultipleMatch *bool
MaxMultiMatch *uint
MaxSecrets *uint
ContainerId *string
ContainerNS *string
}