Documentation ¶
Index ¶
- func GetNonceAndSession(url string, opts ...Option) (nonce string, session string, err error)
- type Attempt
- type Award
- type Bracket
- type CUV
- type Challenge
- type Client
- func (client *Client) DeleteAward(id string, opts ...Option) error
- func (client *Client) DeleteChallenge(id int, opts ...Option) error
- func (client *Client) DeleteComment(id int, opts ...Option) error
- func (client *Client) DeleteConfigsByKey(key string, opts ...Option) error
- func (client *Client) DeleteConfigsField(id string, opts ...Option) error
- func (client *Client) DeleteFile(id string, opts ...Option) error
- func (client *Client) DeleteFlag(id string, opts ...Option) error
- func (client *Client) DeleteHint(id string, opts ...Option) error
- func (client *Client) DeleteNotification(id string, opts ...Option) error
- func (client *Client) DeletePage(id string, opts ...Option) error
- func (client *Client) DeleteSubmission(id string, opts ...Option) error
- func (client *Client) DeleteTag(id string, opts ...Option) error
- func (client *Client) DeleteTeam(id int, opts ...Option) error
- func (client *Client) DeleteTeamMembers(id int, params *DeleteTeamMembersParams, opts ...Option) ([]int, error)
- func (client *Client) DeleteTeamsMe(opts ...Option) error
- func (client *Client) DeleteToken(id string, opts ...Option) error
- func (client *Client) DeleteTopic(params *DeleteTopicArgs, opts ...Option) error
- func (client *Client) DeleteUser(id int, opts ...Option) error
- func (client *Client) Do(req *http.Request) (*http.Response, error)
- func (client *Client) ExportRaw(params *ExportRawParams, opts ...Option) ([]byte, error)
- func (client *Client) GetAward(id string, opts ...Option) (*Award, error)
- func (client *Client) GetAwards(params *GetAwardsParams, opts ...Option) ([]*Award, error)
- func (client *Client) GetBrackets(params *GetBracketsParams, opts ...Option) ([]*Bracket, error)
- func (client *Client) GetChallenge(id int, opts ...Option) (*Challenge, error)
- func (client *Client) GetChallengeFiles(id int, opts ...Option) ([]*File, error)
- func (client *Client) GetChallengeFlags(id int, opts ...Option) ([]*Flag, error)
- func (client *Client) GetChallengeHints(id int, opts ...Option) ([]*Hint, error)
- func (client *Client) GetChallengeRequirements(id int, opts ...Option) (*Requirements, error)
- func (client *Client) GetChallengeSolves(id int, opts ...Option) (*Challenge, error)
- func (client *Client) GetChallengeTags(id int, opts ...Option) ([]*Tag, error)
- func (client *Client) GetChallengeTopics(id int, opts ...Option) ([]*Topic, error)
- func (client *Client) GetChallenges(params *GetChallengesParams, opts ...Option) ([]*Challenge, error)
- func (client *Client) GetChallengesTypes(opts ...Option) (map[string]*Type, error)
- func (client *Client) GetComments(params *GetCommentsParams, opts ...Option) ([]*Comment, error)
- func (client *Client) GetConfigs(params *GetConfigsParams, opts ...Option) ([]*Config, error)
- func (client *Client) GetConfigsByKey(key string, opts ...Option) (any, error)
- func (client *Client) GetConfigsField(id string, opts ...Option) (*ConfigField, error)
- func (client *Client) GetConfigsFields(params *GetConfigsParams, opts ...Option) ([]*ConfigField, error)
- func (client *Client) GetFile(id string, opts ...Option) (*File, error)
- func (client *Client) GetFileContent(file *File, opts ...Option) ([]byte, error)
- func (client *Client) GetFiles(params *GetFilesParams, opts ...Option) ([]*File, error)
- func (client *Client) GetFlag(id string, opts ...Option) (*Flag, error)
- func (client *Client) GetFlags(params *GetFlagsParams, opts ...Option) ([]*Flag, error)
- func (client *Client) GetFlagsType(typename string, opts ...Option) (*Type, error)
- func (client *Client) GetFlagsTypes(opts ...Option) (map[string]*Type, error)
- func (client *Client) GetHint(id string, opts ...Option) (*Hint, error)
- func (client *Client) GetHints(params *GetHintsParams, opts ...Option) ([]*Hint, error)
- func (client *Client) GetNotification(id string, opts ...Option) (*Notification, error)
- func (client *Client) GetNotifications(params *GetNotificationsParams, opts ...Option) ([]*Notification, error)
- func (client *Client) GetPage(id string, opts ...Option) (*Page, error)
- func (client *Client) GetPages(params *GetPagesParams, opts ...Option) ([]*Page, error)
- func (client *Client) GetScoreboard(opts ...Option) ([]*Scoreboard, error)
- func (client *Client) GetScoreboardTop(params *GetScoreboardTopParams, opts ...Option) (map[string]*Scoreboard, error)
- func (client *Client) GetStatisticsChallengesColumn(column string, opts ...Option) (map[string]int, error)
- func (client *Client) GetStatisticsChallengesSolves(opts ...Option) ([]*StatChallSubmission, error)
- func (client *Client) GetStatisticsScoresDistribution(opts ...Option) (*Distribution, error)
- func (client *Client) GetStatisticsSubmissionsColumn(column string, opts ...Option) (map[string]int, error)
- func (client *Client) GetStatisticsTeams(opts ...Option) (*StatTeams, error)
- func (client *Client) GetStatisticsUsers(opts ...Option) (*StatUsers, error)
- func (client *Client) GetStatisticsUsersColumn(column string, opts ...Option) (*StatUsers, error)
- func (client *Client) GetSubmission(id string, opts ...Option) (*Submission, error)
- func (client *Client) GetSubmissions(params *GetSubmissionsParams, opts ...Option) ([]*Submission, error)
- func (client *Client) GetTag(id string, opts ...Option) (*Tag, error)
- func (client *Client) GetTags(params *GetTagsParams, opts ...Option) ([]*Tag, error)
- func (client *Client) GetTeam(id int, opts ...Option) (*Team, error)
- func (client *Client) GetTeamAwards(id int, opts ...Option) ([]*Award, error)
- func (client *Client) GetTeamFails(id int, opts ...Option) ([]*Submission, error)
- func (client *Client) GetTeamMembers(id int, opts ...Option) ([]int, error)
- func (client *Client) GetTeamSolves(id int, opts ...Option) ([]*Submission, error)
- func (client *Client) GetTeams(params *GetTeamsParams, opts ...Option) ([]*Team, error)
- func (client *Client) GetTeamsMe(opts ...Option) (*Team, error)
- func (client *Client) GetTeamsMeAwards(opts ...Option) ([]*Award, error)
- func (client *Client) GetTeamsMeFails(opts ...Option) ([]*Submission, error)
- func (client *Client) GetTeamsMeSolves(opts ...Option) ([]*Submission, error)
- func (client *Client) GetToken(id string, opts ...Option) (*Token, error)
- func (client *Client) GetTokens(opts ...Option) ([]*Token, error)
- func (client *Client) GetTopic(id string, opts ...Option) (*Topic, error)
- func (client *Client) GetTopics(params *GetTopicsParams, opts ...Option) ([]*Topic, error)
- func (client *Client) GetUnlocks(params *GetUnlocksParams, opts ...Option) ([]*Unlock, error)
- func (client *Client) GetUser(id int, opts ...Option) (*User, error)
- func (client *Client) GetUserAwards(id int, opts ...Option) ([]*Award, error)
- func (client *Client) GetUserFails(id int, opts ...Option) ([]*Submission, error)
- func (client *Client) GetUserSolves(id int, opts ...Option) ([]*Submission, error)
- func (client *Client) GetUsers(params *GetUsersParams, opts ...Option) ([]*User, error)
- func (client *Client) GetUsersMe(opts ...Option) (*User, error)
- func (client *Client) GetUsersMeAwards(opts ...Option) ([]*Award, error)
- func (client *Client) GetUsersMeFails(opts ...Option) ([]*Submission, error)
- func (client *Client) GetUsersMeSolves(opts ...Option) ([]*Submission, error)
- func (client *Client) HeadNotifications(params *HeadNotificationsParams, opts ...Option) (int, error)
- func (client *Client) Login(params *LoginParams, opts ...Option) error
- func (client *Client) Logout(opts ...Option) error
- func (client *Client) PatchChallenge(id int, params *PatchChallengeParams, opts ...Option) (*Challenge, error)
- func (client *Client) PatchConfigs(params *PatchConfigsParams, opts ...Option) error
- func (client *Client) PatchConfigsByKey(key string, params any, opts ...Option) (any, error)
- func (client *Client) PatchConfigsCTFLogo(params *PatchConfigsCTFLogo, opts ...Option) (*ThemeImage, error)
- func (client *Client) PatchConfigsCTFSmallIcon(params *PatchConfigsCTFLogo, opts ...Option) (*ThemeImage, error)
- func (client *Client) PatchConfigsField(id string, params *PatchConfigsFieldParams, opts ...Option) (*ConfigField, error)
- func (client *Client) PatchFlag(id string, params *PatchFlagParams, opts ...Option) (*Flag, error)
- func (client *Client) PatchHint(id string, params *PatchHintsParams, opts ...Option) (*Hint, error)
- func (client *Client) PatchPage(id string, params *PatchPageParams, opts ...Option) (*Page, error)
- func (client *Client) PatchTags(id string, params *PatchTagsParams, opts ...Option) (*Tag, error)
- func (client *Client) PatchTeam(id int, params *PatchTeamsParams, opts ...Option) (*Team, error)
- func (client *Client) PatchTeamsMe(params *PatchTeamsParams, opts ...Option) (*Team, error)
- func (client *Client) PatchUser(id int, params *PatchUsersParams, opts ...Option) (*User, error)
- func (client *Client) PatchUsersMe(params *PatchUsersParams, opts ...Option) (*User, error)
- func (client *Client) PostAwards(params *PostAwardsParams, opts ...Option) (*Award, error)
- func (client *Client) PostBrackets(params *PostBracketsParams, opts ...Option) (*Bracket, error)
- func (client *Client) PostChallenges(params *PostChallengesParams, opts ...Option) (*Challenge, error)
- func (client *Client) PostChallengesAttempt(params *PostChallengesAttemptParams, opts ...Option) (*Attempt, error)
- func (client *Client) PostComments(params *PostCommentsParams, opts ...Option) (*Comment, error)
- func (client *Client) PostConfigFields(params *PostConfigFieldsParams, opts ...Option) (*ConfigField, error)
- func (client *Client) PostConfigs(params *PostConfigsParams, opts ...Option) (*Config, error)
- func (client *Client) PostFiles(params *PostFilesParams, opts ...Option) ([]*File, error)
- func (client *Client) PostFlags(params *PostFlagsParams, opts ...Option) (*Flag, error)
- func (client *Client) PostHints(params *PostHintsParams, opts ...Option) (*Hint, error)
- func (client *Client) PostNotifications(params *PostNotificationsParams, opts ...Option) (*Notification, error)
- func (client *Client) PostPages(params *PostPagesParams, opts ...Option) (*Page, error)
- func (client *Client) PostTags(params *PostTagsParams, opts ...Option) (*Tag, error)
- func (client *Client) PostTeamMembers(id int, params *PostTeamsMembersParams, opts ...Option) (int, error)
- func (client *Client) PostTeams(params *PostTeamsParams, opts ...Option) (*Team, error)
- func (client *Client) PostTeamsMeMembers(params *PostTeamsMembersParams, opts ...Option) (*Team, error)
- func (client *Client) PostTokens(params *PostTokensParams, opts ...Option) (*Token, error)
- func (client *Client) PostTopics(params *PostTopicsParams, opts ...Option) (*Topic, error)
- func (client *Client) PostUnlocks(params *PostUnlocksParams, opts ...Option) (*Unlock, error)
- func (client *Client) PostUserMail(params *PostUserMailParams, id int, opts ...Option) (any, error)
- func (client *Client) PostUsers(params *PostUsersParams, opts ...Option) (*User, error)
- func (client *Client) Register(params *RegisterParams, opts ...Option) error
- func (client *Client) Reset(params *ResetParams, opts ...Option) error
- func (client *Client) SetAPIKey(apiKey string)
- func (client *Client) Setup(params *SetupParams, opts ...Option) error
- type Comment
- type Config
- type ConfigField
- type DeleteTeamMembersParams
- type DeleteTopicArgs
- type Distribution
- type ExportRawArgsParams
- type ExportRawParams
- type Field
- type File
- type Flag
- type GetAwardsParams
- type GetBracketsParams
- type GetChallengesParams
- type GetCommentsParams
- type GetConfigsFieldsParams
- type GetConfigsParams
- type GetFilesParams
- type GetFlagsParams
- type GetHintsParams
- type GetNotificationsParams
- type GetPagesParams
- type GetScoreboardTopParams
- type GetSubmissionsParams
- type GetTagsParams
- type GetTeamsParams
- type GetTopicsParams
- type GetUnlocksParams
- type GetUsersParams
- type HeadNotificationsParams
- type Hint
- type InputFile
- type LoginParams
- type Notification
- type Option
- type Page
- type PatchChallengeParams
- type PatchConfigsCTFLogo
- type PatchConfigsFieldParams
- type PatchConfigsParams
- type PatchFlagParams
- type PatchHintsParams
- type PatchPageParams
- type PatchTagsParams
- type PatchTeamsParams
- type PatchUsersParams
- type PostAwardsParams
- type PostBracketsParams
- type PostChallengesAttemptParams
- type PostChallengesParams
- type PostCommentsParams
- type PostConfigFieldsParams
- type PostConfigsParams
- type PostFilesParams
- type PostFlagsParams
- type PostHintsParams
- type PostNotificationsParams
- type PostPagesParams
- type PostTagsParams
- type PostTeamsMembersParams
- type PostTeamsParams
- type PostTokensParams
- type PostTopicsParams
- type PostUnlocksParams
- type PostUserMailParams
- type PostUsersParams
- type RegisterParams
- type Requirements
- type ResetParams
- type Response
- type Scoreboard
- type SetupParams
- type StatChallSubmission
- type StatTeams
- type StatUsers
- type Submission
- type Tag
- type Team
- type ThemeImage
- type Token
- type Topic
- type Type
- type Unlock
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Award ¶
type Award struct { ID int `json:"id"` TeamID int `json:"team_id"` Category *string `json:"category"` UserID int `json:"user_id"` Team int `json:"team"` // XXX may be duplicated with ID ? Date string `json:"date"` Description *string `json:"description"` User int `json:"user"` // XXX may be duplicated with UserID ? Type string `json:"type"` Value int `json:"value"` Requirements *Requirements `json:"requirements"` Name string `json:"name"` Icon string `json:"icon"` }
type Challenge ¶
type Challenge struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Attribution *string `json:"attribution"` 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"` TypeDate *Type `json:"type_data,omitempty"` State string `json:"state"` NextID *int `json:"next_id"` Requirements *Requirements `json:"requirements"` // List of challenge IDs to complete before Solves int `json:"solves"` SolvedByMe bool `json:"solved_by_me"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is in charge of interacting with a CTFd instance.
func NewClient ¶
NewClient creates a fresh *Client. It automatically handles the session and its updates (login, logout...).
func (*Client) DeleteChallenge ¶
func (*Client) DeleteConfigsByKey ¶
TODO confirm delete does not take parameters and returns anything
func (*Client) DeleteConfigsField ¶
func (*Client) DeleteNotification ¶
func (*Client) DeleteSubmission ¶
func (*Client) DeleteTeamMembers ¶
func (client *Client) DeleteTeamMembers(id int, params *DeleteTeamMembersParams, opts ...Option) ([]int, error)
XXX mixture of DELETE and body for control should be cleaned
func (*Client) DeleteTeamsMe ¶
func (*Client) DeleteTopic ¶
func (client *Client) DeleteTopic(params *DeleteTopicArgs, opts ...Option) error
TODO fix this endpoint API instability, should reconsider using a DELETE method with a JSON body rather that URL-encoded parameters as for all other endpoints
func (*Client) ExportRaw ¶ added in v0.7.0
func (client *Client) ExportRaw(params *ExportRawParams, opts ...Option) ([]byte, error)
func (*Client) GetAwards ¶
func (client *Client) GetAwards(params *GetAwardsParams, opts ...Option) ([]*Award, error)
func (*Client) GetBrackets ¶ added in v0.6.3
func (client *Client) GetBrackets(params *GetBracketsParams, opts ...Option) ([]*Bracket, error)
func (*Client) GetChallenge ¶
func (*Client) GetChallengeFiles ¶
func (*Client) GetChallengeFlags ¶
func (*Client) GetChallengeHints ¶
func (*Client) GetChallengeRequirements ¶
func (client *Client) GetChallengeRequirements(id int, opts ...Option) (*Requirements, error)
func (*Client) GetChallengeSolves ¶
TODO find content to determine model
func (*Client) GetChallengeTags ¶
func (*Client) GetChallengeTopics ¶
func (*Client) GetChallenges ¶
func (client *Client) GetChallenges(params *GetChallengesParams, opts ...Option) ([]*Challenge, error)
func (*Client) GetChallengesTypes ¶
func (*Client) GetComments ¶
func (client *Client) GetComments(params *GetCommentsParams, opts ...Option) ([]*Comment, error)
func (*Client) GetConfigs ¶
func (client *Client) GetConfigs(params *GetConfigsParams, opts ...Option) ([]*Config, error)
func (*Client) GetConfigsByKey ¶
TODO find model
func (*Client) GetConfigsField ¶
func (client *Client) GetConfigsField(id string, opts ...Option) (*ConfigField, error)
func (*Client) GetConfigsFields ¶
func (client *Client) GetConfigsFields(params *GetConfigsParams, opts ...Option) ([]*ConfigField, error)
func (*Client) GetFileContent ¶ added in v0.3.3
GetFileContent is a helper leveraging the CTFd API that downloads a file's content given its location.
func (*Client) GetFiles ¶
func (client *Client) GetFiles(params *GetFilesParams, opts ...Option) ([]*File, error)
func (*Client) GetFlags ¶
func (client *Client) GetFlags(params *GetFlagsParams, opts ...Option) ([]*Flag, error)
func (*Client) GetFlagsType ¶
func (*Client) GetFlagsTypes ¶
func (*Client) GetHints ¶
func (client *Client) GetHints(params *GetHintsParams, opts ...Option) ([]*Hint, error)
func (*Client) GetNotification ¶
func (client *Client) GetNotification(id string, opts ...Option) (*Notification, error)
func (*Client) GetNotifications ¶
func (client *Client) GetNotifications(params *GetNotificationsParams, opts ...Option) ([]*Notification, error)
func (*Client) GetPages ¶
func (client *Client) GetPages(params *GetPagesParams, opts ...Option) ([]*Page, error)
func (*Client) GetScoreboard ¶
func (client *Client) GetScoreboard(opts ...Option) ([]*Scoreboard, error)
func (*Client) GetScoreboardTop ¶
func (client *Client) GetScoreboardTop(params *GetScoreboardTopParams, opts ...Option) (map[string]*Scoreboard, error)
GetScoreboardTop returns the scoreboard top for the given count as a map of the rank by the entry.
func (*Client) GetStatisticsChallengesColumn ¶
func (*Client) GetStatisticsChallengesSolves ¶
func (client *Client) GetStatisticsChallengesSolves(opts ...Option) ([]*StatChallSubmission, error)
func (*Client) GetStatisticsScoresDistribution ¶
func (client *Client) GetStatisticsScoresDistribution(opts ...Option) (*Distribution, error)
func (*Client) GetStatisticsSubmissionsColumn ¶
func (*Client) GetStatisticsTeams ¶
func (*Client) GetStatisticsUsers ¶
func (*Client) GetStatisticsUsersColumn ¶
func (*Client) GetSubmission ¶
func (client *Client) GetSubmission(id string, opts ...Option) (*Submission, error)
func (*Client) GetSubmissions ¶
func (client *Client) GetSubmissions(params *GetSubmissionsParams, opts ...Option) ([]*Submission, error)
TODO support pagination ? CTFd does not seem to support parameters for this
func (*Client) GetTags ¶
func (client *Client) GetTags(params *GetTagsParams, opts ...Option) ([]*Tag, error)
func (*Client) GetTeamAwards ¶
func (*Client) GetTeamFails ¶
func (client *Client) GetTeamFails(id int, opts ...Option) ([]*Submission, error)
func (*Client) GetTeamMembers ¶
func (*Client) GetTeamSolves ¶
func (client *Client) GetTeamSolves(id int, opts ...Option) ([]*Submission, error)
func (*Client) GetTeams ¶
func (client *Client) GetTeams(params *GetTeamsParams, opts ...Option) ([]*Team, error)
func (*Client) GetTeamsMeAwards ¶
func (*Client) GetTeamsMeFails ¶
func (client *Client) GetTeamsMeFails(opts ...Option) ([]*Submission, error)
func (*Client) GetTeamsMeSolves ¶
func (client *Client) GetTeamsMeSolves(opts ...Option) ([]*Submission, error)
func (*Client) GetToken ¶
XXX Using this endpoint, you could get back the token value which is not a desired behaviour ! Issue #2309
func (*Client) GetTopics ¶
func (client *Client) GetTopics(params *GetTopicsParams, opts ...Option) ([]*Topic, error)
func (*Client) GetUnlocks ¶
func (client *Client) GetUnlocks(params *GetUnlocksParams, opts ...Option) ([]*Unlock, error)
func (*Client) GetUserAwards ¶
func (*Client) GetUserFails ¶
func (client *Client) GetUserFails(id int, opts ...Option) ([]*Submission, error)
func (*Client) GetUserSolves ¶
func (client *Client) GetUserSolves(id int, opts ...Option) ([]*Submission, error)
func (*Client) GetUsers ¶
func (client *Client) GetUsers(params *GetUsersParams, opts ...Option) ([]*User, error)
TODO handle pagination, but don't seem supported by CTFd API
func (*Client) GetUsersMeAwards ¶
func (*Client) GetUsersMeFails ¶
func (client *Client) GetUsersMeFails(opts ...Option) ([]*Submission, error)
func (*Client) GetUsersMeSolves ¶
func (client *Client) GetUsersMeSolves(opts ...Option) ([]*Submission, error)
func (*Client) HeadNotifications ¶
func (client *Client) HeadNotifications(params *HeadNotificationsParams, opts ...Option) (int, error)
XXX does not need to be authenticated. Issue #2310
func (*Client) Login ¶
func (client *Client) Login(params *LoginParams, opts ...Option) error
Returns the session value or an error.
WARNING 1: this endpoint is not officially supported. WARNING 2: provided client must have a no-follow-redirect behaviour, or a cookie jar. Else, it won't detect the login worked properly thus won't extract and save the new session id.
func (*Client) PatchChallenge ¶
func (*Client) PatchConfigs ¶
func (client *Client) PatchConfigs(params *PatchConfigsParams, opts ...Option) error
func (*Client) PatchConfigsByKey ¶
TODO find input model
func (*Client) PatchConfigsCTFLogo ¶ added in v0.6.3
func (client *Client) PatchConfigsCTFLogo(params *PatchConfigsCTFLogo, opts ...Option) (*ThemeImage, error)
func (*Client) PatchConfigsCTFSmallIcon ¶ added in v0.6.3
func (client *Client) PatchConfigsCTFSmallIcon(params *PatchConfigsCTFLogo, opts ...Option) (*ThemeImage, error)
func (*Client) PatchConfigsField ¶
func (client *Client) PatchConfigsField(id string, params *PatchConfigsFieldParams, opts ...Option) (*ConfigField, error)
func (*Client) PatchTeamsMe ¶
func (client *Client) PatchTeamsMe(params *PatchTeamsParams, opts ...Option) (*Team, error)
func (*Client) PatchUsersMe ¶
func (client *Client) PatchUsersMe(params *PatchUsersParams, opts ...Option) (*User, error)
func (*Client) PostAwards ¶
func (client *Client) PostAwards(params *PostAwardsParams, opts ...Option) (*Award, error)
func (*Client) PostBrackets ¶ added in v0.6.3
func (client *Client) PostBrackets(params *PostBracketsParams, opts ...Option) (*Bracket, error)
func (*Client) PostChallenges ¶
func (client *Client) PostChallenges(params *PostChallengesParams, opts ...Option) (*Challenge, error)
func (*Client) PostChallengesAttempt ¶
func (client *Client) PostChallengesAttempt(params *PostChallengesAttemptParams, opts ...Option) (*Attempt, error)
func (*Client) PostComments ¶
func (client *Client) PostComments(params *PostCommentsParams, opts ...Option) (*Comment, error)
func (*Client) PostConfigFields ¶
func (client *Client) PostConfigFields(params *PostConfigFieldsParams, opts ...Option) (*ConfigField, error)
func (*Client) PostConfigs ¶
func (client *Client) PostConfigs(params *PostConfigsParams, opts ...Option) (*Config, error)
func (*Client) PostFiles ¶
func (client *Client) PostFiles(params *PostFilesParams, opts ...Option) ([]*File, error)
func (*Client) PostFlags ¶
func (client *Client) PostFlags(params *PostFlagsParams, opts ...Option) (*Flag, error)
func (*Client) PostHints ¶
func (client *Client) PostHints(params *PostHintsParams, opts ...Option) (*Hint, error)
func (*Client) PostNotifications ¶
func (client *Client) PostNotifications(params *PostNotificationsParams, opts ...Option) (*Notification, error)
func (*Client) PostPages ¶
func (client *Client) PostPages(params *PostPagesParams, opts ...Option) (*Page, error)
XXX find if could use constraint error on .route to get a shell using the PIN form on sqlalchemy.exc.IntegrityError
func (*Client) PostTags ¶
func (client *Client) PostTags(params *PostTagsParams, opts ...Option) (*Tag, error)
func (*Client) PostTeamMembers ¶
func (*Client) PostTeams ¶
func (client *Client) PostTeams(params *PostTeamsParams, opts ...Option) (*Team, error)
func (*Client) PostTeamsMeMembers ¶
func (client *Client) PostTeamsMeMembers(params *PostTeamsMembersParams, opts ...Option) (*Team, error)
func (*Client) PostTokens ¶
func (client *Client) PostTokens(params *PostTokensParams, opts ...Option) (*Token, error)
func (*Client) PostTopics ¶
func (client *Client) PostTopics(params *PostTopicsParams, opts ...Option) (*Topic, error)
func (*Client) PostUnlocks ¶
func (client *Client) PostUnlocks(params *PostUnlocksParams, opts ...Option) (*Unlock, error)
func (*Client) PostUserMail ¶
TODO find model when email turned on
func (*Client) PostUsers ¶
func (client *Client) PostUsers(params *PostUsersParams, opts ...Option) (*User, error)
func (*Client) Register ¶
func (client *Client) Register(params *RegisterParams, opts ...Option) error
type ConfigField ¶
type DeleteTeamMembersParams ¶
type DeleteTeamMembersParams struct {
UserID int `json:"user_id"`
}
type DeleteTopicArgs ¶ added in v0.3.6
type Distribution ¶
type ExportRawArgsParams ¶ added in v0.7.0
type ExportRawArgsParams struct { // Table, if specified, exports the given table in the specified type. Table *string `json:"table,omitempty"` }
type ExportRawParams ¶ added in v0.7.0
type ExportRawParams struct { // Type could be "csv" (which returns the table dump in csv) or // anything (returns a zip). Type string `json:"type"` // Args contains all the arguments to export specific content. Args ExportRawArgsParams `json:"args"` }
type GetAwardsParams ¶
type GetAwardsParams struct { UserID *int `schema:"user_id,omitempty"` TeamID *int `schema:"team_id,omitempty"` Type *string `schema:"type,omitempty"` Value *int `schema:"value,omitempty"` Category *int `schema:"category,omitempty"` Icon *int `schema:"icon,omitempty"` Q *string `schema:"q,omitempty"` Field *string `schema:"field,omitempty"` }
type GetBracketsParams ¶ added in v0.6.3
type GetBracketsParams struct{}
type GetChallengesParams ¶
type GetChallengesParams struct { Name *string `schema:"name,omitempty"` MaxAttempts *int `schema:"max_attempts,omitempty"` Value *int `schema:"value,omitempty"` Category *int `schema:"category,omitempty"` Type *string `schema:"type,omitempty"` State *string `schema:"state,omitempty"` Q *string `schema:"q,omitempty"` // If view is set to admin, returns all challenges (not only the visible ones). View *string `schema:"view,omitempty"` }
type GetCommentsParams ¶
type GetConfigsFieldsParams ¶
type GetConfigsParams ¶
type GetFilesParams ¶
type GetFlagsParams ¶
type GetHintsParams ¶
type GetNotificationsParams ¶
type GetNotificationsParams struct { Title *string `schema:"title,omitempty"` Content *string `schema:"content,omitempty"` UserID *int `schema:"user_id,omitempty"` TeamID *int `schema:"team_id,omitempty"` Q *string `schema:"q,omitempty"` Field *string `schema:"field,omitempty"` SinceID *int `schema:"since_id,omitempty"` }
type GetPagesParams ¶
type GetPagesParams struct { ID *int `schema:"id,omitempty"` Title *string `schema:"title,omitempty"` Route *string `schema:"route,omitempty"` Draft *bool `schema:"draft,omitempty"` Hidden *bool `schema:"hidden,omitempty"` AuthRequired *bool `schema:"auth_required,omitempty"` Q *string `schema:"q,omitempty"` Field *string `schema:"field,omitempty"` }
type GetScoreboardTopParams ¶ added in v0.7.0
type GetScoreboardTopParams struct { // Count is the top number of players to get the info. Count int `schema:"-"` // BracketID is an optional parameter to filter on a specific bracket. BracketID *int `schema:"bracket_id,omitempty"` }
GetScoreboardTopParams holds the parameters for the scoreboard top count endpoint.
type GetSubmissionsParams ¶
type GetSubmissionsParams struct { ChallengeID *int `schema:"challenge_id,omitempty"` UserID *int `schema:"user_id,omitempty"` TeamID *int `schema:"team_id,omitempty"` IP *string `schema:"ip,omitempty"` Provided *string `schema:"provided,omitempty"` Type *string `schema:"type,omitempty"` Q *string `schema:"q,omitempty"` Field *string `schema:"field,omitempty"` }
type GetTagsParams ¶
type GetTeamsParams ¶
type GetTopicsParams ¶
type GetUnlocksParams ¶
type GetUsersParams ¶
type HeadNotificationsParams ¶
type HeadNotificationsParams struct { Title *string `schema:"title,omitempty"` Content *string `schema:"content,omitempty"` UserID *int `schema:"user_id,omitempty"` TeamID *int `schema:"team_id,omitempty"` Q *string `schema:"q,omitempty"` Field *string `schema:"field,omitempty"` SinceID *int `schema:"since_id,omitempty"` }
type Hint ¶
type Hint struct { ID int `json:"id"` HTML *string `json:"html,omitempty"` Content *string `json:"content,omitempty"` Cost int `json:"cost"` Type string `json:"type"` ChallengeID int `json:"challenge_id"` Challenge int `json:"challenge"` // XXX may be duplicated with ChallengeID ? Requirements *Requirements `json:"requirements,omitempty"` }
type LoginParams ¶
type Notification ¶
type Notification struct { ID int `json:"id"` TeamID *int `json:"team_id"` // XXX may be duplicated with Team ? HTML string `json:"html"` UserID *int `json:"user_id"` // XXX may be duplicated with User ? Team *int `json:"team"` Content string `json:"content"` Date string `json:"date"` Title string `json:"title"` User *int `json:"user"` Type *string `json:"type,omitempty"` Sound *bool `json:"sound,omitempty"` }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithContext ¶
type Page ¶
type Page struct { Files []any `json:"files"` // XXX find model ID int `json:"id"` Draft bool `json:"draft"` Route string `json:"route"` Title string `json:"title"` Hidden bool `json:"hidden"` Format string `json:"format"` AuthRequired bool `json:"auth_required"` Content *string `json:"content,omitempty"` }
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 *Requirements `json:"requirements,omitempty"` State string `json:"state"` }
type PatchConfigsCTFLogo ¶ added in v0.6.3
type PatchConfigsCTFLogo struct {
Value *string `json:"value"`
}
type PatchConfigsFieldParams ¶
type PatchConfigsFieldParams struct { ID int `json:"id"` // XXX duplicated with the ID in URL Name string `json:"name"` Description string `json:"description"` FieldType string `json:"field_type"` Type string `json:"type"` Editable bool `json:"editable"` Public bool `json:"public"` Required bool `json:"required"` }
type PatchConfigsParams ¶
type PatchConfigsParams struct { CTFDescription *string `json:"ctf_description,omitempty"` CTFName *string `json:"ctf_name,omitempty"` CTFTheme *string `json:"ctf_theme,omitempty"` ThemeHeader *string `json:"theme_header,omitempty"` ThemeSettings *string `json:"theme_settings,omitempty"` DefaultLocale *string `json:"default_locale,omitempty"` DomainWhitelist *string `json:"domain_whitelist,omitempty"` IncorrectSubmissionsPerMin *int `json:"incorrect_submissions_per_min,omitempty"` NameChanges *bool `json:"name_changes,omitempty"` NumTeams *int `json:"num_teams,omitempty"` NumUsers *int `json:"num_users,omitempty"` TeamCreation *bool `json:"team_creation,omitempty"` TeamDisbanding *string `json:"team_disbanding,omitempty"` TeamSize *int `json:"team_size,omitempty"` VerifyEmails *bool `json:"verify_emails,omitempty"` RobotsTxt *string `json:"robots_txt,omitempty"` OauthClientID *string `json:"oauth_client_id,omitempty"` OauthClientSecret *string `json:"oauth_client_secret,omitempty"` AccountVisibility *string `json:"account_visibility,omitempty"` ChallengeVisibility *string `json:"challenge_visibility,omitempty"` Paused *bool `json:"paused,omitempty"` RegistrationVisibility *string `json:"registration_visibility,omitempty"` ScoreVisibility *string `json:"score_visibility,omitempty"` HTMLSanitization *bool `json:"html_sanitization,omitempty"` RegistrationCode *string `json:"registration_code,omitempty"` MailPassword *string `json:"mail_password,omitempty"` MailPort *string `json:"mail_port,omitempty"` MailServer *string `json:"mail_server,omitempty"` MailSSL *bool `json:"mail_ssl,omitempty"` MailTLS *bool `json:"mail_tls,omitempty"` MailUseAuth *bool `json:"mail_useauth,omitempty"` MailUsername *string `json:"mail_username,omitempty"` PasswordChangeAlertBody *string `json:"password_change_alert_body,omitempty"` PasswordChangeAlertSubject *string `json:"password_change_alert_subject,omitempty"` PasswordResetBody *string `json:"password_reset_body,omitempty"` PasswordResetSubject *string `json:"password_reset_subject,omitempty"` SuccessfulRegistrationEmailBody *string `json:"successful_registration_email_body,omitempty"` SuccessfulRegistrationEmailSubject *string `json:"successful_registration_email_subject,omitempty"` UserCreationEmailBody *string `json:"user_creation_email_body,omitempty"` UserCreationEmailSubject *string `json:"user_creation_email_subject,omitempty"` VerificationEmailBody *string `json:"verification_email_body,omitempty"` VerificationEmailSubject *string `json:"verification_email_subject,omitempty"` // DEPRECATED MailFromAddr *string `json:"mailfrom_addr,omitempty"` // DEPRECATED MailGunAPIKey *string `json:"mailgun_api_key,omitempty"` // DEPRECATED MailGunBaseURL *string `json:"mailgun_base_url,omitempty"` End *string `json:"end,omitempty"` Freeze *string `json:"freeze,omitempty"` Start *string `json:"start,omitempty"` ViewAfterCTF *bool `json:"view_after_ctf,omitempty"` PrivacyText *string `json:"privacy_text,omitempty"` PrivacyURL *string `json:"privacy_url,omitempty"` TOSText *string `json:"tos_text,omitempty"` TOSURL *string `json:"tos_url,omitempty"` UserMode *string `json:"user_mode,omitempty"` }
type PatchFlagParams ¶
type PatchHintsParams ¶
type PatchHintsParams struct { ChallengeID int `json:"challenge_id"` Content string `json:"content"` Cost int `json:"cost"` Requirements Requirements `json:"requirements"` }
type PatchPageParams ¶
type PatchPageParams struct { Title string `json:"title"` Content string `json:"content"` Format string `json:"format"` Route string `json:"route"` Nonce string `json:"nonce"` // XXX API should not use the nonce as you need to parse HTML content to get it, going against the API workflow AuthRequired bool `json:"auth_required"` Draft bool `json:"draft"` Hidden bool `json:"hidden"` }
type PatchTagsParams ¶
type PatchTagsParams struct {
Value string `json:"value"`
}
type PatchTeamsParams ¶
type PatchTeamsParams struct { CaptainID *int `json:"captain_id,omitempty"` Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` Password *string `json:"password,omitempty"` Website *string `json:"website,omitempty"` Affiliation *string `json:"affiliation,omitempty"` Country *string `json:"country,omitempty"` Banned *bool `json:"banned,omitempty"` Hidden *bool `json:"hidden,omitempty"` Fields []Field `json:"fields"` }
type PatchUsersParams ¶
type PatchUsersParams struct { Name string `json:"name"` Email string `json:"email"` Language *string `json:"language,omitempty"` Password *string `json:"password,omitempty"` Website *string `json:"website,omitempty"` Affiliation *string `json:"affiliation,omitempty"` Country *string `json:"country,omitempty"` Type *string `json:"type,omitempty"` Verified *bool `json:"verified,omitempty"` Hidden *bool `json:"hidden,omitempty"` Banned *bool `json:"banned,omitempty"` Fields []Field `json:"fields"` }
type PostAwardsParams ¶
type PostBracketsParams ¶ added in v0.6.3
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"` Value int `json:"value"` 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 *Requirements `json:"requirements,omitempty"` State string `json:"state"` Type string `json:"type"` }
type PostCommentsParams ¶
type PostConfigFieldsParams ¶
type PostConfigsParams ¶
type PostFilesParams ¶
type PostFlagsParams ¶
type PostHintsParams ¶
type PostHintsParams struct { ChallengeID int `json:"challenge_id"` Content string `json:"content"` Cost int `json:"cost"` Requirements Requirements `json:"requirements"` }
type PostNotificationsParams ¶
type PostPagesParams ¶
type PostPagesParams struct { AuthRequired bool `json:"auth_required"` Content string `json:"content"` Draft bool `json:"draft"` Format string `json:"format"` Hidden bool `json:"hidden"` Nonce string `json:"nonce"` // XXX API should not use the nonce as you need to parse HTML content to get it, going against the API workflow Route string `json:"route"` Title string `json:"title"` }
type PostTagsParams ¶
type PostTeamsMembersParams ¶ added in v0.4.0
type PostTeamsMembersParams struct {
UserID int `json:"user_id"`
}
type PostTeamsParams ¶
type PostTeamsParams struct { Name string `json:"name"` Email string `json:"email"` Password string `json:"password"` Website *string `json:"website,omitempty"` Affiliation *string `json:"affiliation,omitempty"` Country *string `json:"country,omitempty"` Banned bool `json:"banned"` Hidden bool `json:"hidden"` Fields []Field `json:"fields"` }
type PostTokensParams ¶
type PostTopicsParams ¶
type PostUnlocksParams ¶
type PostUserMailParams ¶
type PostUserMailParams struct {
Text string `json:"text"`
}
type PostUsersParams ¶
type PostUsersParams struct { Name string `json:"name"` Email string `json:"email"` Language *string `json:"language,omitempty"` Password string `json:"password"` Website *string `json:"website,omitempty"` Affiliation *string `json:"affiliation,omitempty"` Country *string `json:"country,omitempty"` Type string `json:"type"` // "user" or "admin" Verified bool `json:"verified"` Hidden bool `json:"hidden"` Banned bool `json:"banned"` Fields []Field `json:"fields"` }
type RegisterParams ¶
type Requirements ¶
type Requirements struct { // Anonymize control the behavior of the resource if the prerequisites are // not validated: // - if `nil`, defaults to `*false` // - if `*false`, set the behavior as "hidden" (invisible until validated) // - if `*true`, set the behavior to "anonymized" (visible but not much info) Anonymize *bool `json:"anonymize,omitempty"` // Prerequisites is the list of resources' ID that need to be validated in // order for the resource to meet its requirements. Prerequisites []int `json:"prerequisites"` }
type ResetParams ¶
type ResetParams struct { Accounts *string `schema:"accounts,omitempty"` Submissions *string `schema:"submissions,omitempty"` Challenges *string `schema:"challenges,omitempty"` Pages *string `schema:"pages,omitempty"` Notifications *string `schema:"notifications,omitempty"` // Nonce is autofilled by the API wrapper. // XXX the "nonce" should not be part of the API call but rather be extracted from HTTP headers. Nonce string `schema:"nonce"` }
type Scoreboard ¶
type Scoreboard struct { ID int `json:"id"` Pos int `json:"pos"` AccountId int `json:"account_id"` AccountURL string `json:"account_url"` AccountType string `json:"account_type"` OauthID any `json:"oauth_id"` Name string `json:"name"` Score int `json:"score"` Members []struct { ID int `json:"id"` OauthID any `json:"oauth_id"` Name string `json:"name"` Score int `json:"score"` } `json:"members"` Solves []*Submission `json:"solves"` BracketID *string `json:"bracket_id"` BracketName *string `json:"bracket_name"` }
type SetupParams ¶
type SetupParams struct { CTFName string CTFDescription string UserMode string ChallengeVisibility string AccountVisibility string ScoreVisibility string RegistrationVisibility string VerifyEmails bool TeamSize *int Name string Email string Password string CTFLogo *InputFile CTFBanner *InputFile CTFSmallIcon *InputFile CTFTheme string ThemeColor string Start string End string }
type StatChallSubmission ¶
type Submission ¶
type Submission struct { ID int `json:"id"` TeamID int `json:"team_id"` // XXX may be duplicated with team.id ? IP string `json:"ip"` ChallengeID int `json:"challenge_id"` AccountID int `json:"account_id"` // XXX introducted in 3.7.1, clearly a duplication of user_id... UserID int `json:"user_id"` // XXX may be duplicated with user.id ? Value int `json:"value"` Team struct { ID int `json:"id"` Name string `json:"name"` } `json:"team"` Date string `json:"date"` User struct { ID int `json:"id"` Name string `json:"name"` } `json:"user"` Type string `json:"type"` Challenge struct { Value int `json:"value"` ID int `json:"id"` Name string `json:"name"` Category string `json:"category"` } `json:"challenge"` Provided string `json:"provided"` }
type Team ¶
type Team struct { Bracket *string `json:"bracket,omitempty"` Members []int `json:"members,omitempty"` ID int `json:"id"` Created string `json:"created"` Country *string `json:"country,omitempty"` Email *string `json:"email,omitempty"` Affiliation *string `json:"affiliation,omitempty"` CaptainID *int `json:"captain_id,omitempty"` Fields []string `json:"fields"` Banned bool `json:"banned"` Website *string `json:"website,omitempty"` Hidden bool `json:"hidden"` Secret *bool `json:"secret,omitempty"` Name string `json:"name"` OauthID *string `json:"oauth_id,omitempty"` Place *string `json:"place,omitempty"` Score *int `json:"score,omitempty"` }
type ThemeImage ¶ added in v0.6.3
type Topic ¶
type Topic struct { ID int `json:"id"` ChallengeID *int `json:"challenge_id,omitempty"` Challenge *int `json:"challenge,omitempty"` // XXX may be duplicated with ChallengeID ? TopicID *int `json:"topic_id,omitempty"` // XXX may be duplicated with ID ? Topic *int `json:"topic,omitempty"` // XXX may be duplicated with ID ? Value string `json:"value"` }
type User ¶
type User struct { Bracket *string `json:"bracket"` ID int `json:"id"` TeamID *int `json:"team_id,omitempty"` Country *string `json:"country,omitempty"` Language *string `json:"language,omitempty"` Affiliation *string `json:"affiliation,omitempty"` Fields []Field `json:"fields"` Website *string `json:"website,omitempty"` Name string `json:"name"` Email *string `json:"email,omitempty"` OauthID *string `json:"oauth_id,omitempty"` Verified *bool `json:"verified,omitempty"` Banned *bool `json:"banned,omitempty"` Hidden *bool `json:"hidden,omitempty"` Type *string `json:"type,omitempty"` Created *string `json:"created,omitempty"` Secret *string `json:"secret,omitempty"` }