host

package
v0.0.0-...-0f6999a Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fields = map[string]func(h *host.Host) string{

	"ID": func(h *host.Host) string {
		if h.Status.State == "up" {
			return color.HiGreenString(display.FormatSmallID(h.Id))
		}
		return display.FormatSmallID(h.Id)
	},
	"Hostnames": func(h *host.Host) string {
		var hostnames []string
		for _, hn := range h.Hostnames {
			hostnames = append(hostnames, hn.Name)
		}
		return strings.Join(hostnames, "\n")
	},
	"OS Name": func(h *host.Host) string {
		osName, _ := osMatched(h)
		return osName
	},
	"OS Family": func(h *host.Host) string {
		_, fam := osMatched(h)
		return fam
	},
	"Addresses": func(h *host.Host) string {
		var addresses []string
		for _, hn := range h.Addresses {
			addresses = append(addresses, hn.Addr)
		}
		return strings.Join(addresses, "\n")
	},

	"Status": func(h *host.Host) string {
		return ""
	},
	"Hops": func(h *host.Host) string {
		if h.Trace == nil {
			return ""
		}

		return fmt.Sprint(len(h.Trace.Hops))
	},
	"Arch": getProbableCPU,
	"MAC":  func(h *host.Host) string { return h.MAC },
	"Purpose": func(h *host.Host) string {

		return ""
	},

	"Route": func(h *host.Host) string {
		if h.Trace == nil {
			return ""
		}

		var hops []string
		for _, hop := range h.Trace.Hops {
			hopDisplay := color.HiBlackString("| ") + color.YellowString(hop.Host) + " - " + hop.IPAddr
			hops = append(hops, hopDisplay)
		}

		return strings.Join(hops, "\n")
	},
}

Fields maps field names to their value generators

Functions

func Completions

func Completions() []display.Options

Completions returns some columns to be combined into completion candidates and/or their descriptions.

func Details

func Details() []display.Options

DetailHeaders returns the headers for a detailed host view.

func Headers

func Headers() (headers []display.Options)

TableHeaders returns all weighted table headers for a table of hosts.

Types

type Group

type Group host.Group

Group - A computer group of users. This type will be closely related to the various aims/credential types.

func (*Group) AsEntity

func (g *Group) AsEntity() maltego.Entity

AsEntity - Returns the Group as a valid Maltego Entity.

func (*Group) ToORM

func (g *Group) ToORM(ctx context.Context) (host.GroupORM, error)

ToORM - Get the SQL object for the Group.

func (*Group) ToPB

func (g *Group) ToPB() *host.Group

ToPB - Get the Protobuf object for the Group.

type Host

type Host host.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

type Port host.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).

func (*Port) AsEntity

func (p *Port) AsEntity() maltego.Entity

AsEntity - Returns the Port as a valid Maltego Entity.

func (*Port) ToORM

func (p *Port) ToORM(ctx context.Context) (host.PortORM, error)

ToORM - Get the SQL object for the Port.

func (*Port) ToPB

func (p *Port) ToPB() *host.Port

ToPB - Get the Protobuf object for the Port.

type User

type User host.User

User - A computer (login) user. This type will be closely related to the various aims/credential types.

func (*User) AsEntity

func (u *User) AsEntity() maltego.Entity

AsEntity - Returns the User as a valid Maltego Entity.

func (*User) ToORM

func (u *User) ToORM(ctx context.Context) (host.UserORM, error)

ToORM - Get the SQL object for the User.

func (*User) ToPB

func (u *User) ToPB() *host.User

ToPB - Get the Protobuf object for the User.

Jump to

Keyboard shortcuts

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