netinfo

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 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       string     `json:"ip,omitempty"`
	Hostname string     `json:"hostname,omitempty"`
	Ports    []PortInfo `json:"ports,omitempty"`
}

HostInfo contains the information about a single host

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 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"`
}

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 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 ServiceScoutInfo

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

ServiceScoutInfo contains the information about the Nmap scan

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.

Jump to

Keyboard shortcuts

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