utils

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: Apache-2.0 Imports: 14 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppHelpTemplate = `` /* 464-byte string literal not displayed */

AppHelpTemplate is a default malice plugin help template

Functions

func AskForConfirmation

func AskForConfirmation() bool

AskForConfirmation prompts user for yes/no response

func Assert

func Assert(err error)

Assert asserts there was no error, else log.Fatal

func CamelCase

func CamelCase(src string) string

CamelCase converts strings to their camel case equivalent

func GetHashType

func GetHashType(hash string) (string, error)

GetHashType returns the hash type (md5, sha1, sha256, sha512)

func GetSHA256

func GetSHA256(name string) string

GetSHA256 calculates a file's sha256sum

func Getopt

func Getopt(name, dfault string) string

Getopt reads environment variables. If not found will return a supplied default value

func Getopts

func Getopts(userInput, envVar, dfault string) string

Getopts reads from user input then environment variable and finally a sane default.

func RemoveDuplicates

func RemoveDuplicates(elements []string) []string

RemoveDuplicates removes duplicate items from a list

func RunCommand

func RunCommand(ctx context.Context, cmd string, args ...string) (string, error)

RunCommand runs cmd on file

func SliceContainsString

func SliceContainsString(a string, list []string) bool

SliceContainsString returns if slice contains substring

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice returns whether or not a string exists in a slice

func Unzip

func Unzip(archive, target string) error

Unzip unzips archive to target location

Types

This section is empty.

Jump to

Keyboard shortcuts

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