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 ¶
- func ValidateConnection(ctx context.Context, config connect.ValidateConnectionConfig) (*connect.ValidateConnectionReport, error)
- func WithAllowDesktopPopups(ctx context.Context, allow bool) context.Context
- func WithPlatformURL(ctx context.Context, url string) context.Context
- func WithTestOnly(ctx context.Context, testOnly bool) context.Context
- type ConnectionResult
- func (r *ConnectionResult) WithAuthFailed(msg string) *ConnectionResult
- func (r *ConnectionResult) WithError(outcome connect.ConnectionOutcome, msg string) *ConnectionResult
- func (r *ConnectionResult) WithSuccess() *ConnectionResult
- func (r *ConnectionResult) WithTimeout(msg string) *ConnectionResult
- type NetworkSecurityType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateConnection ¶
func ValidateConnection(ctx context.Context, config connect.ValidateConnectionConfig) (*connect.ValidateConnectionReport, error)
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 ¶
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 ¶
WithPlatformURL sets the URL to test for platform connectivity after successful connection.
func WithTestOnly ¶
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 ¶
func (r *ConnectionResult) WithError(outcome connect.ConnectionOutcome, msg string) *ConnectionResult
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.