mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 04:59:25 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
fc840f413f
commit
51f563d830
2 changed files with 9 additions and 10 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/evilsocket/bettercap-ng/core"
|
"github.com/evilsocket/bettercap-ng/core"
|
||||||
|
@ -415,7 +414,7 @@ func (w *WiFiRecon) updateStats(dot11 *layers.Dot11, packet gopacket.Packet) {
|
||||||
if ok, enc := packets.Dot11ParseEncryption(packet, dot11); ok == true {
|
if ok, enc := packets.Dot11ParseEncryption(packet, dot11); ok == true {
|
||||||
bssid := dot11.Address3.String()
|
bssid := dot11.Address3.String()
|
||||||
if station, found := w.Session.WiFi.Get(bssid); found == true {
|
if station, found := w.Session.WiFi.Get(bssid); found == true {
|
||||||
station.Encryption = strings.Join(enc, ", ")
|
station.Encryption = enc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,13 +64,13 @@ func Dot11ParseIDSSID(packet gopacket.Packet) (bool, string) {
|
||||||
return false, ""
|
return false, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dot11ParseEncryption(packet gopacket.Packet, dot11 *layers.Dot11) (bool, []string) {
|
func Dot11ParseEncryption(packet gopacket.Packet, dot11 *layers.Dot11) (bool, string) {
|
||||||
enc := make([]string, 0)
|
enc := ""
|
||||||
found := false
|
found := false
|
||||||
|
|
||||||
if dot11.Flags.WEP() {
|
if dot11.Flags.WEP() {
|
||||||
found = true
|
found = true
|
||||||
enc = append(enc, "WEP")
|
enc = "WEP"
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, layer := range packet.Layers() {
|
for _, layer := range packet.Layers() {
|
||||||
|
@ -79,16 +79,16 @@ func Dot11ParseEncryption(packet gopacket.Packet, dot11 *layers.Dot11) (bool, []
|
||||||
if ok == true {
|
if ok == true {
|
||||||
found = true
|
found = true
|
||||||
if info.ID == layers.Dot11InformationElementIDRSNInfo {
|
if info.ID == layers.Dot11InformationElementIDRSNInfo {
|
||||||
enc = append(enc, "WPA2")
|
enc = "WPA2"
|
||||||
} else if info.ID == layers.Dot11InformationElementIDVendor && bytes.Index(info.Info, []byte{0, 0x50, 0xf2, 1, 1, 0}) == 0 {
|
} else if info.ID == layers.Dot11InformationElementIDVendor && bytes.Index(info.OUI, []byte{0, 0x50, 0xf2, 1, 1, 0}) == 0 {
|
||||||
enc = append(enc, "WPA")
|
enc = "WPA"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if found && len(enc) == 0 {
|
if found && enc == "" {
|
||||||
enc = append(enc, "OPEN")
|
enc = "OPEN"
|
||||||
}
|
}
|
||||||
|
|
||||||
return found, enc
|
return found, enc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue