utils

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: BSD-3-Clause, GPL-3.0 Imports: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanIdent added in v0.6.6

func CleanIdent(path string) string

CleanIdent will clean a path

func ClearLine

func ClearLine()

ClearLine clears the current line of the terminal.

func ClearScreen

func ClearScreen()

ClearScreen prints ANSI escape to flush screen.

func Confirm added in v0.6.6

func Confirm(s string) bool

Confirm displays a prompt message to the terminal and returns a bool indicating the user decision.

func CopyFile added in v0.6.6

func CopyFile(src, dst string)

CopyFile the source file contents to destination file attributes wont be copied and an existing file will be overwritten.

func CreateFlowIdent added in v0.6.6

func CreateFlowIdent(srcIP, srcPort, dstIP, dstPort string) string

CreateFlowIdent creates a flow identifier string. format: srcIP:srcPort->dstIP:dstPort

func CreateFlowIdentFromLayerFlows added in v0.6.6

func CreateFlowIdentFromLayerFlows(net gopacket.Flow, trans gopacket.Flow) string

CreateFlowIdentFromLayerFlows creates a flow identifier string. format: srcIP:srcPort->dstIP:dstPort

func DecodePort added in v0.6.6

func DecodePort(raw []byte) int32

DecodePort decodes the network port directly from a byte slice.

func GetBaseLayer added in v0.3.9

func GetBaseLayer(value string) (t gopacket.LayerType)

GetBaseLayer resolves a baselayer string to the gopacket.LayerType.

func GetDecodeOptions added in v0.3.9

func GetDecodeOptions(value string) (o gopacket.DecodeOptions)

GetDecodeOptions resolves a decode option string to the gopacket.DecodeOptions type.

func IsASCII added in v0.6.6

func IsASCII(d []byte) bool

IsASCII checks if input consists of ascii characters.

func ListAllNetworkInterfaces added in v0.4.4

func ListAllNetworkInterfaces()

ListAllNetworkInterfaces dumps a list of all visible network interfaces to stdout.

func Pad

func Pad(in interface{}, length int) string

Pad the input up to the given number of space characters..

func ParseFlowIdent added in v0.6.6

func ParseFlowIdent(i string) (srcIP, srcPort, dstIP, dstPort string)

ParseFlowIdent parses the flow identifier. e.g: 192.168.1.47:53032->165.227.109.154:80 will return: 192.168.1.47, 53032, 165.227.109.154, 80 TODO: benchmark and improve performance TODO: IPv6

func Pluralize added in v0.6.6

func Pluralize(name string) string

Pluralize returns the plural for a given noun.

func Progress

func Progress(current, total int64) string

Progress returns the value in percent as a string suffixed with a %.

func ReverseFlowIdent added in v0.6.6

func ReverseFlowIdent(i string) string

ReverseFlowIdent reverses the flow identifier. e.g: 192.168.1.47:53032->165.227.109.154:80 will return: 165.227.109.154:80->192.168.1.47:53032 TODO: benchmark and improve performance TODO: IPv6

func StringToTime

func StringToTime(val string) time.Time

StringToTime converts a seconds.micro string to a time.Time.

func StripQueryString added in v0.6.6

func StripQueryString(inputUrl string) string

StripQueryString returns an URL without parameters

func TimeToUTC

func TimeToUTC(val string) string

TimeToUTC returns a time string in netcap format to a UTC string.

func TrimFileExtension

func TrimFileExtension(file string) string

TrimFileExtension returns the netcap file name without file extension.

func UnixTimeToUTC added in v0.6.6

func UnixTimeToUTC(val int64) string

UnixTimeToUTC returns a time string in netcap format to a UTC string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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