mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Station struct {
|
||||
*Endpoint
|
||||
Frequency int `json:"frequency"`
|
||||
|
@ -9,6 +14,19 @@ type Station struct {
|
|||
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 {
|
||||
return &Station{
|
||||
Endpoint: NewEndpointNoResolve(MonitorModeAddress, bssid, essid, 0),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue