netinfo

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Package netinfo provides functionality to extract network information

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSInfo

type DNSInfo struct {
	Domain   string      `json:"domain"`
	Server   []string    `json:"server"`
	Records  []DNSRecord `json:"records"`
	Comments []string    `json:"comments"`
}

DNSInfo represents DNS information for a domain.

func NewDNSInfo

func NewDNSInfo(domain string) DNSInfo

NewDNSInfo initializes a new DNSInfo struct.

type DNSRecord

type DNSRecord struct {
	Name     string `json:"name"`
	TTL      string `json:"ttl"`
	Class    string `json:"class"`
	Type     string `json:"type"`
	Response string `json:"response"`
	Value    string `json:"value"`
	Section  string `json:"section"`
	Special  string `json:"special"`
}

DNSRecord represents a DNS record.

type DetectedLocation

type DetectedLocation struct {
	CountryCode string
	CountryName string
	City        string
	Latitude    float64
	Longitude   float64
}

DetectedLocation represents the detected geolocation for an IP address.

func DetectLocation

func DetectLocation(ipAddress string, cfg config.GeoLookupConfig) (*DetectedLocation, error)

type HostData

type HostData struct {
	Host []string `json:"host"`
}

HostData represents the structure of the host data you want to extract and store.

type HostInfo

type HostInfo struct {
	IP              []IPInfoDetails     `json:"ip"`
	Hostname        []HostNameDetails   `json:"hostname"`
	Ports           []PortInfo          `json:"ports,omitempty"`
	Services        []ServiceInfo       `json:"services,omitempty"`
	OS              []OSInfo            `json:"os,omitempty"`
	Vulnerabilities []VulnerabilityInfo `json:"vulnerabilities,omitempty"`
}

HostInfo contains the information about a single host

type HostNameDetails added in v0.9.3

type HostNameDetails struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

type IP2LocationResult

type IP2LocationResult struct {
	CountryCode string  `json:"country_code"`
	CountryName string  `json:"country_name"`
	RegionName  string  `json:"region_name"`
	CityName    string  `json:"city_name"`
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
}

IP2LocationResult represents the structure of the IP2Location result.

type IPData

type IPData struct {
	IP          []string  `json:"ip"`
	ASN         []string  `json:"asn"`
	CIDR        []string  `json:"cidr"`
	NetRange    []string  `json:"net_range"`
	NetName     []string  `json:"net_name"`
	NetHandle   []string  `json:"net_handle"`
	NetParent   []string  `json:"net_parent"`
	NetType     []string  `json:"net_type"`
	Country     []string  `json:"country"`
	CountryCode []string  `json:"country_code"`
	City        []string  `json:"city"`
	Latitude    []float64 `json:"latitude"`
	Longitude   []float64 `json:"longitude"`
}

IPData represents the structure of the IP data you want to extract and store.

type IPInfo

type IPInfo struct {
	IP          string
	ASN         string
	CIDR        string
	NetRange    string
	NetName     string
	NetHandle   string
	NetParent   string
	NetType     string
	Country     string
	CountryCode string
	City        string
	Latitude    float64
	Longitude   float64
}

IPInfo represents the structure of the IP information you want to extract and store.

func (*IPInfo) SetDefaults

func (info *IPInfo) SetDefaults()

SetDefaults sets the default values for all IPInfo fields

func (*IPInfo) UpdateWithGeoLocation

func (info *IPInfo) UpdateWithGeoLocation(geoLocation *DetectedLocation)

UpdateWithGeoLocation updates the IPInfo fields with the provided geolocation data

func (*IPInfo) UpdateWithIPInfo

func (info *IPInfo) UpdateWithIPInfo(entity *ipExtraData)

UpdateWithIPInfo updates the IPInfo fields with the provided network data

type IPInfoDetails added in v0.9.3

type IPInfoDetails struct {
	Address string `json:"address,omitempty"`
	Type    string `json:"address_type,omitempty"`
	Vendor  string `json:"vendor,omitempty"`
}

type InvalidIPAddressError

type InvalidIPAddressError struct {
	IPAddress string
}

InvalidIPAddressError represents an error for an invalid IP address.

func (*InvalidIPAddressError) Error

func (e *InvalidIPAddressError) Error() string

type NetInfo

type NetInfo struct {
	URL          string            `json:"url,omitempty"`
	Hosts        HostData          `json:"hosts,omitempty"`
	IPs          IPData            `json:"ips,omitempty"`
	WHOIS        []WHOISData       `json:"whois,omitempty"`
	DNS          []DNSInfo         `json:"dns,omitempty"`
	ServiceScout ServiceScoutInfo  `json:"service_scout,omitempty"`
	Config       *cfg.NetworkInfo  `json:"Config,omitempty"`
	Platform     *cfg.PlatformInfo `json:"platform,omitempty"`
}

NetInfo represents the structure of the network information you want to extract and store.

func (*NetInfo) GetDNSInfo

func (ni *NetInfo) GetDNSInfo() error

GetDNSInfo collects DNS information for the given domain using dig.

func (*NetInfo) GetHosts

func (ni *NetInfo) GetHosts() error

GetHosts returns the hostnames of the provided URL

func (*NetInfo) GetHostsFromIPs

func (ni *NetInfo) GetHostsFromIPs() error

GetHostsFromIPs returns the hostnames of the provided IP addresses

func (*NetInfo) GetIPs

func (ni *NetInfo) GetIPs() error

GetIPs returns the IP addresses of the provided URL

func (*NetInfo) GetIPsFromHosts

func (ni *NetInfo) GetIPsFromHosts() error

GetIPsFromHosts returns the IP addresses of the provided hostnames

func (*NetInfo) GetNetInfo

func (ni *NetInfo) GetNetInfo(url string) error

GetNetInfo returns the IP addresses and hostnames of the provided URL

func (*NetInfo) GetServiceScoutInfo

func (ni *NetInfo) GetServiceScoutInfo(scanCfg *cfg.ServiceScoutConfig) error

GetNmapInfo returns the Nmap information for the provided URL

func (*NetInfo) GetWHOISData

func (ni *NetInfo) GetWHOISData() error

GetWHOISData returns the WHOIS data of the provided NetInfo URL

type OSCLass added in v0.9.3

type OSCLass struct {
	Type       string `json:"type,omitempty"`
	Vendor     string `json:"vendor,omitempty"`
	OSFamily   string `json:"os_family,omitempty"`
	OSGen      string `json:"os_gen,omitempty"`
	DeviceType string `json:"device_type,omitempty"`
	Accuracy   int    `json:"accuracy,omitempty"`
}

type OSInfo added in v0.9.3

type OSInfo struct {
	Name     string    `json:"name,omitempty"`
	Accuracy int       `json:"accuracy,omitempty"`
	Classes  []OSCLass `json:"classes,omitempty"`
	Line     int       `json:"line,omitempty"`
}

OSInfo contains the information about the detected OS

type PortInfo

type PortInfo struct {
	Port     int    `json:"port,omitempty"`
	Protocol string `json:"protocol,omitempty"`
	State    string `json:"state,omitempty"`
	Service  string `json:"service,omitempty"`
}

PortInfo contains the information about a single port

type ScriptElement added in v0.9.3

type ScriptElement struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type ScriptInfo added in v0.9.3

type ScriptInfo struct {
	ID       string          `json:"id,omitempty"`
	Output   string          `json:"output,omitempty"`
	Elements []ScriptElement `json:"elements,omitempty"`
	Tables   []ScriptTable   `json:"tables,omitempty"`
}

type ScriptTable added in v0.9.3

type ScriptTable struct {
	Key      string          `json:"key,omitempty"`
	Elements []ScriptElement `json:"elements,omitempty"`
	Tables   []ScriptTable   `json:"tables,omitempty"`
}

type ServiceInfo added in v0.9.3

type ServiceInfo struct {
	Name          string       `json:"name,omitempty"`
	DeviceType    string       `json:"device_type,omitempty"`
	ExtraInfo     string       `json:"extra_info,omitempty"`
	HighVersion   string       `json:"high_version,omitempty"`
	LowVersion    string       `json:"low_version,omitempty"`
	Hostname      string       `json:"hostname,omitempty"`
	Method        string       `json:"method,omitempty"`
	OSType        string       `json:"os_type,omitempty"`
	Product       string       `json:"product,omitempty"`
	Proto         string       `json:"proto,omitempty"`
	RPCNum        string       `json:"rpc_num,omitempty"`
	ServiceFP     string       `json:"service_fp,omitempty"`
	Tunnel        string       `json:"tunnel,omitempty"`
	Version       string       `json:"version,omitempty"`
	Configuration string       `json:"configuration,omitempty"`
	CPEs          []string     `json:"cpes,omitempty"`
	Scripts       []ScriptInfo `json:"scripts,omitempty"`
}

type ServiceScoutInfo

type ServiceScoutInfo struct {
	Hosts []HostInfo `json:"hosts,omitempty"`
}

ServiceScoutInfo contains the information about the Nmap scan

type VulnerabilityInfo added in v0.9.3

type VulnerabilityInfo struct {
	ID          string          `json:"id,omitempty"`
	Name        string          `json:"name,omitempty"`
	Severity    string          `json:"severity,omitempty"`
	Reference   string          `json:"reference,omitempty"`
	Description string          `json:"description,omitempty"`
	State       string          `json:"state,omitempty"`
	Output      string          `json:"output,omitempty"`
	Elements    []ScriptElement `json:"elements,omitempty"`
	Tables      []ScriptTable   `json:"tables,omitempty"`
}

type WHOISData

type WHOISData struct {
	Entity                 string   `json:"entity"`
	EntityType             string   `json:"entity_type"`
	EntityStatus           string   `json:"entity_status"`
	RegistryDomainID       string   `json:"registry_domain_id"`
	RegistrarWhoisServer   string   `json:"registrar_whois_server"`
	RegistrarURL           string   `json:"registrar_url"`
	RegistryExpiryDate     string   `json:"registry_expiry_date"`
	RegistrarIANAID        string   `json:"registrar_iana_id"`
	Registrar              string   `json:"registrar"`
	Registrant             string   `json:"registrant"`
	RegistrantName         string   `json:"registrant_name"`
	RegistrantOrganization string   `json:"registrant_organization"`
	RegistrantStreet       string   `json:"registrant_street"`
	RegistrantCity         string   `json:"registrant_city"`
	RegistrantState        string   `json:"registrant_state"`
	RegistrantPostalCode   string   `json:"registrant_postal_code"`
	RegistrantCountry      string   `json:"registrant_country"`
	RegistrantPhone        string   `json:"registrant_phone"`
	RegistrantPhoneExt     string   `json:"registrant_phone_ext"`
	RegistrantFax          string   `json:"registrant_fax"`
	RegistrantFaxExt       string   `json:"registrant_fax_ext"`
	RegistrantEmail        string   `json:"registrant_email"`
	AdminContact           string   `json:"admin_contact"`
	TechContact            string   `json:"tech_contact"`
	TechEmail              string   `json:"tech_email"`
	NameServers            []string `json:"name_servers"`
	DNSSEC                 string   `json:"dnssec"`
	CreationDate           string   `json:"creation_date"`
	ExpirationDate         string   `json:"expiration_date"`
	UpdatedDate            string   `json:"updated_date"`
	NetRange               string   `json:"net_range"`
	OrgName                string   `json:"org_name"`
	OrgID                  string   `json:"org_id"`
	Address                string   `json:"address"`
	City                   string   `json:"city"`
	State                  string   `json:"state"`
	PostalCode             string   `json:"postal_code"`
	Country                string   `json:"country"`
	RegDate                string   `json:"reg_date"`
	Updated                string   `json:"updated"`
	Comment                string   `json:"comment"`
}

WHOISData represents the structure of WHOIS data you want to extract and store.

func (*WHOISData) IsEmpty added in v0.9.4

func (w *WHOISData) IsEmpty() bool

IsEmpty Returns true if the struct is empty and false if it's not

Jump to

Keyboard shortcuts

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