fix: wifi.AccessPoint and wifi.Station now export the Channel field via JSON

This commit is contained in:
evilsocket 2019-02-24 20:12:41 +01:00
commit 78c341c2b3
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
5 changed files with 13 additions and 16 deletions

View file

@ -7,6 +7,7 @@ import (
type Station struct {
*Endpoint
Frequency int `json:"frequency"`
Channel int `json:"channel"`
RSSI int8 `json:"rssi"`
Sent uint64 `json:"sent"`
Received uint64 `json:"received"`
@ -19,7 +20,6 @@ type Station struct {
func cleanESSID(essid string) string {
res := ""
for _, c := range essid {
if strconv.IsPrint(c) {
res += string(c)
@ -34,6 +34,7 @@ func NewStation(essid, bssid string, frequency int, rssi int8) *Station {
return &Station{
Endpoint: NewEndpointNoResolve(MonitorModeAddress, bssid, cleanESSID(essid), 0),
Frequency: frequency,
Channel: Dot11Freq2Chan(frequency),
RSSI: rssi,
WPS: make(map[string]string),
Handshake: NewHandshake(),
@ -48,10 +49,6 @@ func (s *Station) ESSID() string {
return s.Hostname
}
func (s *Station) Channel() int {
return Dot11Freq2Chan(s.Frequency)
}
func (s *Station) HasWPS() bool {
return len(s.WPS) > 0
}