utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppVersion string
View Source
var ForceFlag bool
View Source
var HomeDir string
View Source
var VulhubAppDBUrl string
View Source
var VulhubConfig string
View Source
var VulhubConfigDBPath string
View Source
var VulhubDBName string
View Source
var VulhubDBs []VulhubAppDBStruct

Functions

func DPanic

func DPanic(msg string, fields ...zap.Field)

func DPanicF

func DPanicF(msg string, args ...interface{})

func Debug

func Debug(msg string, fields ...zap.Field)

func DebugF

func DebugF(msg string, args ...interface{})

func Error

func Error(msg string, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func FatalF

func FatalF(msg string, args ...interface{})

func FileExists

func FileExists(path string) bool

FileExists Determine whether the given path file exists

func GetExecCommands

func GetExecCommands(destPath string, appInfo VulhubAppDBStruct) []string

GetExecCommands get app start commands

func Info

func Info(msg string, fields ...zap.Field)

func InfoF

func InfoF(msg string, args ...interface{})

func InitConfig

func InitConfig(config Config)

InitConfig init config data and set VulhubAppDBUrl

func InitConfigPath

func InitConfigPath(configPath string)

InitConfigPath init global config path

func InitDBFile

func InitDBFile() bool

InitDBFile init db file

func IsDir

func IsDir(path string) bool

IsDir Determine whether the given path is a folder

func Logger

func Logger() *zap.Logger

func Panic

func Panic(msg string, fields ...zap.Field)

func PanicF

func PanicF(msg string, args ...interface{})

func Warn

func Warn(msg string, fields ...zap.Field)

func WarnF

func WarnF(msg string, args ...interface{})

Types

type Config

type Config struct {
	Mirror string `json:"mirrors"`
}

Config config

func GetConfig

func GetConfig() (config Config)

GetConfig read config file and Unmarshal config data

type DockerComposeServiceStruct

type DockerComposeServiceStruct struct {
	Image     string   `yaml:"image"`
	Ports     []string `yaml:"ports"`
	Build     string   `yaml:"build"`
	Networks  []string `yaml:"networks"`
	Volumes   []string `yaml:"volumes"`
	DependsOn []string `yaml:"depends_on"`
	Deploy    struct {
		Mode          string   `yaml:"mode"`
		Replicas      int      `yaml:"replicas"`
		Labels        []string `yaml:"labels"`
		RestartPolicy struct {
			Condition   string `yaml:"condition"`
			Delay       string `yaml:"delay"`
			MaxAttempts int    `yaml:"max_attempts"`
			Window      string `yaml:"window"`
		} `json:"restart_policy"`
		Placement struct {
			Constraints []string `yaml:"constraints"`
		} `json:"placement"`
		UpdateConfig struct {
			Parallelism int    `yaml:"parallelism"`
			Delay       string `yaml:"delay"`
		} `yaml:"update_config"`
	} `yaml:"deploy"`
	StopGracePeriod string `yaml:"stop_grace_period"`
}

DockerComposeServiceStruct docker-compose service struct

type DockerComposeStruct

type DockerComposeStruct struct {
	Version  string                                `yaml:"version"`
	Services map[string]DockerComposeServiceStruct `yaml:"services"`
}

DockerComposeStruct docker-compose struct

func ParseDockerCompose

func ParseDockerCompose(filePath string) DockerComposeStruct

ParseDockerCompose Parse docker-compose.yml to struct

type VulhubAppDBStruct

type VulhubAppDBStruct struct {
	Id    int      `json:"id"`
	Cve   string   `json:"cve"`
	Name  string   `json:"name"`
	App   string   `json:"app"`
	Path  string   `json:"path"`
	Files []string `json:"files"`
}

VulhubAppDBStruct vulhub app database struct

Jump to

Keyboard shortcuts

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