| 1 | package packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.16 fmt/" |
| 6 | ) |
| 7 | |
| 8 | type Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# uint8 |
| 9 | |
| 10 | const ( |
| 11 | Dot11CipherWepscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# = 1 |
| 12 | Dot11CipherTkipscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherTkip. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# = 2 |
| 13 | Dot11CipherWrapscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWrap. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# = 3 |
| 14 | Dot11CipherCcmpscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherCcmp. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# = 4 |
| 15 | Dot11CipherWep104scip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep104. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# = 5 |
| 16 | ) |
| 17 | |
| 18 | func (a Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#) Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().() string { |
| 19 | switch a { |
| 20 | case Dot11CipherWepscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep.: |
| 21 | return "WEP" |
| 22 | case Dot11CipherTkipscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherTkip.: |
| 23 | return "TKIP" |
| 24 | case Dot11CipherWrapscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWrap.: |
| 25 | return "WRAP" |
| 26 | case Dot11CipherCcmpscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherCcmp.: |
| 27 | return "CCMP" |
| 28 | case Dot11CipherWep104scip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep104.: |
| 29 | return "WEP104" |
| 30 | default: |
| 31 | return "UNK" |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | type Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType# uint8 |
| 36 | |
| 37 | const ( |
| 38 | Dot11AuthMgtscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthMgt. Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType# = 1 |
| 39 | Dot11AuthPskscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthPsk. Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType# = 2 |
| 40 | ) |
| 41 | |
| 42 | func (a Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType#) Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType#String().() string { |
| 43 | switch a { |
| 44 | case Dot11AuthMgtscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthMgt.: |
| 45 | return "MGT" |
| 46 | case Dot11AuthPskscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthPsk.: |
| 47 | return "PSK" |
| 48 | default: |
| 49 | return "UNK" |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | type CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite# struct { |
| 54 | OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI. []byte // 3 bytes |
| 55 | Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#Type. Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType# |
| 56 | } |
| 57 | |
| 58 | type AuthSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite# struct { |
| 59 | OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#OUI. []byte // 3 bytes |
| 60 | Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#Type. Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType# |
| 61 | } |
| 62 | |
| 63 | type CipherSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector# struct { |
| 64 | Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. uint16 |
| 65 | Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Suites. []CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite# |
| 66 | } |
| 67 | |
| 68 | type AuthSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector# struct { |
| 69 | Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. uint16 |
| 70 | Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Suites. []AuthSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite# |
| 71 | } |
| 72 | |
| 73 | type RSNInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo# struct { |
| 74 | Versionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Version. uint16 |
| 75 | Groupscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Group. CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite# |
| 76 | Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise. CipherSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector# |
| 77 | AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey. AuthSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector# |
| 78 | } |
| 79 | |
| 80 | type VendorInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo# struct { |
| 81 | WPAVersionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#WPAVersion. uint16 |
| 82 | Multicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Multicast. CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite# |
| 83 | Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast. CipherSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector# |
| 84 | AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey. AuthSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector# |
| 85 | } |
| 86 | |
| 87 | func canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().(what string, buf []byte, need int) error { |
| 88 | available := len(buf) |
| 89 | if need > available { |
| 90 | return fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.16 fmt/Errorf().("Malformed 802.11 packet, could not parse %s: needed %d bytes but only %d are available.", what, need, available) |
| 91 | } |
| 92 | return nil |
| 93 | } |
| 94 | |
| 95 | func parsePairwiseSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parsePairwiseSuite().(buf []byte) (suite CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#, err error) { |
| 96 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN.Pairwise.Suite", buf, 4); err == nil { |
| 97 | suite.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI. = buf[0:3] |
| 98 | suite.Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#Type. = Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#(buf[3]) |
| 99 | } |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | func parseAuthkeySuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parseAuthkeySuite().(buf []byte) (suite AuthSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#, err error) { |
| 104 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN.AuthKey.Suite", buf, 4); err == nil { |
| 105 | suite.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#OUI. = buf[0:3] |
| 106 | suite.Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#Type. = Dot11AuthTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType#(buf[3]) |
| 107 | } |
| 108 | return |
| 109 | } |
| 110 | |
| 111 | func Dot11InformationElementVendorInfoDecodescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11InformationElementVendorInfoDecode().(buf []byte) (v VendorInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#, err error) { |
| 112 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("Vendor", buf, 8); err == nil { |
| 113 | v.WPAVersionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#WPAVersion. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[0:2]) |
| 114 | v.Multicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Multicast..OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI. = buf[2:5] |
| 115 | v.Multicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Multicast..Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#Type. = Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#(buf[5]) |
| 116 | v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[6:8]) |
| 117 | buf = buf[8:] |
| 118 | } else { |
| 119 | v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = 0 |
| 120 | return |
| 121 | } |
| 122 | |
| 123 | // check what we're left with |
| 124 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("Vendor.Unicast.Suites", buf, int(v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count.)*4); err == nil { |
| 125 | for i := uint16(0); i < v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count.; i++ { |
| 126 | if suite, err := parsePairwiseSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parsePairwiseSuite().(buf); err == nil { |
| 127 | v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Suites. = append(v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Suites., suite) |
| 128 | buf = buf[4:] |
| 129 | } else { |
| 130 | return v, err |
| 131 | } |
| 132 | } |
| 133 | } else { |
| 134 | v.Unicastscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#Unicast..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = 0 |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("Vendor.AuthKey.Count", buf, 2); err == nil { |
| 139 | v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[0:2]) |
| 140 | buf = buf[2:] |
| 141 | } else { |
| 142 | v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = 0 |
| 143 | return |
| 144 | } |
| 145 | |
| 146 | // just like before, check if we have enough data |
| 147 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("Vendor.AuthKey.Suites", buf, int(v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count.)*4); err == nil { |
| 148 | for i := uint16(0); i < v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count.; i++ { |
| 149 | if suite, err := parseAuthkeySuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parseAuthkeySuite().(buf); err == nil { |
| 150 | v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Suites. = append(v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Suites., suite) |
| 151 | buf = buf[4:] |
| 152 | } else { |
| 153 | return v, err |
| 154 | } |
| 155 | } |
| 156 | } else { |
| 157 | v.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = 0 |
| 158 | } |
| 159 | |
| 160 | return |
| 161 | } |
| 162 | |
| 163 | func Dot11InformationElementRSNInfoDecodescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11InformationElementRSNInfoDecode().(buf []byte) (rsn RSNInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#, err error) { |
| 164 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN", buf, 8); err == nil { |
| 165 | rsn.Versionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Version. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[0:2]) |
| 166 | rsn.Groupscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Group..OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI. = buf[2:5] |
| 167 | rsn.Groupscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Group..Typescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#Type. = Dot11CipherTypescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#(buf[5]) |
| 168 | rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[6:8]) |
| 169 | buf = buf[8:] |
| 170 | } else { |
| 171 | rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = 0 |
| 172 | return |
| 173 | } |
| 174 | |
| 175 | // check what we're left with |
| 176 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN.Pairwise.Suites", buf, int(rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count.)*4); err == nil { |
| 177 | for i := uint16(0); i < rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count.; i++ { |
| 178 | if suite, err := parsePairwiseSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parsePairwiseSuite().(buf); err == nil { |
| 179 | rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Suites. = append(rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Suites., suite) |
| 180 | buf = buf[4:] |
| 181 | } else { |
| 182 | return rsn, err |
| 183 | } |
| 184 | } |
| 185 | } else { |
| 186 | rsn.Pairwisescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Pairwise..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count. = 0 |
| 187 | return |
| 188 | } |
| 189 | |
| 190 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN.AuthKey.Count", buf, 2); err == nil { |
| 191 | rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = binaryscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/LittleEndian..Uint16scip-go gomod github.com/golang/go/src go1.16 `encoding/binary`/littleEndian#Uint16().(buf[0:2]) |
| 192 | buf = buf[2:] |
| 193 | } else { |
| 194 | rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = 0 |
| 195 | return |
| 196 | } |
| 197 | |
| 198 | // just like before, check if we have enough data |
| 199 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("RSN.AuthKey.Suites", buf, int(rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count.)*4); err == nil { |
| 200 | for i := uint16(0); i < rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count.; i++ { |
| 201 | if suite, err := parseAuthkeySuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parseAuthkeySuite().(buf); err == nil { |
| 202 | rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Suites. = append(rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Suitesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Suites., suite) |
| 203 | buf = buf[4:] |
| 204 | } else { |
| 205 | return rsn, err |
| 206 | } |
| 207 | } |
| 208 | } else { |
| 209 | rsn.AuthKeyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#AuthKey..Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count. = 0 |
| 210 | } |
| 211 | |
| 212 | return |
| 213 | } |
| 214 | |
| 215 | func Dot11InformationElementIDDSSetDecodescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11InformationElementIDDSSetDecode().(buf []byte) (channel int, err error) { |
| 216 | if err = canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("DSSet.channel", buf, 1); err == nil { |
| 217 | channel = int(buf[0]) |
| 218 | } |
| 219 | |
| 220 | return |
| 221 | } |