meta

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 13 Imported by: 0

README

Meta 题目信息

Build Status Go Report Card GoDoc

题目环境生成器 - https://github.com/ctfhub-team/challenge_generate

环境制作说明 - https://www.wolai.com/ctfhub/3DvnJJtPbHyyDtVkDaW1yz

说明

author:
  # 制作者ID
  name: l1n3
  # 制作者邮箱
  contact: yw9381@163.com
task:
  # 题目镜像名称,名称中应当不包含下划线(_),空格( )和中文,下划线和空格用-代替
  id: 2022_hitcon_web_rce-me
  # 题目显示名称
  name: rce me
  # 题目类型, 包含 con, file, ext
  # con类型为容器类型,指这个题目存在容器, file类型为文件类型,指这个题目只有附件, ext类型为外部类型,指这个题目是一个外部链接
  # con及ext类型附件可有可无,file类型必须有附件
  type: con
  # 题目分类,首字母需要大写,每个题目应当只有一个分类,分类参考如下
  # 例如 Web, Pwn, Reverse, Misc, Crypto, Forensics, Blockchain, Mobile, ICS, IoT
  category: Web
  # 题目描述
  description: |
    please rce me
    try try try!
  # 题目难度,难度分为 签到, 简单, 中等, 困难
  level: 签到
  # 题目flag,如是静态flag在此处填写具体的flag值,如是动态flag则此处留空
  flag:
  # 题目来源,来源格式: 年份-比赛名称简写-题目类型-题目显示名称
  # 例如 2021年强网杯的Web类的babysqli,则为2021-QWB-Web-baysqli
  # 例如 2019年SCTF的Pwn类的babyheap,则为2019-SCTF-Pwn-bayheap
  refer: 2022-HitCon-Web-rce
  # 题目标签,标签应当尽可能体现题目考点,如无标签则此处为空数组
  tags:
    - Web
    - HitCon
    - 2022
  # 题目提示,如无提示则此处为空数组
  hints:
    - asdasdaz
    - asdas
    - asdad
# 关于容器的配置,如果没有容器则无须此部分
container:
  # 镜像名称,需要和task_name保持一致,如果有多个容器,请在末尾添加标识符,例如web,db或是1,2
  # 例如 challenge_web_sqli_basic-web
  - image: xxxxxxxx
    # 需要对外暴露的端口, 协议为tcp, udp, http, 因K8S在同一个pod中的多容器不能监听同一个端口,故不同的容器暴露的端口需不相同,可视作所有容器共享一个IP地址及端口资源
    port:
      - 10000/tcp
      - 20000/udp
    # 资源配置,参考docker对资源的定义
    resource:
      cpu: 250m
      mem: 256Mi
  # 例如 challenge_web_sqli_basic-db
  - image: xxxxxx
    # 需要对外暴露的端口
    port:
      - 10000/tcp
      - 20000/udp
    # 资源配置,参考docker对资源的定义,cpu 250m即为0.25C
    resource:
      cpu: 250m
      mem: 256Mi

Multiple Yaml 多文件合并

---
yaml content 1
---
yaml content 2

Documentation

Index

Constants

View Source
const (
	TaskIDSpec = `[^a-z0-9][a-z0-9_\-]{12,94}[a-z0-9]$`
	ImageSpec  = TaskIDSpec
)

Variables

View Source
var (
	Task_Type_name = map[int32]string{
		0: "UnknownType",
		1: "Con",
		2: "File",
		3: "Ext",
	}
	Task_Type_value = map[string]int32{
		"UnknownType": 0,
		"Con":         1,
		"File":        2,
		"Ext":         3,
	}
)

Enum value maps for Task_Type.

View Source
var (
	Task_Level_name = map[int32]string{
		0: "UnknownLevel",
		1: "Checkin",
		2: "Easy",
		3: "Medium",
		4: "Hard",
	}
	Task_Level_value = map[string]int32{
		"UnknownLevel": 0,
		"Checkin":      1,
		"Easy":         2,
		"Medium":       3,
		"Hard":         4,
	}
)

Enum value maps for Task_Level.

Functions

func StrPtr added in v1.1.0

func StrPtr(s string) *string

func Template

func Template() string

Types

type Author

type Author struct {
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`       // Nickname 制作者ID
	Contact string `protobuf:"bytes,2,opt,name=contact,proto3" json:"contact,omitempty"` // Email 制作者邮箱
	// contains filtered or unexported fields
}

题目制作者信息

func (*Author) Descriptor deprecated added in v1.0.9

func (*Author) Descriptor() ([]byte, []int)

Deprecated: Use Author.ProtoReflect.Descriptor instead.

func (*Author) GetContact added in v1.0.9

func (x *Author) GetContact() string

func (*Author) GetName added in v1.0.9

func (x *Author) GetName() string

func (*Author) ProtoMessage added in v1.0.9

func (*Author) ProtoMessage()

func (*Author) ProtoReflect added in v1.0.9

func (x *Author) ProtoReflect() protoreflect.Message

func (*Author) Reset added in v1.0.9

func (x *Author) Reset()

func (*Author) String added in v1.0.9

func (x *Author) String() string

type Container added in v1.0.9

type Container struct {
	Image    string    `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`       // 命名空间/镜像名称
	Ports    []string  `protobuf:"bytes,2,rep,name=ports,proto3" json:"ports,omitempty"`       // 需要对外暴露的端口,port/protocol eg .80/tcp
	Resource *Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` // 运行资源限制
	// contains filtered or unexported fields
}

func (*Container) Check added in v1.2.0

func (c *Container) Check() error

func (*Container) Descriptor deprecated added in v1.0.9

func (*Container) Descriptor() ([]byte, []int)

Deprecated: Use Container.ProtoReflect.Descriptor instead.

func (*Container) GetImage added in v1.0.9

func (x *Container) GetImage() string

func (*Container) GetPorts added in v1.0.9

func (x *Container) GetPorts() []string

func (*Container) GetResource added in v1.0.9

func (x *Container) GetResource() *Resource

func (*Container) ProtoMessage added in v1.0.9

func (*Container) ProtoMessage()

func (*Container) ProtoReflect added in v1.0.9

func (x *Container) ProtoReflect() protoreflect.Message

func (*Container) Reset added in v1.0.9

func (x *Container) Reset()

func (*Container) String added in v1.0.9

func (x *Container) String() string

type Meta

type Meta struct {
	Author     *Author      `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"`
	Task       *Task        `protobuf:"bytes,2,opt,name=task,proto3" json:"task,omitempty"`
	Containers []*Container `protobuf:"bytes,3,rep,name=containers,proto3" json:"containers,omitempty"`
	// contains filtered or unexported fields
}

题目元信息

func Default

func Default() *Meta

func Empty

func Empty() *Meta

func MustParseBytes added in v1.0.12

func MustParseBytes(data []byte) ([]*Meta, error)

func New

func New(name, contact string) *Meta

func ParseBytes added in v1.0.8

func ParseBytes(data []byte) ([]*Meta, error)

func ParseFromFile added in v1.0.8

func ParseFromFile(fds ...io.ReadSeekCloser) ([]*Meta, error)

func (*Meta) Check added in v1.1.0

func (t *Meta) Check() error

func (*Meta) Descriptor deprecated added in v1.0.9

func (*Meta) Descriptor() ([]byte, []int)

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetAuthor added in v1.0.9

func (x *Meta) GetAuthor() *Author

func (*Meta) GetContainers added in v1.0.11

func (x *Meta) GetContainers() []*Container

func (*Meta) GetTask added in v1.0.9

func (x *Meta) GetTask() *Task

func (*Meta) ParseFormat added in v1.0.11

func (t *Meta) ParseFormat() *Meta

func (*Meta) ProtoMessage added in v1.0.9

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect added in v1.0.9

func (x *Meta) ProtoReflect() protoreflect.Message

func (*Meta) R added in v1.0.7

func (m *Meta) R() *Meta

func (*Meta) Reset added in v1.0.9

func (x *Meta) Reset()

func (*Meta) String added in v1.0.9

func (x *Meta) String() string

type Resource added in v1.0.9

type Resource struct {

	// k8s.io.apimachinery.pkg.api.resource.Quantity
	Cpu string `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu,omitempty"`
	Mem string `protobuf:"bytes,2,opt,name=mem,proto3" json:"mem,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource) Descriptor deprecated added in v1.0.9

func (*Resource) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetCpu added in v1.0.9

func (x *Resource) GetCpu() string

func (*Resource) GetMem added in v1.0.9

func (x *Resource) GetMem() string

func (*Resource) ProtoMessage added in v1.0.9

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v1.0.9

func (x *Resource) ProtoReflect() protoreflect.Message

func (*Resource) Reset added in v1.0.9

func (x *Resource) Reset()

func (*Resource) String added in v1.0.9

func (x *Resource) String() string

type Task

type Task struct {
	Id            string     `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                                  // 题目ID 唯一值
	Name          string     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`                                              // 题目名称
	Type          string     `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`                                              // 题目类型
	Category      string     `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"`                                      // 题目分类
	Description   string     `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`                                // 题目描述
	Level         string     `protobuf:"bytes,6,opt,name=level,proto3" json:"level,omitempty"`                                            // 题目难度
	Flag          *string    `protobuf:"bytes,7,opt,name=flag,proto3,oneof" json:"flag,omitempty"`                                        // 题目 Flag, 不填写则为动态 Flag
	AttachmentUrl *string    `protobuf:"bytes,8,opt,name=attachment_url,json=attachmentUrl,proto3,oneof" json:"attachment_url,omitempty"` // 题目附件地址
	Refer         *string    `protobuf:"bytes,9,opt,name=refer,proto3,oneof" json:"refer,omitempty"`                                      // 题目来源
	Tags          []string   `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags,omitempty"`                                             // 题目标签
	Hints         []string   `protobuf:"bytes,11,rep,name=hints,proto3" json:"hints,omitempty"`                                           // 题目提示
	TypeCode      Task_Type  `protobuf:"varint,91,opt,name=type_code,json=typeCode,proto3,enum=ctfhub.meta.Task_Type" json:"type_code,omitempty"`
	LevelCode     Task_Level `protobuf:"varint,92,opt,name=level_code,json=levelCode,proto3,enum=ctfhub.meta.Task_Level" json:"level_code,omitempty"`
	// contains filtered or unexported fields
}

题目信息

func (*Task) Check added in v1.1.0

func (t *Task) Check() error

func (*Task) Descriptor deprecated added in v1.0.9

func (*Task) Descriptor() ([]byte, []int)

Deprecated: Use Task.ProtoReflect.Descriptor instead.

func (*Task) GetAttachmentUrl added in v1.0.9

func (x *Task) GetAttachmentUrl() string

func (*Task) GetCategory added in v1.0.9

func (x *Task) GetCategory() string

func (*Task) GetDescription added in v1.0.9

func (x *Task) GetDescription() string

func (*Task) GetFlag added in v1.0.9

func (x *Task) GetFlag() string

func (*Task) GetHints added in v1.0.9

func (x *Task) GetHints() []string

func (*Task) GetId added in v1.1.0

func (x *Task) GetId() string

func (*Task) GetLevel added in v1.0.9

func (x *Task) GetLevel() string

func (*Task) GetLevelCode added in v1.0.9

func (x *Task) GetLevelCode() Task_Level

func (*Task) GetName added in v1.0.9

func (x *Task) GetName() string

func (*Task) GetRefer added in v1.1.0

func (x *Task) GetRefer() string

func (*Task) GetTags added in v1.1.0

func (x *Task) GetTags() []string

func (*Task) GetType added in v1.0.9

func (x *Task) GetType() string

func (*Task) GetTypeCode added in v1.0.9

func (x *Task) GetTypeCode() Task_Type

func (*Task) ParseFormat added in v1.0.11

func (t *Task) ParseFormat() *Task

func (*Task) ProtoMessage added in v1.0.9

func (*Task) ProtoMessage()

func (*Task) ProtoReflect added in v1.0.9

func (x *Task) ProtoReflect() protoreflect.Message

func (*Task) Reset added in v1.0.9

func (x *Task) Reset()

func (*Task) String added in v1.0.9

func (x *Task) String() string

type Task_Level added in v1.1.0

type Task_Level int32
const (
	Task_UnknownLevel Task_Level = 0
	Task_Checkin      Task_Level = 1 // 签到-入门
	Task_Easy         Task_Level = 2 // 简单-初级
	Task_Medium       Task_Level = 3 // 中等-中级
	Task_Hard         Task_Level = 4 // 困难-高级
)

func (Task_Level) Descriptor added in v1.1.0

func (Task_Level) Descriptor() protoreflect.EnumDescriptor

func (Task_Level) Enum added in v1.1.0

func (x Task_Level) Enum() *Task_Level

func (Task_Level) EnumDescriptor deprecated added in v1.1.0

func (Task_Level) EnumDescriptor() ([]byte, []int)

Deprecated: Use Task_Level.Descriptor instead.

func (Task_Level) Number added in v1.1.0

func (x Task_Level) Number() protoreflect.EnumNumber

func (Task_Level) String added in v1.1.0

func (x Task_Level) String() string

func (Task_Level) Type added in v1.1.0

type Task_Type added in v1.1.0

type Task_Type int32
const (
	Task_UnknownType Task_Type = 0
	Task_Con         Task_Type = 1 // 容器
	Task_File        Task_Type = 2 // 附件
	Task_Ext         Task_Type = 3 // 外部
)

func (Task_Type) Descriptor added in v1.1.0

func (Task_Type) Descriptor() protoreflect.EnumDescriptor

func (Task_Type) Enum added in v1.1.0

func (x Task_Type) Enum() *Task_Type

func (Task_Type) EnumDescriptor deprecated added in v1.1.0

func (Task_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Task_Type.Descriptor instead.

func (Task_Type) Number added in v1.1.0

func (x Task_Type) Number() protoreflect.EnumNumber

func (Task_Type) String added in v1.1.0

func (x Task_Type) String() string

func (Task_Type) Type added in v1.1.0

Jump to

Keyboard shortcuts

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