mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
fix: clean ESSID from non printable characters.
This commit is contained in:
parent
36cc91a0d5
commit
38faff29d5
1 changed files with 18 additions and 0 deletions
|
@ -1,5 +1,10 @@
|
||||||
package network
|
package network
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
type Station struct {
|
type Station struct {
|
||||||
*Endpoint
|
*Endpoint
|
||||||
Frequency int `json:"frequency"`
|
Frequency int `json:"frequency"`
|
||||||
|
@ -9,6 +14,19 @@ type Station struct {
|
||||||
Encryption string `json:"encryption"`
|
Encryption string `json:"encryption"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cleanESSID(essid string) string {
|
||||||
|
res := ""
|
||||||
|
|
||||||
|
for _, c := range essid {
|
||||||
|
if strconv.IsPrint(c) {
|
||||||
|
res += string(c)
|
||||||
|
} else {
|
||||||
|
res += fmt.Sprintf("{0x%02x}", c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
func NewStation(essid, bssid string, frequency int, rssi int8) *Station {
|
func NewStation(essid, bssid string, frequency int, rssi int8) *Station {
|
||||||
return &Station{
|
return &Station{
|
||||||
Endpoint: NewEndpointNoResolve(MonitorModeAddress, bssid, essid, 0),
|
Endpoint: NewEndpointNoResolve(MonitorModeAddress, bssid, essid, 0),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue