sdk

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hostname

func Hostname(challID, sourceID, hostname string) string

Hostname deterministically provides a hostname based on the scenario request info. Its intended use is with an ingress such that other players won't be able to guess the other instances routes (avoid cheating through instance DoS). The `sourceID` is the user or team ID, depending on the `mode` the CTF runs in.

func Run

func Run(f Factory)

Run is a SDK helper to ease the creation of challenge factories. You only need to provide a factory function, and the chall-manager will build an API around it such that it could pilot it.

func Variate

func Variate(identity, base string, opts ...VariateOption) string

Variate consumes the identity as a pseudo-random seed and variate the base. Produced value fits printable ASCII extended charset, and is pseudo-random too but not cryptographically guaranteed.

Types

type Configuration

type Configuration struct {
	Identity string
}

Configuration is the struct that contains the flattened configuration from a chall-manager stack up.

func Load

func Load(ctx *pulumi.Context, project string) *Configuration

Load flatten the Pulumi stack configuration into a ready-to-use struct.

type Factory

type Factory func(req *Request, resp *Response, opts ...pulumi.ResourceOption) error

Factory define the prototype a IaC factory have to implement to be used by the SDK.

type Request

type Request struct {
	Ctx    *pulumi.Context
	Config *Configuration
}

Request sent by the chall-manager SDK to the IaC factory.

type Response

type Response struct {
	ConnectionInfo pulumi.StringOutput
	Flag           pulumi.StringOutput
}

Response is created and returned by a factory to the SDK in order to respond to the chall-manager API call once IaC ran.

type VariateOption

type VariateOption interface {
	// contains filtered or unexported methods
}

VariateOption is a functional option to guide the Variate function in its behaviors.

func WithLowercase

func WithLowercase(b bool) VariateOption

WithLowercase enables to set the behavior regarding the variation from and to lowercase character. Defaults to true.

If set to true, lowercase character is part of the variation possibilities in which an alternative will be choosen. If set to false, character won't be variated and won't be an alternative.

func WithNumeric

func WithNumeric(b bool) VariateOption

WithNumeric enables to set the behavior regarding the variation from and to numeric character. Default to true.

If set to true, numeric character is part of the variation possibilities in which an alternative will be choosen. If set to false, character won't be variated and won't be an alternative.

func WithSpecial

func WithSpecial(b bool) VariateOption

WithSpecial enables to set the behavior regarding the variation from and to special characters. Defaults to false.

If set to true, special characters is part of the variation possibilities in which an alternative will be choosen. This can lead to hardly-readable variations, possible inconsistencies on printing, or errors if injected in configurations. It is nonetheless a good way of improving outcomes randomness. Is set to false, character won't be variated and won't be an alternative.

func WithUppercase

func WithUppercase(b bool) VariateOption

WithUppercase enables to set the behavior regarding the variation from and to uppercase character. Defaults to true.

If set to true, uppercase character is part of the variation possibilities in which an alternative will be choosen. If set to false, character won't be variated and won't be an alternative.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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