lib

package
v1.3.3-alpha12 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 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 ActToChinese = map[string]string{
	"ACT_GATHER_INFO": "收集信息",
	"ACT_ATTACK":      "测试",
	"ACT_DENIAL":      "DOS",
	"ACT_SETTINGS":    "设置",

	"ACT_FLOOD":              "洪水",
	"ACT_GATHER":             "收集",
	"ACT_DESTRUCTIVE":        "破坏",
	"ACT_MIXED":              "混合",
	"ACT_SCANNER":            "扫描",
	"ACT_END":                "结束",
	"ACT_INIT":               "初始化",
	"ACT_DESTRUCTIVE_ATTACK": "破坏性攻击",
	"ACT_MIXED_ATTACK":       "混合攻击",
	"ACT_KILL_HOST":          "杀死主机",
}

"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",

View Source
var BuildInVars = map[string]interface{}{}/* 219 elements not displayed */
View Source
var NaslBuildInNativeMethod = map[string]interface{}{
	"get_array_elem": func(icaller interface{}, index interface{}) interface{} {
		switch caller := icaller.(type) {
		case *vm.NaslArray:
			if caller == nil {
				panic("iterableValue.Value is nil")
			}
			if index == nil {
				return nil

			}
			i, ok := index.(int)
			if ok {
				return caller.GetElementByNum(i)
			}
			stringIndex, ok := index.(string)
			if ok {
				val, ok := caller.Hash_elt[stringIndex]
				if ok {
					return val
				} else {
					return nil
				}
			}
			panic("arg must be int or string")
		case string, []byte:
			data := utils.InterfaceToBytes(caller)
			if index == nil {
				panic("index is nil")
			}
			i, ok := index.(int)
			if ok {
				if i >= len(data) {
					return nil
				}
				if _, ok := icaller.(string); ok {
					return string(data[i])
				}
				return data[i]
			}
			panic("arg must be int")
		case nil:
			return nil
		default:
			panic("not support caller type")
		}

	},
	"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 ""
	},
	"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
	},
	"__split": func(s string, sep string, keep bool) []string {
		return strings.Split(s, sep)
	},
	"reEqual": func(s1, s2 interface{}) bool {
		return utils.MatchAllOfRegexp(utils.InterfaceToString(s1), utils.InterfaceToString(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")
	},
	"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)
	},
}

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 (*Iterator) Next

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

type IteratorInterface added in v1.2.2

type IteratorInterface interface {
	Next() (interface{}, bool)
}

func NewIterator

func NewIterator(v interface{}) (IteratorInterface, error)

type NaslIterator added in v1.2.2

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

func (*NaslIterator) Next added in v1.2.2

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

Jump to

Keyboard shortcuts

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