mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
new: parsing WPS RF bands
This commit is contained in:
parent
053fa343f3
commit
be055f5e41
1 changed files with 25 additions and 1 deletions
|
@ -53,7 +53,7 @@ var (
|
||||||
0x1011: wpsAttr{Name: "Device Name", Type: wpsStr},
|
0x1011: wpsAttr{Name: "Device Name", Type: wpsStr},
|
||||||
0x1053: wpsAttr{Name: "Selected Registrar Config Methods", Func: dot11ParseWPSConfigMethods},
|
0x1053: wpsAttr{Name: "Selected Registrar Config Methods", Func: dot11ParseWPSConfigMethods},
|
||||||
0x1008: wpsAttr{Name: "Config Methods", Func: dot11ParseWPSConfigMethods},
|
0x1008: wpsAttr{Name: "Config Methods", Func: dot11ParseWPSConfigMethods},
|
||||||
0x103C: wpsAttr{Name: "RF Bands"},
|
0x103C: wpsAttr{Name: "RF Bands", Func: dott11ParseWPSBands},
|
||||||
0x1045: wpsAttr{Name: "SSID", Type: wpsStr},
|
0x1045: wpsAttr{Name: "SSID", Type: wpsStr},
|
||||||
0x102D: wpsAttr{Name: "OS Version", Type: wpsStr},
|
0x102D: wpsAttr{Name: "OS Version", Type: wpsStr},
|
||||||
0x1049: wpsAttr{Name: "Vendor Extension"},
|
0x1049: wpsAttr{Name: "Vendor Extension"},
|
||||||
|
@ -70,8 +70,32 @@ var (
|
||||||
0x0080: "Push Button",
|
0x0080: "Push Button",
|
||||||
0x0100: "Keypad",
|
0x0100: "Keypad",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wpsBands = map[uint8]string{
|
||||||
|
0x01: "2.4Ghz",
|
||||||
|
0x02: "5.0Ghz",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func dott11ParseWPSBands(data []byte) string {
|
||||||
|
if len(data) == 1 {
|
||||||
|
mask := uint8(data[0])
|
||||||
|
bands := []string{}
|
||||||
|
|
||||||
|
for bit, band := range wpsBands {
|
||||||
|
if mask&bit != 0 {
|
||||||
|
bands = append(bands, band)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(bands) > 0 {
|
||||||
|
return strings.Join(bands, ", ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hex.EncodeToString(data)
|
||||||
|
}
|
||||||
|
|
||||||
func dot11ParseWPSConfigMethods(data []byte) string {
|
func dot11ParseWPSConfigMethods(data []byte) string {
|
||||||
if len(data) == 2 {
|
if len(data) == 2 {
|
||||||
mask := binary.BigEndian.Uint16(data)
|
mask := binary.BigEndian.Uint16(data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue