model

package
v0.0.0-...-17b0823 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: MIT 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

--------------------------------------------------------------------------------------- CONSTANTS ---------------------------------------------------------------------------------------

Functions

func InitDB

func InitDB(dbpath string) *gorm.DB

--------------------------------------------------------------------------------------- UTILS ---------------------------------------------------------------------------------------

Types

type Enumeration

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

--------------------------------------------------------------------------------------- ENUMERATE STRUCTURE ---------------------------------------------------------------------------------------

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
}

--------------------------------------------------------------------------------------- HOST ---------------------------------------------------------------------------------------

func AddHost

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

Constructor

func GetAllHosts

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

Getters

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

Print to 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
}

--------------------------------------------------------------------------------------- PORT ---------------------------------------------------------------------------------------

func AddPort

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

Constructor

func (*Port) GetHost

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

func (*Port) GetService

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

Getters

func (*Port) String

func (p *Port) String() string

Print to string

type Scan

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

--------------------------------------------------------------------------------------- SCAN STRUCTURE ---------------------------------------------------------------------------------------

func (*Scan) String

func (s *Scan) String() string

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
}

--------------------------------------------------------------------------------------- SERVICE ---------------------------------------------------------------------------------------

func AddService

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

Constructor

func GetServiceByName

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

Getters

func (*Service) GetPort

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

func (*Service) String

func (s *Service) String() string

Print to string

type Step

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

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
}

--------------------------------------------------------------------------------------- TARGET ---------------------------------------------------------------------------------------

func AddTarget

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

Constructor

func GetAllTargets

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

Getters

func GetTargetByStep

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

func (*Target) String

func (t *Target) String() string

Print to string

Jump to

Keyboard shortcuts

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