ctftime

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDescription

func CleanDescription(description string) string

Clean the description of a CTF event, removing \r\n

func IsCTFEventActive

func IsCTFEventActive(event Event) bool

Return if a CTF is currently active

Types

type Client added in v0.0.6

type Client struct {
	Client  *http.Client
	BaseURL *url.URL
	Log     *logrus.Logger
}

func NewClient added in v0.0.6

func NewClient(transport http.RoundTripper) *Client

NewClient constructs a new Client. If transport is nil, a default transport is used.

func (*Client) GetCTFEvent added in v0.0.6

func (c *Client) GetCTFEvent(id int) (Event, error)

Retrieve information about a specific CTF event on CTFTime

func (*Client) GetCTFEvents added in v0.0.6

func (c *Client) GetCTFEvents() ([]Event, error)

Retrieve all active and upcoming CTF events from ctftime.org/api/v1/events/

func (*Client) GetCTFTeam added in v0.0.6

func (c *Client) GetCTFTeam(id int) (Team, error)

Get information about a specific team on CTFTime

func (*Client) GetTopTeams added in v0.0.6

func (c *Client) GetTopTeams() ([]TopTeam, error)

type Event

type Event struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt time.Time

	Hidden bool

	ID            uint64    `json:"id"`
	CTFID         int       `json:"ctf_id"`
	Title         string    `json:"title"`
	Description   string    `json:"description"`
	URL           string    `json:"url"`
	Weight        float64   `json:"weight"`
	Onsite        bool      `json:"onsite"`
	Location      string    `json:"location"`
	Restrictions  string    `json:"restrictions"`
	Format        string    `json:"format"`
	FormatID      int       `json:"format_id"`
	Participants  int       `json:"participants"`
	CTFTimeURL    string    `json:"ctftime_url"`
	LiveFeed      string    `json:"live_feed"`
	IsVotableNow  bool      `json:"is_votable_now"`
	PublicVotable bool      `json:"public_votable"`
	Start         time.Time `json:"start"`
	Finish        time.Time `json:"finish"`
}

Struct for API Endpoint ctftime.org/api/v1/events/

func CleanCTFEvents

func CleanCTFEvents(events []Event) ([]Event, error)

Clean CTF Events, return only 'Open' Jeopardy Style CTFs that are either active or upcoming

type Team

type Team struct {
	ID           int      `json:"id"`
	Academic     bool     `json:"academic"`
	PrimaryAlias string   `json:"primary_alias"`
	Name         string   `json:"name"`
	Country      string   `json:"country"`
	Aliases      []string `json:"aliases"`
	Rating       map[string]struct {
		RatingPlace     int     `json:"rating_place"`
		OrganizerPoints float64 `json:"organizer_points"`
		RatingPoints    float64 `json:"rating_points"`
		CountryPlace    int     `json:"country_place"`
	} `json:"rating"`
}

Struct for API Endpoint ctftime.org/api/v1/teams/

type TopTeam added in v0.0.2

type TopTeam struct {
	TeamName string  `json:"team_name"`
	Points   float64 `json:"points"`
	TeamID   int     `json:"team_id"`
}

type TopTeams added in v0.0.2

type TopTeams struct {
	Teams []TopTeam `json:"2022"`
}

Jump to

Keyboard shortcuts

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