mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
refact: refactored to use islazy and updated deps
This commit is contained in:
parent
a2b3ee79fb
commit
d070445225
238 changed files with 12662 additions and 1586 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/bettercap/bettercap/core"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
|
@ -44,7 +44,7 @@ func MDNSGetMeta(pkt gopacket.Packet) map[string]string {
|
|||
for _, raw := range answer.TXTs {
|
||||
if value := string(raw); strings.Contains(value, "=") {
|
||||
parts := strings.SplitN(value, "=", 2)
|
||||
meta["mdns:"+core.Trim(parts[0])] = core.Trim(parts[1])
|
||||
meta["mdns:"+str.Trim(parts[0])] = str.Trim(parts[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package packets
|
||||
|
||||
import (
|
||||
"github.com/bettercap/bettercap/core"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
|
@ -28,7 +28,7 @@ func NBNSGetMeta(pkt gopacket.Packet) map[string]string {
|
|||
if ludp := pkt.Layer(layers.LayerTypeUDP); ludp != nil {
|
||||
if udp := ludp.(*layers.UDP); udp != nil && udp.SrcPort == NBNSPort && len(udp.Payload) >= NBNSMinRespSize {
|
||||
return map[string]string{
|
||||
"nbns:hostname": core.Trim(string(udp.Payload[57:72])),
|
||||
"nbns:hostname": str.Trim(string(udp.Payload[57:72])),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
// "net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/bettercap/bettercap/core"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
|
@ -39,7 +39,7 @@ func UPNPGetMeta(pkt gopacket.Packet) map[string]string {
|
|||
meta := make(map[string]string)
|
||||
for name, values := range response.Header {
|
||||
if name != "Cache-Control" && len(values) > 0 {
|
||||
if data := core.Trim(strings.Join(values, ", ")); data != "" {
|
||||
if data := str.Trim(strings.Join(values, ", ")); data != "" {
|
||||
meta["upnp:"+name] = data
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue