utils

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDependencies

func CheckDependencies(binaries []string) bool

check dependencies to ensure required binaries are installed

func ConfigureIPAddresses

func ConfigureIPAddresses(interfaces []string, app *tview.Application, pages *tview.Pages, mainView tview.Primitive) error

ConfigureIPAddresses configures IP addresses for the selected interfaces

func ConfigureNetworkInterfaces

func ConfigureNetworkInterfaces(app *tview.Application, pages *tview.Pages, mainView tview.Primitive) error

ConfigureNetworkInterfaces handles the configuration of the main network interface

func ConfigureVLANs

func ConfigureVLANs(mainInterface string, vlanIDs []string) error

ConfigureVLANs creates and configures VLAN interfaces

func CreateHostfile

func CreateHostfile(scanFiles []string, hostfilePath string) error

createHostfile aggregates all IP addresses from various scan outputs into a single hostfile.

func DetectInterfaceForIPRange

func DetectInterfaceForIPRange(ipRange string) (interfaceName string, vlanID string, err error)

DetectInterfaceForIPRange attempts to detect the network interface and VLAN ID based on the IP range.

func EnsureDir

func EnsureDir(dirName string) error

ensure directory exists and create if it does not

func ExtractIPFromLine

func ExtractIPFromLine(line string) string

extractIPFromLine extracts the first valid IPv4 address from a given line.

func GetAllConfiguredInterfaces

func GetAllConfiguredInterfaces(mainInterface string) ([]string, error)

GetAllConfiguredInterfaces returns a list of all interfaces including VLANs

func GetEthernetInterfaces

func GetEthernetInterfaces() ([]net.Interface, error)

GetEthernetInterfaces retrieves all wired Ethernet interfaces, excluding wireless and subinterfaces.

func GetInterfaceStatus

func GetInterfaceStatus(name string) (string, error)

func GetMainInterface

func GetMainInterface() string

GetMainInterface returns the currently set main interface

func GetSubinterfaces

func GetSubinterfaces(ifaceName string) ([]string, error)

GetSubinterfaces retrieves all subinterfaces for a given parent interface.

func GetWiresharkVLANs

func GetWiresharkVLANs() ([]string, error)

GetWiresharkVLANs reads the VLAN analysis results from the most recent Wireshark capture

func GetWorkingDirectory

func GetWorkingDirectory() string

get the working directory from the configuration

func IsValidInterface

func IsValidInterface(ifaceName string) bool

IsValidInterface validates whether the provided interface name exists and is a valid Ethernet interface.

func PerformCategorization

func PerformCategorization(hostfilesDir, arpScanFile, pingScanFile, dnsLookupFile, windowsDiscoveryFile, nmapXMLPath string) error

PerformCategorization processes scan results and categorizes each IP.

func SetMainInterface

func SetMainInterface(iface string) error

SetMainInterface sets the main interface

Types

type ARPResult

type ARPResult struct {
	IP     string
	MAC    string
	Vendor string
}

ARPResult holds the parsed information from ARP scan

type Category

type Category string

Category represents a classification category for IP addresses.

const (
	CategoryWindowsServer       Category = "Windows_Server"
	CategoryWindowsClient       Category = "Windows_Client"
	CategoryWindowsUnknown      Category = "Windows_Unknown"
	CategoryLinux               Category = "Linux"
	CategoryPrinter             Category = "Printers"
	CategoryUPS                 Category = "UPS"
	CategoryNAS                 Category = "NAS"
	CategoryFirewall            Category = "Firewalls"
	CategoryRouterSwitch        Category = "Routers_Switches"
	CategoryLightsOutManagement Category = "Lights_Out_Management"
	CategoryUnknown             Category = "Unknown"
)

type HostInfo

type HostInfo struct {
	IP        string
	MAC       string
	MACVendor string
	HostNames []string
	Ports     []Port
	OS        struct {
		Vendor   string
		Family   string
		Gen      string
		Detail   string
		Accuracy int
	}
	Services []Service
}

HostInfo holds parsed information from Nmap XML

type Port

type Port struct {
	Protocol string
	PortID   int
	State    string
	Service  Service
}

type Service

type Service struct {
	Name      string
	Product   string
	Version   string
	ExtraInfo string
}

type VLANAnalysis

type VLANAnalysis []struct {
	VLANID string `json:"VLANID"`
}

VLANAnalysis represents the structure of the VLAN analysis JSON output

Jump to

Keyboard shortcuts

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