model

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL = iota
	NOT_STARTED
	IN_PROGRESS
	FAILED
	DONE
	FINISHED
)

Variables

View Source
var Mutex sync.Mutex

Functions

func DelHosts

func DelHosts(db *gorm.DB)

func DelPorts

func DelPorts(db *gorm.DB)

func InitDB

func InitDB(dbpath string) *gorm.DB

Types

type Enumeration

type Enumeration struct {
	Target    *Host
	Outfolder string
	Kind      string
	Status    int
	Result    []byte
	Polite    string
}

func (*Enumeration) String

func (e *Enumeration) String() string

type Host

type Host struct {
	ID      uint   `gorm:"primary_key"`
	Address string `gorm:"unique_index:idx_hostname_ip"`
	Status  string
	OS      string
	Info    string
	Ports   []Port
	Step    string
}

func AddHost

func AddHost(db *gorm.DB, address string, status string, step string) *Host

func GetAllHosts

func GetAllHosts(db *gorm.DB) []Host

func GetHostByAddress

func GetHostByAddress(db *gorm.DB, address string) *Host

func GetHostByStep

func GetHostByStep(db *gorm.DB, step string) []Host

func (*Host) GetPorts

func (h *Host) GetPorts(db *gorm.DB) []Port

func (*Host) String

func (h *Host) String() string

type IpAddr

type IpAddr struct {
	Ip       string
	Port     int
	Protocol string
}

type Port

type Port struct {
	ID       uint   `gorm:"primary_key"`
	Number   int    `gorm:"unique_index:idx_port"`
	Protocol string `gorm:"unique_index:idx_port"`
	Status   string `gorm:"unique_index:idx_port"`
	Service  Service
	HostID   uint `gorm:"unique_index:idx_port"`
	Host     *Host
}

func AddPort

func AddPort(db *gorm.DB, number int, protocol, status string) (*Port, bool)

func GetAllPorts

func GetAllPorts(db *gorm.DB) []Port

func GetPorts

func GetPorts(db *gorm.DB, status string) []Port

func (*Port) GetHost

func (p *Port) GetHost(db *gorm.DB) *Host

func (*Port) GetService

func (p *Port) GetService(db *gorm.DB) Service

func (*Port) String

func (p *Port) String() string

type Scan

type Scan struct {
	Name      string
	Target    string
	Status    int
	Outfolder string
	Outfile   string
	Cmd       string
}

func (*Scan) String

func (s *Scan) String() string

type ScanResult

type ScanResult struct {
	Service Service
	Result  bool
}

type Service

type Service struct {
	ID      uint   `gorm:"primary_key"`
	Name    string `gorm:"unique_index:idx_service"`
	Version string
	Product string
	OsType  string
	PortID  uint `gorm:"unique_index:idx_service"`
	Port    *Port
}

func AddService

func AddService(db *gorm.DB, name, version, product, osType string, p *Port, pID uint) *Service

func GetServiceByName

func GetServiceByName(db *gorm.DB, name string) []Service

func (*Service) GetPort

func (s *Service) GetPort(db *gorm.DB) *Port

func (*Service) String

func (s *Service) String() string

type Service2

type Service2 struct {
	Ip       string
	Port     int
	Protocol string
	UserName string
	PassWord string
}

type Step

type Step int
const (
	NOT_DEFINED Step = iota
	IMPORTED
	SWEEPED
	NEW
	SCANNED
)

func (Step) String

func (s Step) String() string

type Target

type Target struct {
	ID      uint   `gorm:"primary_key"`
	Address string `gorm:"unique_index:idx_target_ip"`
	Step    string
}

func AddTarget

func AddTarget(db *gorm.DB, address string, step string) *Target

func GetAllTargets

func GetAllTargets(db *gorm.DB) []Target

func GetTargetByStep

func GetTargetByStep(db *gorm.DB, step string) []Target

func (*Target) String

func (t *Target) String() string

Jump to

Keyboard shortcuts

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