models

package
v2.0.0-...-f642420 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func GetDB

func GetDB() *gorm.DB

func Init

func Init()

Types

type Host

type Host struct {
	gorm.Model `json:"-"`
	IP         string
	Hostname   string
	OS         string
	Ports      []Port
	TeamID     string
}

type Job

type Job struct {
	gorm.Model `json:"-"`
	JID        string
	Type       string
	IPRange    string
	Status     string
	Scanner    string
	TID        string
}

func MakeJob

func MakeJob(jobtype string, iprange string, tid string) Job

type JobStatus

type JobStatus struct {
	gorm.Model
	Name     string
	JobIndex int
}

func (*JobStatus) GetNextJob

func (js *JobStatus) GetNextJob() (Job, error)

type LoginReq

type LoginReq struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type Port

type Port struct {
	gorm.Model
	Number   uint16
	State    string
	Protocol string
	Service  string
	HostID   uint
}

type RegisterReq

type RegisterReq struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

type Roles

type Roles []string

func (*Roles) Scan

func (r *Roles) Scan(src any) error

func (Roles) Value

func (r Roles) Value() (driver.Value, error)

type Scan

type Scan struct {
	Status    string
	StartTime time.Time
	EndTime   time.Time
	Hosts     []Host
}

type Team

type Team struct {
	gorm.Model `json:"-"`
	Name       string
	IPRange    string
	TID        string
	Hosts      []Host
}

func MakeTeam

func MakeTeam(name string, iprange string) Team

type User

type User struct {
	gorm.Model   `json:"-"`
	Name         string
	PasswordHash string `json:"-"`
	Active       bool
	Roles        Roles `gorm:"type:VARCHAR(255)"`
	UID          string
}

func MakeUser

func MakeUser(name string) User

func (*User) CheckPassword

func (u *User) CheckPassword(pw string) bool

func (*User) SetPassword

func (u *User) SetPassword(pw string)

type UserReq

type UserReq struct {
	Active bool
	Roles  []string
}

Jump to

Keyboard shortcuts

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