services

package
v0.0.0-...-d709508 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScoringDispatch = map[string]func(service enum.Service, address string) (int, bool, error){

	"ftp":            ScoreFTP,
	"ftplogin":       ScoreFTPLogin,
	"ftpread":        ScoreFTPRead,
	"ftpwrite":       ScoreFTPWrite,
	"ssh":            ScoreSSHLogin,
	"web80":          ScoreWeb80,
	"webssl":         ScoreWebSSLTLS,
	"webcontent":     ScoreWebContent,
	"routericmp":     ScoreRouterICMP,
	"dnsexternalfwd": ScoreDNSExternalFwd,
	"dnsexternalrev": ScoreDNSExternalRev,
	"dnsinternalfwd": ScoreDNSInternalFwd,
	"dnsinternalrev": ScoreDNSInternalRev,
}

Functions

func ChooseRandomUser

func ChooseRandomUser(dir string) (string, string, error)

ChooseRandomUser reads the file at `dir`, which contains lines formatted as "username:password", picks one user at random, and returns the parsed username and password.

func Initalize

func Initalize(gameConfig *enum.YamlConfig)

func LoadFTPFiles

func LoadFTPFiles(path string) error

loadFTPFiles is a utility function that loads a files or all the files in a directory into memory for use in scoring. The function uses sync to only run one time, when it initially called.

func LoadWebFiles

func LoadWebFiles(dir string) error

LoadWebFiles is a function that loads all the required web files into memory at startup (HTML FILES) so that they can be accessed later without inconvenience

func ScoreDNSExternalFwd

func ScoreDNSExternalFwd(service enum.Service, address string) (int, bool, error)

ScoreDNSExternalFwd checks that for each line in the query file, a forward DNS query (A record) for the external domain returns the expected external IP. The team number is derived from the resolver’s last octet (but the actual DNS server is now 10.20.0.10).

func ScoreDNSExternalRev

func ScoreDNSExternalRev(service enum.Service, address string) (int, bool, error)

ScoreDNSExternalRev checks that for each line in the query file, a reverse DNS (PTR) query for the external IP returns the expected external domain. The team number is derived from the resolver’s last octet (but the actual DNS server is now 10.20.0.10).

func ScoreDNSInternalFwd

func ScoreDNSInternalFwd(service enum.Service, address string) (int, bool, error)

ScoreDNSInternalFwd checks that for each line in the query file, a forward DNS query (A record) for the internal domain returns the expected internal IP. The team number is derived from the resolver’s third octet.

func ScoreDNSInternalRev

func ScoreDNSInternalRev(service enum.Service, address string) (int, bool, error)

ScoreDNSInternalRev checks that for each line in the query file, a reverse DNS (PTR) query for the internal IP returns the expected internal domain. The team number is derived from the resolver’s third octet.

func ScoreFTP

func ScoreFTP(service enum.Service, address string) (int, bool, error)

ScoreFTP is a general scorer for FTP that checks for a valid FTP connection and then returns

func ScoreFTPLogin

func ScoreFTPLogin(service enum.Service, address string) (int, bool, error)

ScoreFTPLogin is a scorer for FTP that checks for if the user can log in

func ScoreFTPRead

func ScoreFTPRead(service enum.Service, address string) (int, bool, error)

ScoreFTPRead is a scorer for FTP that checks for if the user can read from a/many file(s).

Requires `service.QDir` to be a directory of files expected to be in the FTP server.

func ScoreFTPWrite

func ScoreFTPWrite(service enum.Service, address string) (int, bool, error)

ScoreFTPWrite is a scorer for FTP that checks for if the user can write to a/many file(s).

Requires `service.QDir` to be a directory of files expected to be in the FTP server.

func ScoreRouterICMP

func ScoreRouterICMP(service enum.Service, address string) (int, bool, error)

Checks if a router is pingable via ICMP

func ScoreSSHLogin

func ScoreSSHLogin(service enum.Service, address string) (int, bool, error)

func ScoreWeb80

func ScoreWeb80(service enum.Service, address string) (int, bool, error)

ScoreWeb80 ensures that a website is accessible via http, but does not check for the content on the website

func ScoreWebContent

func ScoreWebContent(service enum.Service, address string) (int, bool, error)

ScoreWebContent scores a website based on the content it's providing users, through either port 80 or SSL/TLS

To do this, it first checks both ScoreWeb80 and ScoreWebSSLTLS to ensure the website is up before continuing any operations. It will return false and 0 points if both of those functions do, but if either function returns true it will work.

func ScoreWebSSLTLS

func ScoreWebSSLTLS(service enum.Service, address string) (int, bool, error)

ScoreWebSSLTLS ensures that a website is accessible and is secured via SSL or TLS, but does not check for the content on the website

Types

This section is empty.

Jump to

Keyboard shortcuts

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