config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Colors has ansi color list
	Colors = []string{
		"\033[32m",
		"\033[33m",
		"\033[36m",
		"\033[35m",
		"\033[31m",
		"\033[34m",
	}
	// ResetColor is reset color
	ResetColor = "\033[0m"
)

Functions

func Load

func Load(path, keyPass, sudoPass string) error

Load loads configuration

Types

type Config

type Config struct {
	Debug    bool
	DebugSQL bool
	Lang     string

	Mail    smtpConf
	Slack   SlackConf
	Default ServerInfo
	Servers map[string]ServerInfo

	CveDictionaryURL string `valid:"url"`

	CvssScoreOver float64
	HTTPProxy     string `valid:"url"`
	DBPath        string
	//  CpeNames      []string
	//  SummaryMode          bool
	UseYumPluginSecurity  bool
	UseUnattendedUpgrades bool
}

Config is struct of Configuration

var Conf Config

Conf has Configuration

func (Config) Validate

func (c Config) Validate() bool

Validate configuration

type JSONLoader

type JSONLoader struct {
}

JSONLoader loads configuration

func (JSONLoader) Load

func (c JSONLoader) Load(path, sudoPass, keyPass string) (err error)

Load load the configuraiton JSON file specified by path arg.

type Loader

type Loader interface {
	Load(string, string, string) error
}

Loader is interface of concrete loader

type ServerInfo

type ServerInfo struct {
	ServerName  string
	User        string
	Password    string
	Host        string
	Port        string
	KeyPath     string
	KeyPassword string
	SudoOpt     SudoOption

	CpeNames []string

	// DebugLog Color
	LogMsgAnsiColor string
}

ServerInfo has SSH Info, additional CPE packages to scan.

type SlackConf

type SlackConf struct {
	HookURL   string `valid:"url"`
	Channel   string `json:"channel"`
	IconEmoji string `json:"icon_emoji"`
	AuthUser  string `json:"username"`

	NotifyUsers []string
	Text        string `json:"text"`

	UseThisTime bool
}

SlackConf is slack config

func (*SlackConf) Validate

func (c *SlackConf) Validate() (errs []error)

Validate validates configuration

type SudoOption

type SudoOption struct {

	// echo pass | sudo -S ls
	ExecBySudo bool

	// echo pass | sudo sh -C 'ls'
	ExecBySudoSh bool
}

SudoOption is flag of sudo option.

type TOMLLoader

type TOMLLoader struct {
}

TOMLLoader loads config

func (TOMLLoader) Load

func (c TOMLLoader) Load(pathToToml, keyPass, sudoPass string) (err error)

Load load the configuraiton TOML file specified by path arg.

Jump to

Keyboard shortcuts

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