ctfd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Constants for max file sizes (1mb, 5mb, 25mb, 100mb, 0)
	NoFileSizeLimit    = 0
	OneMB              = 1000000
	FiveMB             = 5000000
	TwentyFiveMB       = 25000000
	OneHundredMB       = 100000000
	TwoHhundredFiftyMB = 250000000
)

Variables

This section is empty.

Functions

func Authenticate added in v0.1.10

func Authenticate() error

Authenticate will attempt to authenticate the client with the provided username and password.

func Check added in v0.1.10

func Check() error

Check will check if the instance is a CTFd instance.

func DownloadFiles added in v0.1.10

func DownloadFiles(files []string, outputPath string) error

DownloadFiles will download all the files of a challenge by ID and save them to the given directory

func GenerateIndex added in v0.2.0

func GenerateIndex(challenges []ChallengesData, outputPath string) error

GenerateIndex generates an index.md file with a list of all challenges in their respective categories

func GetDescription added in v0.1.10

func GetDescription(challenge *ChallengeData, challengePath string) error

GetDescription retrieves a challenge and returns a writeup template of the challenge

func NewClient

func NewClient() *scraper.Client

func SubmitFlag added in v0.1.10

func SubmitFlag(submission Submission) error

Types

type CTFOpts added in v0.1.10

type CTFOpts struct {
	URL           string
	Username      string
	Password      string
	Token         string
	Output        string
	Overwrite     bool
	SaveConfig    bool
	SkipCTFDCheck bool
	UnsolvedOnly  bool
	Notify        bool
	Watch         bool
	WatchInterval time.Duration
	MaxFileSize   int64
}

func NewOpts added in v0.1.10

func NewOpts() *CTFOpts

NewOptions returns a new Options struct

type ChallengeData

type ChallengeData struct {
	ID             int64  `json:"id"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	ConnectionInfo string `json:"connection_info"`
	NextID         int64  `json:"next_id"`
	Attempts       int64  `json:"attempts"`
	MaxAttempts    int64  `json:"max_attempts"`
	Value          int64  `json:"value"`
	Category       string `json:"category"`
	Type           string `json:"type"`
	TypeData       struct {
		ID        string `json:"id"`
		Name      string `json:"name"`
		Templates struct {
			Create string `json:"create"`
			Update string `json:"update"`
			View   string `json:"view"`
		} `json:"templates"`
		Scripts struct {
			Create string `json:"create"`
			Update string `json:"update"`
			View   string `json:"view"`
		} `json:"scripts"`
	} `json:"type_data"`
	State      string        `json:"state"`
	Solves     int64         `json:"solves"`
	SolvedByMe bool          `json:"solved_by_me"`
	Files      []string      `json:"files"`
	Hints      []Hint        `json:"hints"`
	Tags       []interface{} `json:"tags"`
}

func Challenge

func Challenge(id int64) (*ChallengeData, error)

Challenge returns a challenge by ID

type ChallengesData added in v0.1.10

type ChallengesData struct {
	ID         int64         `json:"id"`
	Type       string        `json:"type"`
	Name       string        `json:"name"`
	Value      int64         `json:"value"`
	Solves     int64         `json:"solves"`
	SolvedByMe bool          `json:"solved_by_me"`
	Category   string        `json:"category"`
	Tags       []interface{} `json:"tags"`
}

func ListChallenges added in v0.1.10

func ListChallenges() ([]ChallengesData, error)

ListChallenges returns a list of challenges

type Hint

type Hint struct {
	ID      int64  `json:"id"`
	Cost    int64  `json:"cost"`
	Content string `json:"content"`
}

type Solves added in v0.0.2

type Solves struct {
	ChallengeID interface{} `json:"challenge_id"`
	AccountID   int         `json:"account_id"`
	TeamID      int         `json:"team_id"`
	UserID      int         `json:"user_id"`
	Value       int         `json:"value"`
	Date        time.Time   `json:"date"`
}

type Submission added in v0.1.10

type Submission struct {
	ID   int    `json:"challenge_id"`
	Flag string `json:"submission"`
}

type Team added in v0.0.2

type Team struct {
	ID     int      `json:"id"`
	Name   string   `json:"name"`
	Solves []Solves `json:"solves"`
}

type TopTeamData added in v0.0.2

type TopTeamData struct {
	Num1  Team `json:"1"`
	Num2  Team `json:"2"`
	Num3  Team `json:"3"`
	Num4  Team `json:"4"`
	Num5  Team `json:"5"`
	Num6  Team `json:"6"`
	Num7  Team `json:"7"`
	Num8  Team `json:"8"`
	Num9  Team `json:"9"`
	Num10 Team `json:"10"`
}

func ScoreboardTop added in v0.1.10

func ScoreboardTop(count int64) (TopTeamData, error)

ScoreboardTop returns the top teams on the scoreboard

func (*TopTeamData) GetTeam added in v0.0.2

func (d *TopTeamData) GetTeam(number int) (*Team, error)

GetTeam returns the team information for a given team ID !TODO: This needs to be refactored to allow for a list of any number of teams

Jump to

Keyboard shortcuts

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