utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Modified https://github.com/paddie/gokmp

Index

Constants

View Source
const CHAIN_NAME = "VENOM"
View Source
const START_FORWARDING = "venomcoming"
View Source
const STOP_FORWARDING = "venomleaving"

Variables

View Source
var CMD_EXEC_FAIDED = errors.New("iptables command exec failed.")
View Source
var INVALID_IP_ADDR = errors.New("invalid ip address.")

Functions

func Array32ToUUID

func Array32ToUUID(bytes [32]byte) string

Array32ToUUID 32byte array to UUID

func BytesToUint16

func BytesToUint16(buf []byte) uint16

func BytesToUint32

func BytesToUint32(buf []byte) uint32

func BytesToUint64

func BytesToUint64(buf []byte) uint64

func DeletePortReuseRules

func DeletePortReuseRules(localPort uint16, reusedPort uint16) error

func FileExists

func FileExists(filename string) bool

FileExists Check if the file exists

func GetFileSize

func GetFileSize(path string) int64

GetFileSize Get the size of a single file

func GetRandomString

func GetRandomString(length int) string

GetRandomString generate a random string

func GetSystemType

func GetSystemType() (osType uint32)

----------------------- system info ---------------------------

func HandleWindowsCR added in v1.0.2

func HandleWindowsCR()

--------------------- handling windows \r ------------------------------

func IpToUint32

func IpToUint32(ip net.IP) uint32

func NewUUID

func NewUUID() string

NewUUID New Universally Unique Identifier TODO use https://github.com/satori/go.uuid to generate UUID

func PacketSize

func PacketSize(packet interface{}) (uint64, error)

-------------- Calculate structure size -----------------

func RemoveDuplicateElement

func RemoveDuplicateElement(addrs []string) []string

------------------- slice deduplication ---------------------

func SetPortReuseRules

func SetPortReuseRules(localPort uint16, reusedPort uint16) error

func SliceTo32ByteArray

func SliceTo32ByteArray(buf []byte) [32]byte

func UUIDToArray32

func UUIDToArray32(hashID string) [32]byte

UUIDToArray32 UUID to 32byte arrary

func Uint16ToBytes

func Uint16ToBytes(i uint16) []byte

func Uint32ToBytes

func Uint32ToBytes(i uint32) []byte

func Uint32ToIp

func Uint32ToIp(nn uint32) net.IP

func Uint64ToBytes

func Uint64ToBytes(i uint64) []byte

Types

type KMP

type KMP struct {
	Pattern string
	Prefix  []int
	Size    int
}

func NewKMP

func NewKMP(pattern string) (*KMP, error)

compile new prefix-array given argument

func (*KMP) String

func (kmp *KMP) String() string

For debugging

Jump to

Keyboard shortcuts

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