lib

package
v1.2.1-sp4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPENVAS_ENCAPS_AUTO int = iota
	OPENVAS_ENCAPS_IP
	OPENVAS_ENCAPS_SSLv23
	OPENVAS_ENCAPS_SSLv2
	OPENVAS_ENCAPS_SSLv3
	OPENVAS_ENCAPS_TLSv1
	OPENVAS_ENCAPS_TLSv11
	OPENVAS_ENCAPS_TLSv12
	OPENVAS_ENCAPS_TLSv13
	OPENVAS_ENCAPS_TLScustom
	OPENVAS_ENCAPS_MAX
)

Variables

View Source
var BuildInVars = map[string]interface{}{
	"ACT_GATHER_INFO":        "ACT_GATHER_INFO",
	"ACT_ATTACK":             "ACT_ATTACK",
	"ACT_DENIAL":             "ACT_DENIAL",
	"ACT_SETTINGS":           "ACT_SETTINGS",
	"ACT_KILL":               "ACT_KILL",
	"ACT_FLOOD":              "ACT_FLOOD",
	"ACT_GATHER":             "ACT_GATHER",
	"ACT_DESTRUCTIVE":        "ACT_DESTRUCTIVE",
	"ACT_MIXED":              "ACT_MIXED",
	"ACT_SCANNER":            "ACT_SCANNER",
	"ACT_END":                "ACT_END",
	"ACT_INIT":               "ACT_INIT",
	"ACT_DESTRUCTIVE_ATTACK": "ACT_DESTRUCTIVE_ATTACK",
	"ACT_MIXED_ATTACK":       "ACT_MIXED_ATTACK",
	"ACT_KILL_HOST":          "ACT_KILL_HOST",

	"OPENVAS_VERSION":  "OPENVAS_VERSION",
	"ENCAPS_AUTO":      OPENVAS_ENCAPS_AUTO,
	"ENCAPS_IP":        OPENVAS_ENCAPS_IP,
	"ENCAPS_SSLv23":    OPENVAS_ENCAPS_SSLv23,
	"ENCAPS_SSLv2":     OPENVAS_ENCAPS_SSLv2,
	"ENCAPS_SSLv3":     OPENVAS_ENCAPS_SSLv3,
	"ENCAPS_TLSv1":     OPENVAS_ENCAPS_TLSv1,
	"ENCAPS_TLSv11":    OPENVAS_ENCAPS_TLSv11,
	"ENCAPS_TLSv12":    OPENVAS_ENCAPS_TLSv12,
	"ENCAPS_TLScustom": OPENVAS_ENCAPS_TLScustom,
	"ENCAPS_MAX":       OPENVAS_ENCAPS_MAX,
}
View Source
var NaslBuildInNativeMethod = map[string]interface{}{
	"sleep": func(n int) {
		time.Sleep(time.Duration(n) * time.Second)
	},
	"toupper": func(s string) string {
		return strings.ToUpper(s)
	},
	"keys": func(v map[string]interface{}) []string {
		var keys []string
		for k := range v {
			keys = append(keys, k)
		}
		return keys
	},
	"get_host_ip": func() string {
		return ""
	},

	"get_kb_list": func(s string) map[string]interface{} {
		res := map[string]interface{}{}
		for k, v := range kbs {
			if utils.MatchAllOfGlob(k, s) {
				res[k] = v
			}
		}
		return res
	},
	"string": func(i interface{}) string {
		return utils.InterfaceToString(i)
	},
	"display": func(i ...interface{}) {
		s := ""
		for _, i2 := range i {
			s += utils.InterfaceToString(i2)
		}
		println(s)
	},

	"isnull": func(i interface{}) bool {
		return i == nil
	},
	"get_script_oid": func() string {
		return oid
	},
	"__split": func(s string, sep string, keep bool) []string {
		return strings.Split(s, sep)
	},
	"max_index": func(i interface{}) int {
		refV := reflect.ValueOf(i)
		if refV.Type().Kind() == reflect.Array || refV.Type().Kind() == reflect.Slice {
			return refV.Len() - 1
		}
		return -1
	},
	"__set_kb_item": Set_kb_item,
	"__get_kb_item": func(k string) interface{} {
		if v, ok := kbs[k]; ok {
			return v
		}
		return nil
	},

	"reEqual": func(s1, s2 string) bool {
		return utils.MatchAllOfRegexp(s1, s2)
	},
	"strIn": func(s1, s2 string) bool {
		return strings.Contains(s1, s2)
	},
	"RightShiftLogical": func(s1, s2 int64) uint64 {
		return uint64(s1) >> s2
	},
	"BitNot": func(a int64) int64 {
		return ^a
	},
	"__NewIterator": NewIterator,
	"__pow": func(a, b float64) float64 {
		return math.Pow(a, b)
	},
	"chomp": func(s string) string {
		return strings.TrimRight(s, "\n")
	},

	"replace_kb_item": func(name string, v interface{}) {
		kbs[name] = v
	},
	"close": func(conn net.Conn) {
		if err := conn.Close(); err != nil {
			log.Errorf("close conn error: %v", err)
		}
	},
	"debug_print": func(items ...interface{}) {
		fmt.Print(items...)
	},
	"stridx": func(s1, s2 string) int {
		return strings.Index(s1, s2)
	},
	"tolower": func(s string) string {
		return strings.ToLower(s)
	},
}
View Source
var ScriptInfoNativeMethod = map[string]interface{}{
	"_script_oid": func() {

	},
}
View Source
var Set_kb_item = func(k string, v interface{}) {
	kbs[k] = v
}

Functions

func GetEncapsName

func GetEncapsName(code int) string

Types

type ExitSignal

type ExitSignal struct {
	Flag interface{}
}
libs := map[string][]*yakvm.Code{
	""
}

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(v interface{}) (*Iterator, error)

func (*Iterator) Next

func (i *Iterator) Next() (interface{}, bool)

Jump to

Keyboard shortcuts

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