Documentation
¶
Index ¶
- Variables
- func Completions() []display.Options
- func Detail(h *pb.Host, showRoute bool) display.Detail
- func DisplayDetails() []display.Options
- func DisplayHeaders() []display.Options
- func FilterIdenticalPort(raw []host.PortORM, dbHosts []*host.PortORM) (filtered []host.PortORM)
- func GetOperatingSystem(h *pb.Host) (osName, osFamily string)
- func InfoPanes(h *pb.Host) []display.Pane
- func Insights(h *pb.Host) (lines []string)
- func MergeHost(dst, src *host.Host) (changed bool)
- func SameHost(a, b *host.Host) bool
- func SamePort(a, b *host.Port) bool
- type Group
- type Host
- type Port
- type User
Constants ¶
This section is empty.
Variables ¶
var DisplayFields = map[string]func(h *pb.Host) string{ "ID": func(h *pb.Host) string { if h.Status != nil && h.Status.State == "up" { return color.HiGreenString(display.FormatSmallID(h.Id)) } return display.FormatSmallID(h.Id) }, "Hostnames": func(h *pb.Host) string { var hostnames []string for _, hn := range h.Hostnames { hostnames = append(hostnames, hn.Name) } return strings.Join(hostnames, "\n") }, "OS Name": func(h *pb.Host) string { osName, _ := GetOperatingSystem(h) return osName }, "OS Family": func(h *pb.Host) string { _, fam := GetOperatingSystem(h) return fam }, "Addresses": func(h *pb.Host) string { var addresses []string for _, hn := range h.Addresses { addresses = append(addresses, hn.Addr) } return strings.Join(addresses, "\n") }, "Status": func(h *pb.Host) string { if h.Status == nil { return "" } switch h.Status.State { case "up": return color.HiGreenString(h.Status.State) case "down": return color.HiRedString(h.Status.State) default: return h.Status.State } }, "Hops": func(h *pb.Host) string { if h.Trace == nil { return "" } return fmt.Sprint(len(h.Trace.Hops)) }, "Extra Ports": func(h *pb.Host) string { ports := "" for _, port := range h.ExtraPorts { ports += printExtraPorts(port, 1) } return ports }, "Arch": getProbableCPU, "MAC": func(h *pb.Host) string { return h.MAC }, "Purpose": func(h *pb.Host) string { if h.OS == nil { return "" } if h.Purpose != "" { return h.Purpose } times := map[string]int{} for _, m := range h.OS.Matches { for _, c := range m.Classes { if c.Type != "" { times[c.Type]++ } } } var purposes []string for name, times := range times { typeStr := name + display.Dim + fmt.Sprintf("(%d)", times) purposes = append(purposes, typeStr) } return strings.Join(purposes, " | ") }, "Route": func(h *pb.Host) string { if h.Trace == nil { return "" } routes := "\n" + display.Reset for i := len(h.Trace.Hops) - 1; i >= 0; i-- { hop := h.Trace.Hops[i] line := display.Dim + " |_ " rtt := display.Dim + fmt.Sprintf("%*s", 6, hop.RTT) + display.Reset ipPad := fmt.Sprintf("%*s ", 18, hop.IPAddr) line += rtt + ipPad + display.Bold + display.FgYellow + hop.Host + display.Reset routes += line + "\n" } return strings.TrimSuffix(routes, "\n") }, "Scripts": func(h *pb.Host) string { return "" }, "Sources": func(h *pb.Host) string { return provenance.Tools(h.GetSources()) }, "Virtual Host": func(h *pb.Host) string { return h.VirtualHost }, "Comment": func(h *pb.Host) string { return h.Comment }, }
Fields maps field names to their value generators.
Functions ¶
func Completions ¶
Completions returns some columns to be combined into completion candidates and/or their descriptions.
func Detail ¶
Detail assembles the full `info` view for a single host: the identity banner, the side-by-side info panes, the derived insights, and any trailing sections (open ports, extra ports, comment and — when showRoute is set — the full traceroute). It hands these to the shared display.Detail renderer, so a host's detail view is laid out identically to every other domain's. showRoute mirrors the `hosts show --traceroute` flag: the route can be long, so it prints only on request.
func DisplayDetails ¶
DetailHeaders returns the headers for a detailed host view.
func DisplayHeaders ¶
DisplayHeaders returns all weighted table headers for a table of hosts.
func FilterIdenticalPort ¶
FilterIdenticalPort returns a list of portsfrom which have been removed all ports that are already in the database, with a very high degree of certitude. This avoids redundance when manipulating new ports/services.
func GetOperatingSystem ¶
GetOperatingSystem returns the operating system of the host based on potential OS guess matches, or if none and the information is known without any guessing.
func InfoPanes ¶
InfoPanes groups a host's detail into titled panes (System / Network / Status) for side-by-side layout via display.Columns, mirroring the credential and service info views. Empty panes are dropped, so a host with no OS/network data never prints a bare title.
func Insights ¶
Insights returns cross-cutting observations about a single host for the info view: a down/stale warning, exposed cleartext services, a large-attack-surface note, and a flag when the OS is only an nmap guess.
func MergeHost ¶
MergeHost folds src into dst in place, by field class, without losing data. It assumes the two already match (SameHost); callers do the matching and scoping.
func SameHost ¶
SameHost reports whether two in-memory hosts denote the same machine, using natural keys only (DEDUP.md §2, keyed-first): MAC is definitive, otherwise a shared address is decisive. A shared hostname alone is deliberately NOT enough to merge — virtual hosts share names — so per the no-false-merge asymmetry we would rather split than wrongly collapse two hosts.
Types ¶
type Group ¶
Group - A computer group of users. This type will be closely related to the various aims/credential types.
type Host ¶
Host - A physical or virtual computer host. The type has several categories of fields: general information, and Nmap-compliant fields (ports, status, route, scripts etc).
type Port ¶
Port - A port on a Host. The type has several categories of fields: general information, and Nmap-compliant fields (status, owner, service, scripts etc).