new: added new wifi RSN parsing

This commit is contained in:
Simone Margaritelli 2024-08-23 10:39:58 +02:00
commit f0126c28fb
2 changed files with 20 additions and 11 deletions

View file

@ -28,25 +28,34 @@ func (a Dot11CipherType) String() string {
case Dot11CipherWep104: case Dot11CipherWep104:
return "WEP104" return "WEP104"
default: default:
return "UNK" return fmt.Sprintf("UNK CIPHER %d", a)
} }
} }
type Dot11AuthType uint8 type Dot11AuthType uint8
const ( const (
Dot11AuthMgt Dot11AuthType = 1 Dot11AuthNone Dot11AuthType = 0
Dot11AuthPsk Dot11AuthType = 2 Dot11AuthWPA Dot11AuthType = 1
Dot11AuthPSK Dot11AuthType = 2
Dot11AuthFT8021X Dot11AuthType = 3
Dot11AuthFTPSK Dot11AuthType = 4
) )
func (a Dot11AuthType) String() string { func (a Dot11AuthType) String() string {
switch a { switch a {
case Dot11AuthMgt: case Dot11AuthNone:
return "MGT" return "NONE"
case Dot11AuthPsk: case Dot11AuthWPA:
return "WPA"
case Dot11AuthPSK:
return "PSK" return "PSK"
case Dot11AuthFT8021X:
return "FT 802.1X"
case Dot11AuthFTPSK:
return "FT PSK"
default: default:
return "UNK" return fmt.Sprintf("UNK AUTH %d", a)
} }
} }

View file

@ -46,8 +46,8 @@ func TestDot11AuthTypes(t *testing.T) {
got interface{} got interface{}
exp interface{} exp interface{}
}{ }{
{uint8(Dot11AuthMgt), uint8(1)}, {uint8(Dot11AuthWPA), uint8(1)},
{uint8(Dot11AuthPsk), uint8(2)}, {uint8(Dot11AuthPSK), uint8(2)},
} }
for _, u := range units { for _, u := range units {
if !reflect.DeepEqual(u.exp, u.got) { if !reflect.DeepEqual(u.exp, u.got) {
@ -61,8 +61,8 @@ func TestDot11AuthTypesAsString(t *testing.T) {
got interface{} got interface{}
exp interface{} exp interface{}
}{ }{
{Dot11AuthMgt.String(), "MGT"}, {Dot11AuthWPA.String(), "WPA"},
{Dot11AuthPsk.String(), "PSK"}, {Dot11AuthPSK.String(), "PSK"},
} }
for _, u := range units { for _, u := range units {
if !reflect.DeepEqual(u.exp, u.got) { if !reflect.DeepEqual(u.exp, u.got) {