Debian Codegraph @

packets/dot11_types_test.go

raw symbols SCIP
1 package packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/
2
3 import (
4 "reflectscip-go gomod github.com/golang/go/src go1.16 reflect/"
5 "testingscip-go gomod github.com/golang/go/src go1.16 testing/"
6 )
7
8 func TestDot11CipherTypesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11CipherTypes().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
9 var units = []struct {
10 got interface{}
11 exp interface{}
12 }{
13 {uint8(Dot11CipherWepscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep.), uint8(1)},
14 {uint8(Dot11CipherTkipscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherTkip.), uint8(2)},
15 {uint8(Dot11CipherWrapscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWrap.), uint8(3)},
16 {uint8(Dot11CipherCcmpscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherCcmp.), uint8(4)},
17 {uint8(Dot11CipherWep104scip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep104.), uint8(5)},
18 }
19 for _, u := range units {
20 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
21 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
22 }
23 }
24 }
25
26 func TestDot11CipherTypesAsStringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11CipherTypesAsString().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
27 var units = []struct {
28 got interface{}
29 exp interface{}
30 }{
31 {Dot11CipherWepscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().(), "WEP"},
32 {Dot11CipherTkipscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherTkip..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().(), "TKIP"},
33 {Dot11CipherWrapscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWrap..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().(), "WRAP"},
34 {Dot11CipherCcmpscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherCcmp..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().(), "CCMP"},
35 {Dot11CipherWep104scip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherWep104..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11CipherType#String().(), "WEP104"},
36 }
37 for _, u := range units {
38 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
39 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
40 }
41 }
42 }
43
44 func TestDot11AuthTypesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11AuthTypes().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
45 var units = []struct {
46 got interface{}
47 exp interface{}
48 }{
49 {uint8(Dot11AuthMgtscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthMgt.), uint8(1)},
50 {uint8(Dot11AuthPskscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthPsk.), uint8(2)},
51 }
52 for _, u := range units {
53 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
54 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
55 }
56 }
57 }
58
59 func TestDot11AuthTypesAsStringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11AuthTypesAsString().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
60 var units = []struct {
61 got interface{}
62 exp interface{}
63 }{
64 {Dot11AuthMgtscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthMgt..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType#String().(), "MGT"},
65 {Dot11AuthPskscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthPsk..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11AuthType#String().(), "PSK"},
66 }
67 for _, u := range units {
68 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
69 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
70 }
71 }
72 }
73
74 func TestDot11CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11CipherSuite().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
75 // must be three, but not currently
76 // implemented to really enforce [3]byte
77 bytes := []byte{1, 2, 3}
78 cs := CipherSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#{
79 OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI.: bytes,
80 }
81 var units = []struct {
82 got interface{}
83 exp interface{}
84 }{
85 {cs.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI., bytes},
86 }
87 for _, u := range units {
88 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
89 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
90 }
91 }
92 }
93
94 func TestDot11AuthSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11AuthSuite().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
95 // must be three, but not currently
96 // implemented to really enforce [3]byte
97 bytes := []byte{1, 2, 3}
98 cs := AuthSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#{
99 OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#OUI.: bytes,
100 }
101 var units = []struct {
102 got interface{}
103 exp interface{}
104 }{
105 {cs.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#OUI., bytes},
106 }
107 for _, u := range units {
108 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
109 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
110 }
111 }
112 }
113
114 func TestDot11CipherSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11CipherSuiteSelector().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
115 count := uint16(1)
116 cs := CipherSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#{
117 Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count.: count,
118 }
119 var units = []struct {
120 got interface{}
121 exp interface{}
122 }{
123 {cs.Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuiteSelector#Count., count},
124 }
125 for _, u := range units {
126 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
127 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
128 }
129 }
130 }
131
132 func TestDot11AuthSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11AuthSuiteSelector().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
133 count := uint16(1)
134 cs := AuthSuiteSelectorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#{
135 Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count.: count,
136 }
137 var units = []struct {
138 got interface{}
139 exp interface{}
140 }{
141 {cs.Countscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuiteSelector#Count., count},
142 }
143 for _, u := range units {
144 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
145 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
146 }
147 }
148 }
149
150 func TestDot11RSNInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11RSNInfo().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
151 version := uint16(1)
152 rsn := RSNInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#{
153 Versionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Version.: version,
154 }
155 var units = []struct {
156 got interface{}
157 exp interface{}
158 }{
159 {rsn.Versionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/RSNInfo#Version., version},
160 {rsn.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#{}},
161 {rsn.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#{}},
162 {rsn.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#{}},
163 }
164 for _, u := range units {
165 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
166 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
167 }
168 }
169 }
170
171 func TestDot11VendorInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11VendorInfo().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
172 version := uint16(1)
173 vendor := VendorInfoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#{
174 WPAVersionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#WPAVersion.: version,
175 }
176 var units = []struct {
177 got interface{}
178 exp interface{}
179 }{
180 {vendor.WPAVersionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/VendorInfo#WPAVersion., version},
181 {vendor.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#{}},
182 {vendor.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#{}},
183 {vendor.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#{}},
184 }
185 for _, u := range units {
186 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
187 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
188 }
189 }
190 }
191
192 func TestDot11canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11canParse().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
193 err := canParsescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/canParse().("example", []byte{}, 0)
194 if err != nil {
195 t.Errorscip-go gomod github.com/golang/go/src go1.16 testing/common#Error().("unable to check if able to parse")
196 }
197 }
198
199 func TestDot11parsePairwiseSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11parsePairwiseSuite().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
200 buf := []byte{0, 0, 1, 1}
201 suite, err := parsePairwiseSuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parsePairwiseSuite().(buf)
202 var units = []struct {
203 got interface{}
204 exp interface{}
205 }{
206 {suite.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/CipherSuite#OUI., buf[0:3]},
207 {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])},
208 {err, nil},
209 }
210 for _, u := range units {
211 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
212 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
213 }
214 }
215 }
216
217 func TestDot11parseAuthkeySuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/TestDot11parseAuthkeySuite().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
218 buf := []byte{0, 0, 1, 1}
219 suite, err := parseAuthkeySuitescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/parseAuthkeySuite().(buf)
220 var units = []struct {
221 got interface{}
222 exp interface{}
223 }{
224 {suite.OUIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/AuthSuite#OUI., buf[0:3]},
225 {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])},
226 {err, nil},
227 }
228 for _, u := range units {
229 if !reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(u.exp, u.got) {
230 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("expected '%v', got '%v'", u.exp, u.got)
231 }
232 }
233 }
234
235 // TODO: add test for Dot11InformationElementVendorInfoDecode
236 // TODO: add test for Dot11InformationElementIDDSSetDecode