mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -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
|
@ -3,18 +3,20 @@ package modules
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/bettercap/bettercap/core"
|
||||
"github.com/bettercap/bettercap/packets"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
|
||||
"github.com/evilsocket/islazy/str"
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
)
|
||||
|
||||
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))
|
||||
s += fmt.Sprintf("%s:%s ", tui.Blue(name), tui.Yellow(value))
|
||||
}
|
||||
|
||||
NewSnifferEvent(
|
||||
|
@ -24,10 +26,10 @@ func upnpParser(ip *layers.IPv4, pkt gopacket.Packet, udp *layers.UDP) bool {
|
|||
ip.DstIP.String(),
|
||||
nil,
|
||||
"%s %s -> %s : %s",
|
||||
core.W(core.BG_RED+core.FG_BLACK, "upnp"),
|
||||
tui.Wrap(tui.BACKRED+tui.FOREBLACK, "upnp"),
|
||||
vIP(ip.SrcIP),
|
||||
vIP(ip.DstIP),
|
||||
core.Trim(s),
|
||||
str.Trim(s),
|
||||
).Push()
|
||||
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue