core

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package core contains basic utility functions.

Index

Constants

View Source
const (
	Name    = "bettercap"
	Version = "2.3.1"
	Author  = "Simone 'evilsocket' Margaritelli"
	Website = "https://bettercap.org/"
)
View Source
const (
	DEBUG = iota
	INFO
	IMPORTANT
	WARNING
	ERROR
	FATAL
)
View Source
const (
	AlignLeft   = Alignment(0)
	AlignCenter = Alignment(1)
	AlignRight  = Alignment(2)
)

Variables

View Source
var (
	BOLD = "\033[1m"
	DIM  = "\033[2m"

	RED    = "\033[31m"
	GREEN  = "\033[32m"
	BLUE   = "\033[34m"
	YELLOW = "\033[33m"

	FG_BLACK = "\033[30m"
	FG_WHITE = "\033[97m"

	BG_DGRAY  = "\033[100m"
	BG_RED    = "\033[41m"
	BG_GREEN  = "\033[42m"
	BG_YELLOW = "\033[43m"
	BG_LBLUE  = "\033[104m"

	RESET = "\033[0m"

	LogLabels = map[int]string{
		DEBUG:     "dbg",
		INFO:      "inf",
		IMPORTANT: "imp",
		WARNING:   "war",
		ERROR:     "err",
		FATAL:     "!!!",
	}

	LogColors = map[int]string{
		DEBUG:     DIM + FG_BLACK + BG_DGRAY,
		INFO:      FG_WHITE + BG_GREEN,
		IMPORTANT: FG_WHITE + BG_LBLUE,
		WARNING:   FG_WHITE + BG_YELLOW,
		ERROR:     FG_WHITE + BG_RED,
		FATAL:     FG_WHITE + BG_RED + BOLD,
	}

	HasColors = true
)

https://misc.flogisoft.com/bash/tip_colors_and_formatting

Functions

func AsTable

func AsTable(w io.Writer, columns []string, rows [][]string)

func Blue

func Blue(s string) string

func Bold

func Bold(s string) string

func CommaSplit

func CommaSplit(csv string) []string

func Dim

func Dim(s string) string

func Exec

func Exec(executable string, args []string) (string, error)

func ExecSilent

func ExecSilent(executable string, args []string) (string, error)

func Exists

func Exists(path string) bool

func ExpandPath

func ExpandPath(path string) (string, error)

func Green

func Green(s string) string

func InitSwag

func InitSwag(disableColors bool)

func Red

func Red(s string) string

func Shell

func Shell(cmd string) (string, error)

func Trim

func Trim(s string) string

func TrimRight

func TrimRight(s string) string

func UniqueInts

func UniqueInts(a []int, sorted bool) []int

func W

func W(e, s string) string

W for Wrap

func Yellow

func Yellow(s string) string

Types

type Alignment

type Alignment int

type Options

type Options struct {
	InterfaceName *string
	Caplet        *string
	AutoStart     *string
	Debug         *bool
	Silent        *bool
	NoColors      *bool
	NoHistory     *bool
	EnvFile       *string
	Commands      *string
	CpuProfile    *string
	MemProfile    *string
}

func ParseOptions

func ParseOptions() (Options, error)

Jump to

Keyboard shortcuts

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