mirror of
https://github.com/bettercap/bettercap.git
synced 2025-09-06 22:27:49 +00:00
fix: fixed a nbns parsing bug who sometimes returned binary hostnames
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package packets
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/evilsocket/islazy/str"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
@@ -27,8 +29,11 @@ var (
|
||||
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": str.Trim(string(udp.Payload[57:72])),
|
||||
hostname := str.Trim(string(udp.Payload[57:72]))
|
||||
if strconv.IsPrint(rune(hostname[0])) {
|
||||
return map[string]string{
|
||||
"nbns:hostname": hostname,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user