utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskConfirmation added in v1.2.0

func AskConfirmation(message string, batchParam bool) bool

AskConfirmation will request confirmation from the user

func DisplayInformationsGUI added in v1.3.0

func DisplayInformationsGUI(profile map[string]interface{}, advancedLabsMap map[string]map[string]interface{})

Initializes and displays user information in tview

func GetActiveMachineID

func GetActiveMachineID(proxyURL string) string

GetActiveMachineID returns the id of the active machine

func GetActiveMachineIP added in v1.3.1

func GetActiveMachineIP(proxyURL string) string

GetActiveMachineIP returns the ip of the active machine

func GetHTBToken

func GetHTBToken() string

GetHTBToken checks whether the HTB_TOKEN environment variable exists

func GetInformationsFromActiveMachine added in v1.3.0

func GetInformationsFromActiveMachine(proxyParam string) (map[string]interface{}, error)

func GetMachineType

func GetMachineType(machine_id interface{}, proxyURL string) string

GetMachineType will return the machine type

func GetUserSubscription

func GetUserSubscription(proxyURL string) string

GetUserSubscription returns the user's subscription level

func HtbRequest

func HtbRequest(method string, urlParam string, proxyURL string, jsonData []byte) (*http.Response, error)

HtbRequest makes an HTTP request to the Hackthebox API

func ParseAndFormatDate added in v1.2.0

func ParseAndFormatDate(input string) (string, error)

ParseAndFormatDate takes an input date string, parses it into a time.Time object, and formats it to the "2006-01-02" format.

func ParseJsonMessage

func ParseJsonMessage(resp *http.Response, key string) interface{}

ParseJsonMessage will parse the result of the API request into a JSON

func SearchItemIDByName added in v1.1.0

func SearchItemIDByName(item string, proxyURL string, element_type string, batchParam bool) (string, error)

SearchItemIDByName will return the id of an item (machine / challenge / user) based on its name

func SetRetiredStatus added in v1.2.0

func SetRetiredStatus(data map[string]interface{}) string

SetRetiredStatus determines whether an item is retired or not.

func SetStatus added in v1.2.0

func SetStatus(data map[string]interface{}) string

SetStatus determines the status based on user and root flags.

func SetTabWriterData added in v1.2.0

func SetTabWriterData(w *tabwriter.Writer, data string)

SetTabWriterData will write the contents of each array cell

func SetTabWriterHeader added in v1.2.0

func SetTabWriterHeader(header string) *tabwriter.Writer

SetTabWriterHeader will display the information in an array

Types

type Challenge added in v1.1.0

type Challenge struct {
	ID    string `json:"id"`
	Value string `json:"value"`
}

type Machine

type Machine struct {
	ID    string `json:"id"`
	Value string `json:"value"`
}

type Root

type Root struct {
	Machines   interface{} `json:"machines"`
	Challenges interface{} `json:"challenges"`
	Usernames  interface{} `json:"users"`
}

type Username added in v1.3.0

type Username struct {
	ID    string `json:"id"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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