checks

package
v0.0.0-...-dab6a98 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileDifference

func FileDifference(fileName string, fileContent string) (int, error)

FileDifference returns the percentage difference between the contents of the filename passed and the contents of the file passed.

func FileHash

func FileHash(fileName string) (string, error)

FileHash returns the sha256sum of the filename passed.

func GetFile

func GetFile(fileName string) (string, error)

func StringHash

func StringHash(fileContent string) (string, error)

StringHash returns the sha256sum of the string

Types

type Custom

type Custom struct {
	Service
	Command string
	Regex   string
}

func (Custom) Run

func (c Custom) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Custom) Verify

func (c *Custom) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Dns

type Dns struct {
	Service
	Record []DnsRecord
}

func (Dns) Run

func (c Dns) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Dns) Verify

func (c *Dns) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type DnsRecord

type DnsRecord struct {
	Kind   string
	Domain string
	Answer []string
}

type Ftp

type Ftp struct {
	Service
	File []FtpFile
}

func (Ftp) Run

func (c Ftp) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Ftp) Verify

func (c *Ftp) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type FtpFile

type FtpFile struct {
	Name  string
	Hash  string
	Regex string
}

type Imap

type Imap struct {
	Service
	Domain    string
	Encrypted bool
}

func (Imap) Run

func (c Imap) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Imap) Verify

func (c *Imap) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Ldap

type Ldap struct {
	Service
	Domain    string
	Encrypted bool
}

func (Ldap) Run

func (c Ldap) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Ldap) Verify

func (c *Ldap) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Ping

type Ping struct {
	Service
	Count           int
	AllowPacketLoss bool
	Percent         int
}

func (Ping) Run

func (c Ping) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Ping) Verify

func (c *Ping) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Pop3

type Pop3 struct {
	Service
	Domain    string
	Encrypted bool
}

func (Pop3) Run

func (c Pop3) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Pop3) Verify

func (c *Pop3) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Rdp

type Rdp struct {
	Service
}

func (Rdp) Run

func (c Rdp) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Rdp) Verify

func (c *Rdp) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Result

type Result struct {
	ServiceName string `json:"name,omitempty"`
	Target      string `json:"target,omitempty"`
	TeamID      uint   `json:"team_id,omitempty"`
	Status      bool   `json:"status,omitempty"`
	Debug       string `json:"debug,omitempty"`
	Error       string `json:"error,omitempty"`
	Points      int    `json:"points,omitempty"`
	ServiceType string `json:"service_type,omitempty"`
	RoundID     uint   `json:"round_id"`

	// Added for runner visualization
	RunnerID   string `json:"runner_id,omitempty"`
	StartTime  string `json:"start_time,omitempty"`
	EndTime    string `json:"end_time,omitempty"`
	StatusText string `json:"status_text,omitempty"` // "running", "success", or "failed"
}

type Runner

type Runner interface {
	Run(teamID uint, identifier string, roundID uint, resultsChan chan Result)
	Runnable() bool
	Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error
	GetType() string
	GetName() string
	GetAttempts() int
	GetCredlists() []string
	SetTaskCredentials(creds []TaskCredential)
}

checks for each service

type Service

type Service struct {
	Name            string           `toml:"-"`          // Name is the box name plus the service (ex. lunar-dns)
	Display         string           `toml:",omitempty"` // Display is the name of the service (ex. dns)
	CredLists       []string         `toml:",omitempty"`
	Port            int              `toml:",omitzero"` // omitzero because custom checks might not specify port, and shouldn't be assigned 0
	Points          int              `toml:",omitempty"`
	Timeout         int              `toml:",omitempty"`
	SlaPenalty      int              `toml:",omitempty"`
	SlaThreshold    int              `toml:",omitempty"`
	LaunchTime      time.Time        `toml:",omitempty"`
	StopTime        time.Time        `toml:",omitempty"`
	Disabled        bool             `toml:",omitempty"`
	Target          string           `toml:",omitempty"` // Target is the IP address or hostname for the box
	ServiceType     string           `toml:",omitempty"` // ServiceType is the name of the Runner that checks the service
	Attempts        int              `toml:",omitempty"` // Attempts is the number of times the service has been checked
	TaskCredentials []TaskCredential `toml:"-"`          // Credentials from task payload (set per-task, not from config)
}

services will inherit Service so that config.Config can be read from file, but will not be used after initial read

func (*Service) Configure

func (service *Service) Configure(ip string, points int, timeout int, slapenalty int, slathreshold int) error

func (*Service) GetAttempts

func (service *Service) GetAttempts() int

func (*Service) GetCredlists

func (service *Service) GetCredlists() []string

func (*Service) GetName

func (service *Service) GetName() string

func (*Service) GetType

func (service *Service) GetType() string

func (*Service) Run

func (service *Service) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result, definition func(teamID uint, teamIdentifier string, checkResult Result, response chan Result))

func (*Service) Runnable

func (service *Service) Runnable() bool

func (*Service) SetCredlists

func (service *Service) SetCredlists(lists []string)

func (*Service) SetTaskCredentials

func (service *Service) SetTaskCredentials(creds []TaskCredential)

SetTaskCredentials sets credentials from the task payload (thread-safe per-instance)

type Smb

type Smb struct {
	Service
	Domain string
	Share  string
	File   []smbFile
}

func (Smb) Run

func (c Smb) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Smb) Verify

func (c *Smb) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Smtp

type Smtp struct {
	Service
	Encrypted   bool
	Domain      string
	RequireAuth bool
}

func (Smtp) Run

func (c Smtp) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Smtp) Verify

func (c *Smtp) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Sql

type Sql struct {
	Service
	Kind  string
	Query []queryData
}

func (Sql) Run

func (c Sql) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Sql) Verify

func (c *Sql) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Ssh

type Ssh struct {
	Service
	PrivKey     string `toml:",omitempty"`
	BadAttempts int    `toml:",omitzero"`
	Command     []commandData
}

func (Ssh) Run

func (c Ssh) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Ssh) Verify

func (c *Ssh) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type TaskCredential

type TaskCredential struct {
	Username string
	Password string
}

TaskCredential represents a credential from the task payload

type Tcp

type Tcp struct {
	Service
}

func (Tcp) Run

func (c Tcp) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Tcp) Verify

func (c *Tcp) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Vnc

type Vnc struct {
	Service
}

func (Vnc) Run

func (c Vnc) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Vnc) Verify

func (c *Vnc) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type Web

type Web struct {
	Service
	Url    []urlData
	Scheme string
}

func (Web) Run

func (c Web) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*Web) Verify

func (c *Web) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

type WinRM

type WinRM struct {
	Service
	Encrypted   bool
	BadAttempts int
	Command     []winCommandData
}

func (WinRM) Run

func (c WinRM) Run(teamID uint, teamIdentifier string, roundID uint, resultsChan chan Result)

func (*WinRM) Verify

func (c *WinRM) Verify(box string, ip string, points int, timeout int, slapenalty int, slathreshold int) error

Jump to

Keyboard shortcuts

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