mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
new: new upnp discovery response parser
This commit is contained in:
parent
7a662cfee4
commit
1da54080b9
2 changed files with 39 additions and 0 deletions
|
@ -49,6 +49,8 @@ func udpParser(ip *layers.IPv4, pkt gopacket.Packet, verbose bool) {
|
||||||
return
|
return
|
||||||
} else if krb5Parser(ip, pkt, udp) {
|
} else if krb5Parser(ip, pkt, udp) {
|
||||||
return
|
return
|
||||||
|
} else if upnpParser(ip, pkt, udp) {
|
||||||
|
return
|
||||||
} else if verbose {
|
} else if verbose {
|
||||||
NewSnifferEvent(
|
NewSnifferEvent(
|
||||||
pkt.Metadata().Timestamp,
|
pkt.Metadata().Timestamp,
|
||||||
|
|
37
modules/net_sniff_upnp.go
Normal file
37
modules/net_sniff_upnp.go
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package modules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/bettercap/bettercap/core"
|
||||||
|
"github.com/bettercap/bettercap/packets"
|
||||||
|
|
||||||
|
"github.com/google/gopacket"
|
||||||
|
"github.com/google/gopacket/layers"
|
||||||
|
)
|
||||||
|
|
||||||
|
func upnpParser(ip *layers.IPv4, pkt gopacket.Packet, udp *layers.UDP) bool {
|
||||||
|
if data := packets.UPNPGetMeta(pkt); data != nil && len(data) > 0 {
|
||||||
|
s := ""
|
||||||
|
for name, value := range data {
|
||||||
|
s += fmt.Sprintf("%s:%s ", core.Blue(name), core.Yellow(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
NewSnifferEvent(
|
||||||
|
pkt.Metadata().Timestamp,
|
||||||
|
"upnp",
|
||||||
|
ip.SrcIP.String(),
|
||||||
|
ip.DstIP.String(),
|
||||||
|
nil,
|
||||||
|
"%s %s -> %s : %s",
|
||||||
|
core.W(core.BG_RED+core.FG_BLACK, "upnp"),
|
||||||
|
vIP(ip.SrcIP),
|
||||||
|
vIP(ip.DstIP),
|
||||||
|
core.Trim(s),
|
||||||
|
).Push()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue