ctfd

package
v0.0.0-...-caea6a0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NONCEREGEXP            = regexp.MustCompile(`csrf_nonce[ ]*=[ ]*"(.+)"`)
	ServerUnavailableErr   = errors.New("Server is unavailable")
	UserNotFoundErr        = errors.New("Could not find the specified user")
	CouldNotFindSessionErr = errors.New("Could not find the specified session")
	NoSessionErr           = errors.New("No session found")
	ChallengeNotFoundErr   = errors.New("Could not find the specified challenge")
	FlagNotFoundErr        = errors.New("Could not find the specified flag")
)
View Source
var (
	DuplicateConsentErr = errors.New("Cannot have more than one consent checkbox")
	NoConsentErr        = errors.New("No consent given")
)
View Source
var (
	Themes = map[string]Theme{
		"aau": Theme{
			CSS: aauCss,
		},
		"aau-survey": Theme{
			ExtraFields: survey,
			CSS:         aauCss,
		},
	}
)

Functions

func NewCheckFlagInterceptor

func NewCheckFlagInterceptor(ts store.TeamStore, fp *FlagPool) *checkFlagInterception

func NewLoginInterceptor

func NewLoginInterceptor(ts store.TeamStore) *loginInterception

func NewRegisterInterception

func NewRegisterInterception(ts store.TeamStore, opts ...RegisterInterceptOpts) *registerInterception

func NewSignupInterception

func NewSignupInterception(ef *ExtraFields) *signupInterception

Types

type CTFd

type CTFd interface {
	docker.Identifier
	io.Closer
	ProxyHandler(...func(*store.Team) error) svcs.ProxyConnector
	Start(context.Context) error
	Stop() error
	Flags() []store.FlagConfig
}

func New

func New(ctx context.Context, conf Config) (CTFd, error)

type Checkbox

type Checkbox struct {
	Tag  string
	Text string
	// contains filtered or unexported fields
}

func NewCheckbox

func NewCheckbox(tag string, text string, consent bool) *Checkbox

func (*Checkbox) Html

func (c *Checkbox) Html() template.HTML

func (*Checkbox) ReadMetadata

func (c *Checkbox) ReadMetadata(r *http.Request, team *store.Team) error

type Config

type Config struct {
	Name       string `yaml:"name"`
	AdminUser  string `yaml:"admin_user"`
	AdminEmail string `yaml:"admin_email"`
	AdminPass  string `yaml:"admin_pass"`
	Theme      string `yaml:"theme"`
	Flags      []store.FlagConfig
	Teams      []store.Team
}

type ExtraFields

type ExtraFields struct {
	// contains filtered or unexported fields
}

func NewExtraFields

func NewExtraFields(rows []InputRow) (*ExtraFields, error)

func (*ExtraFields) Html

func (ef *ExtraFields) Html() string

func (*ExtraFields) ReadMetadata

func (ef *ExtraFields) ReadMetadata(r *http.Request, team *store.Team) []error

type FlagPool

type FlagPool struct {
	// contains filtered or unexported fields
}

func NewFlagPool

func NewFlagPool() *FlagPool

func (*FlagPool) AddFlag

func (fp *FlagPool) AddFlag(flag store.FlagConfig, cid int) string

func (*FlagPool) GetFlagByTag

func (fp *FlagPool) GetFlagByTag(t store.Tag) (string, error)

func (*FlagPool) GetIdentifierByTag

func (fp *FlagPool) GetIdentifierByTag(t store.Tag) (int, error)

func (*FlagPool) GetTagByIdentifier

func (fp *FlagPool) GetTagByIdentifier(id int) (store.Tag, error)

func (*FlagPool) TranslateFlagForTeam

func (fp *FlagPool) TranslateFlagForTeam(t store.Team, cid int, value string) string

type Input

type Input interface {
	Html() template.HTML
	ReadMetadata(r *http.Request, team *store.Team) error
}

type InputRow

type InputRow struct {
	Class  string
	Inputs []Input
}

type RegisterInterceptOpts

type RegisterInterceptOpts func(*registerInterception)

func WithExtraRegisterFields

func WithExtraRegisterFields(ef *ExtraFields) RegisterInterceptOpts

func WithRegisterHooks

func WithRegisterHooks(hooks ...func(*store.Team) error) RegisterInterceptOpts

type RespModifier

type RespModifier func(*goquery.Document)

func WithAppendErrors

func WithAppendErrors(errs []error) RespModifier

func WithExtraFields

func WithExtraFields(ef *ExtraFields) RespModifier

func WithRemoveErrors

func WithRemoveErrors() RespModifier

type Selector

type Selector struct {
	Label   string
	Tag     string
	Options []string
	// contains filtered or unexported fields
}

func NewSelector

func NewSelector(label string, tag string, options []string) *Selector

func (*Selector) Html

func (s *Selector) Html() template.HTML

func (*Selector) ReadMetadata

func (s *Selector) ReadMetadata(r *http.Request, team *store.Team) error

type Theme

type Theme struct {
	ExtraFields *ExtraFields
	Index       string
	CSS         string
}

Jump to

Keyboard shortcuts

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