utils

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_NAME string = "malwaredb.json"
	CONFIG_PATH string = "/etc/" + CONFIG_NAME
)

Variables

This section is empty.

Functions

func GenConfig

func GenConfig(path string) error

func LoadPlugins

func LoadPlugins()

Types

type FileTypeHandler

type FileTypeHandler interface {
	FileTypeName() string
	FileTypeMagic() []byte
	DBTableName() string
	ProcessFile(fileContents []byte, fileID int, ServerContext *ServerContext) error
}

type ServerConfigFile

type ServerConfigFile struct {
	FilePath string `json:"-"`

	Database struct {
		Host     string `json:"host"`
		Port     string `json:"port"`
		User     string `json:"user"`
		Password string `json:"password"`
		DBName   string `json:"dbname"`
	} `json:"database"`
	Listen struct {
		Host       string `json:"host"`
		Port       string `json:"port"`
		MaxThreads int    `json:"maxThreads"`
	} `json:"listen"`
	SSL struct {
		CA   string `json:"ca"`
		Cert string `json:"cert"`
		Key  string `json:"key"`
	}
	StoredSamplesPath  string `json:"samplesPath"`
	StoredSamplesDepth int    `json:"samplesDepth"`

	DbDriver *sql.DB
}

func LoadConfig

func LoadConfig() (ServerConfigFile, error)

func ReadConfig

func ReadConfig(path string) ServerConfigFile

func (*ServerConfigFile) GetDBServerFunctions

func (cf *ServerConfigFile) GetDBServerFunctions() ([]string, error)

func (*ServerConfigFile) LZJDQueryAvailable

func (cf *ServerConfigFile) LZJDQueryAvailable() bool

func (*ServerConfigFile) ListenString

func (cf *ServerConfigFile) ListenString() string

func (*ServerConfigFile) NumFiles

func (cf *ServerConfigFile) NumFiles() int

func (*ServerConfigFile) QueryColumns

func (cf *ServerConfigFile) QueryColumns(table string, columns []string) (*sql.Rows, error)

func (*ServerConfigFile) SDHashQueryAvailable

func (cf *ServerConfigFile) SDHashQueryAvailable() bool

func (*ServerConfigFile) SSDeepQueryAvailable

func (cf *ServerConfigFile) SSDeepQueryAvailable() bool

func (*ServerConfigFile) SetPassword

func (cf *ServerConfigFile) SetPassword(userid int, password []byte) error

type ServerContext

type ServerContext struct {
	ConfigFile      *ServerConfigFile
	GlobalWaitGroup *sync.WaitGroup
	FileTypePlugins []FileTypeHandler
	StartTime       time.Time
}

func GetGlobalContext

func GetGlobalContext() *ServerContext

func (*ServerContext) SetConfig

func (cntx *ServerContext) SetConfig(cfg *ServerConfigFile)

func (*ServerContext) TimeRunning

func (cntx *ServerContext) TimeRunning() time.Duration

Jump to

Keyboard shortcuts

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