api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PatchSettings

func PatchSettings(client *ctfd.Client, params PatchSettingsParams, opts ...ctfd.Option) error

PatchSettings handle the patch of CTFd-Chall-Manager settings.

Types

type Challenge

type Challenge struct {
	ID             int                `json:"id"`
	Name           string             `json:"name"`
	Description    string             `json:"description"`
	Attribution    *string            `json:"attribution,omitempty"`
	ConnectionInfo *string            `json:"connection_info,omitempty"`
	MaxAttempts    *int               `json:"max_attempts,omitempty"`
	Function       *string            `json:"function,omitempty"`
	Value          int                `json:"value"`
	Initial        *int               `json:"initial,omitempty"`
	Decay          *int               `json:"decay,omitempty"`
	Minimum        *int               `json:"minimum,omitempty"`
	Category       string             `json:"category"`
	Type           string             `json:"type"`
	TypeData       *ctfd.Type         `json:"type_data,omitempty"`
	State          string             `json:"state"`
	NextID         *int               `json:"next_id"`
	Requirements   *ctfd.Requirements `json:"requirements"` // List of challenge IDs to complete before
	Solves         int                `json:"solves"`
	SolvedByMe     bool               `json:"solved_by_me"`

	DestroyOnFlag bool              `json:"destroy_on_flag"`
	Shared        bool              `json:"shared"`
	ManaCost      int               `json:"mana_cost"`
	ScenarioID    int               `json:"scenario_id"`
	Until         *string           `json:"until,omitempty"`
	Timeout       *int              `json:"timeout,omitempty"`
	Additional    map[string]string `json:"additional,omitempty"`
	Min           int               `json:"min"`
	Max           int               `json:"max"`
}

func GetChallenge

func GetChallenge(client *ctfd.Client, id string, opts ...ctfd.Option) (*Challenge, error)

GetChallenge return the challenge corresponding to the given id, in the CTFd-Chall-Manager plugin datamodel.

func PatchChallenges

func PatchChallenges(client *ctfd.Client, id string, params *PatchChallengeParams, opts ...ctfd.Option) (*Challenge, error)

PatchChallenges updates a challenge configuration.

func PostChallenges

func PostChallenges(client *ctfd.Client, params *PostChallengesParams, opts ...ctfd.Option) (*Challenge, error)

PostChallenges creates a CTFd-Chall-Manager plugin challenge.

type DeleteAdminInstanceParams

type DeleteAdminInstanceParams struct {
	ChallengeID string `json:"challengeId"`
	SourceID    string `json:"sourceId"`
}

type DeleteInstanceParams

type DeleteInstanceParams struct {
	ChallengeID string `json:"challengeId"`
}

type GetAdminInstanceParams

type GetAdminInstanceParams struct {
	ChallengeID string `schema:"challengeId"`
	SourceID    string `schema:"soureId"`
}

type GetInstanceParams

type GetInstanceParams struct {
	ChallengeID string `schema:"challengeId"`
}

type Instance

type Instance struct {
	ConnectionInfo string `json:"connectionInfo"`
	Until          string `json:"until"`
}

func DeleteAdminInstance

func DeleteAdminInstance(client *ctfd.Client, params *DeleteAdminInstanceParams, opts ...ctfd.Option) (*Instance, error)

func DeleteInstance

func DeleteInstance(client *ctfd.Client, params *DeleteInstanceParams, opts ...ctfd.Option) (*Instance, error)

func GetAdminInstance

func GetAdminInstance(client *ctfd.Client, params *GetAdminInstanceParams, opts ...ctfd.Option) (*Instance, error)

func GetInstance

func GetInstance(client *ctfd.Client, params *GetInstanceParams, opts ...ctfd.Option) (*Instance, error)

func PatchAdminInstance

func PatchAdminInstance(client *ctfd.Client, params *PatchAdminInstanceParams, opts ...ctfd.Option) (*Instance, error)

func PatchInstance

func PatchInstance(client *ctfd.Client, params *PatchInstanceParams, opts ...ctfd.Option) (*Instance, error)

func PostAdminInstance

func PostAdminInstance(client *ctfd.Client, params *PostAdminInstanceParams, opts ...ctfd.Option) (*Instance, error)

func PostInstance

func PostInstance(client *ctfd.Client, params *PostInstanceParams, opts ...ctfd.Option) (*Instance, error)

type Mana

type Mana struct {
	Used  int `json:"mana_used"`
	Total int `json:"mana_total"`
}

func GetMana

func GetMana(client *ctfd.Client, opts ...ctfd.Option) (*Mana, error)

type PatchAdminInstanceParams

type PatchAdminInstanceParams struct {
	ChallengeID string `json:"challengeId"`
	SourceID    string `json:"sourceId"`
}

type PatchChallengeParams

type PatchChallengeParams struct {
	Name           string  `json:"name"`
	Category       string  `json:"category"`
	Description    string  `json:"description"`
	Attribution    *string `json:"attribution,omitempty"`
	Function       *string `json:"function,omitempty"`
	ConnectionInfo *string `json:"connection_info,omitempty"`
	Value          *int    `json:"value,omitempty"`
	Initial        *int    `json:"initial,omitempty"`
	Decay          *int    `json:"decay,omitempty"`
	Minimum        *int    `json:"minimum,omitempty"`
	MaxAttempts    *int    `json:"max_attempts,omitempty"`
	NextID         *int    `json:"next_id,omitempty"`
	// Requirements can update the challenge's behavior and prerequisites i.e.
	// the other challenges the team/user must have solved before.
	// WARNING: it won't return those in the response body, so updating this
	// field requires you to do it manually through *Client.GetChallengeRequirements
	Requirements *ctfd.Requirements `json:"requirements,omitempty"`
	State        string             `json:"state"`

	DestroyOnFlag bool              `json:"destroy_on_flag"`
	Shared        bool              `json:"shared"`
	ManaCost      int               `json:"mana_cost"`
	ScenarioID    int               `json:"scenario_id"`
	Timeout       *int              `json:"timeout,omitempty"`
	Until         *string           `json:"until,omitempty"`
	Additional    map[string]string `json:"additional,omitempty"`
	Min           int               `json:"min"`
	Max           int               `json:"max"`
}

type PatchInstanceParams

type PatchInstanceParams struct {
	ChallengeID string `json:"challengeId"`
}

type PatchSettingsParams

type PatchSettingsParams struct {
	APIURL    string `json:"chall-manager:chall-manager_api_url"`
	ManaTotal int    `json:"chall-manager:chall-manager_mana_total"`
}

type PostAdminInstanceParams

type PostAdminInstanceParams struct {
	ChallengeID string `json:"challengeId"`
	SourceID    string `json:"sourceId"`
}

type PostChallengesParams

type PostChallengesParams struct {
	Name           string             `json:"name"`
	Category       string             `json:"category"`
	Description    string             `json:"description"`
	Attribution    *string            `json:"attribution,omitempty"`
	Function       *string            `json:"function,omitempty"`
	ConnectionInfo *string            `json:"connection_info,omitempty"`
	Initial        *int               `json:"initial,omitempty"`
	Decay          *int               `json:"decay,omitempty"`
	Minimum        *int               `json:"minimum,omitempty"`
	MaxAttempts    *int               `json:"max_attempts,omitempty"`
	NextID         *int               `json:"next_id,omitempty"`
	Requirements   *ctfd.Requirements `json:"requirements,omitempty"`
	State          string             `json:"state"`
	Type           string             `json:"type"`

	DestroyOnFlag bool              `json:"destroy_on_flag"`
	Shared        bool              `json:"shared"`
	ManaCost      int               `json:"mana_cost"`
	ScenarioID    int               `json:"scenario_id"`
	Timeout       *int              `json:"timeout,omitempty"`
	Until         *string           `json:"until,omitempty"`
	Additional    map[string]string `json:"additional,omitempty"`
	Min           int               `json:"min"`
	Max           int               `json:"max"`
}

type PostInstanceParams

type PostInstanceParams struct {
	ChallengeID string `json:"challengeId"`
}

Jump to

Keyboard shortcuts

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