models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortServices = map[int]string{
	21:    "FTP",
	22:    "SSH",
	23:    "Telnet",
	25:    "SMTP",
	53:    "DNS",
	80:    "HTTP",
	110:   "POP3",
	135:   "MSRPC",
	139:   "NetBIOS",
	143:   "IMAP",
	443:   "HTTPS",
	445:   "SMB",
	993:   "IMAPS",
	995:   "POP3S",
	1433:  "MSSQL",
	1521:  "Oracle",
	3306:  "MySQL",
	3389:  "RDP",
	5000:  "UPnP",
	5001:  "Synology",
	5432:  "PostgreSQL",
	5900:  "VNC",
	6379:  "Redis",
	8080:  "HTTP-Alt",
	8443:  "HTTPS-Alt",
	8888:  "HTTP-Alt2",
	9090:  "Prometheus",
	9100:  "Print",
	27017: "MongoDB",
	631:   "IPP",
}

Common port to service name mapping

View Source
var TopPorts = []int{
	21, 22, 23, 25, 53, 80, 110, 135, 139, 143,
	443, 445, 993, 995, 1433, 1521, 3306, 3389,
	5000, 5001, 5432, 5900, 6379, 8080, 8443,
	8888, 9090, 9100, 27017, 631,
}

Top N common ports

Functions

This section is empty.

Types

type Host

type Host struct {
	IP         string     `json:"ip"`
	MAC        string     `json:"mac"`
	Vendor     string     `json:"vendor"`
	Hostname   string     `json:"hostname"`
	DeviceType string     `json:"device_type"`
	LatencyMs  float64    `json:"latency_ms"`
	Status     HostStatus `json:"status"`
	Ports      []Port     `json:"ports"`
	FirstSeen  time.Time  `json:"first_seen"`
	LastSeen   time.Time  `json:"last_seen"`

	// Internal tracking
	LatencyHistory []float64 `json:"-"`
	MissedScans    int       `json:"-"`
	IsGateway      bool      `json:"-"`
	IsLocal        bool      `json:"-"`
}

func (*Host) OpenPorts

func (h *Host) OpenPorts() []Port

type HostStatus

type HostStatus string
const (
	StatusOnline  HostStatus = "online"
	StatusOffline HostStatus = "offline"
)

type Port

type Port struct {
	Number  int       `json:"port"`
	Service string    `json:"service"`
	State   PortState `json:"state"`
}

type PortState

type PortState string
const (
	PortOpen   PortState = "open"
	PortClosed PortState = "closed"
)

type ScanResult

type ScanResult struct {
	ScanTime  time.Time `json:"scan_time"`
	Interface string    `json:"interface"`
	Subnet    string    `json:"subnet"`
	LocalIP   string    `json:"local_ip"`
	Gateway   string    `json:"gateway"`
	Hosts     []*Host   `json:"hosts"`
}

type ScanState

type ScanState struct {
	Hosts      map[string]*Host
	Phase      string
	Progress   float64
	IsScanning bool
	Interface  string
	Subnet     string
	LocalIP    string
	Gateway    string
	TotalHosts int
	IsRoot     bool
	// contains filtered or unexported fields
}

func NewScanState

func NewScanState() *ScanState

func (*ScanState) GetHostList

func (s *ScanState) GetHostList() []*Host

func (*ScanState) Lock

func (s *ScanState) Lock()

func (*ScanState) RLock

func (s *ScanState) RLock()

func (*ScanState) RUnlock

func (s *ScanState) RUnlock()

func (*ScanState) Unlock

func (s *ScanState) Unlock()

func (*ScanState) UpdateHost

func (s *ScanState) UpdateHost(ip string, fn func(*Host))

Jump to

Keyboard shortcuts

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