wap

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package wap handles wireless access point association validation. It attempts to connect to target networks using test credentials and records the outcomes to validate security controls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConnection

ValidateConnection performs active connection validation against a target wireless network. It attempts to connect using test credentials based on the detected security configuration and records outcomes.

func WithAllowDesktopPopups

func WithAllowDesktopPopups(ctx context.Context, allow bool) context.Context

WithAllowDesktopPopups sets whether infrascan is allowed to trigger desktop/OS password dialogs (e.g., NetworkManager secret agent popups) during association attempts.

Default behavior should be "false" (no popups). If popups are disallowed, platform implementations may refuse to attempt certain association operations that are known to trigger OS UI on authentication failure.

func WithPlatformURL

func WithPlatformURL(ctx context.Context, url string) context.Context

WithPlatformURL sets the URL to test for platform connectivity after successful connection.

func WithTestOnly

func WithTestOnly(ctx context.Context, testOnly bool) context.Context

WithTestOnly sets whether infrascan should disconnect and restore the original WiFi connection after a successful connection test.

When testOnly is true (default): After testing, disconnect from the target network and restore the original WiFi connection.

When testOnly is false: Stay connected to the target network on success. The original network will NOT be restored.

Types

type ConnectionResult

type ConnectionResult struct {
	Outcome                  connect.ConnectionOutcome
	ConnectedBSSID           *string // Actual BSSID connected to (from iw/wpa_cli/nmcli)
	AssociationStatusCode    *connect.AssociationStatusCode
	AssociationStatusCodeRaw *int
	DeauthReasonCode         *connect.DeauthReasonCode
	DeauthReasonCodeRaw      *int
	HandshakeProgress        *connect.HandshakeProgress
	Timing                   *connect.ConnectionTiming
	RetryCount               *int
	AttemptedSecurity        *connect.NegotiatedSecurity
	NegotiatedSecurity       *connect.NegotiatedSecurity
	IPAcquired               *bool
	IPAddress                *string
	DhcpServer               *string
	Gateway                  *string
	DNSServers               []string
	PortalDetected           *bool
	PortalURL                *string
	EapMethodNegotiated      *connect.EapMethod
	ErrorMessage             *string
	PlatformConnectivity     *connect.PlatformConnectivityResult
}

ConnectionResult holds the result of a connection attempt. This is populated by platform-specific code.

func NewConnectionResult

func NewConnectionResult() *ConnectionResult

NewConnectionResult creates a new ConnectionResult with default values.

func (*ConnectionResult) WithAuthFailed

func (r *ConnectionResult) WithAuthFailed(msg string) *ConnectionResult

WithAuthFailed sets the result as authentication failed.

func (*ConnectionResult) WithError

WithError sets the result with a generic error.

func (*ConnectionResult) WithSuccess

func (r *ConnectionResult) WithSuccess() *ConnectionResult

WithSuccess sets the result as successful.

func (*ConnectionResult) WithTimeout

func (r *ConnectionResult) WithTimeout(msg string) *ConnectionResult

WithTimeout sets the result as timed out.

type NetworkSecurityType

type NetworkSecurityType int

NetworkSecurityType represents the detected security type of a wireless network.

const (
	// NetworkSecurityUnknown indicates the security type could not be determined.
	NetworkSecurityUnknown NetworkSecurityType = iota
	// NetworkSecurityOpen indicates an open network with no authentication required.
	NetworkSecurityOpen
	// NetworkSecurityPSK indicates WPA/WPA2/WPA3-Personal requiring a pre-shared key.
	NetworkSecurityPSK
	// NetworkSecurityEAP indicates WPA/WPA2/WPA3-Enterprise requiring EAP identity/password.
	NetworkSecurityEAP
)

func (NetworkSecurityType) String

func (s NetworkSecurityType) String() string

String returns a human-readable name for the security type.

Jump to

Keyboard shortcuts

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