mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
new: net.sniff now supports ipv6
This commit is contained in:
parent
bef4c6abaa
commit
cbc1432358
13 changed files with 122 additions and 83 deletions
|
@ -1,6 +1,7 @@
|
|||
package net_sniff
|
||||
|
||||
import (
|
||||
"net"
|
||||
"regexp"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
|
@ -14,7 +15,7 @@ var (
|
|||
ftpRe = regexp.MustCompile(`^(USER|PASS) (.+)[\n\r]+$`)
|
||||
)
|
||||
|
||||
func ftpParser(ip *layers.IPv4, pkt gopacket.Packet, tcp *layers.TCP) bool {
|
||||
func ftpParser(srcIP, dstIP net.IP, payload []byte, pkt gopacket.Packet, tcp *layers.TCP) bool {
|
||||
data := string(tcp.Payload)
|
||||
|
||||
if matches := ftpRe.FindAllStringSubmatch(data, -1); matches != nil {
|
||||
|
@ -23,13 +24,13 @@ func ftpParser(ip *layers.IPv4, pkt gopacket.Packet, tcp *layers.TCP) bool {
|
|||
NewSnifferEvent(
|
||||
pkt.Metadata().Timestamp,
|
||||
"ftp",
|
||||
ip.SrcIP.String(),
|
||||
ip.DstIP.String(),
|
||||
srcIP.String(),
|
||||
dstIP.String(),
|
||||
nil,
|
||||
"%s %s > %s:%s - %s %s",
|
||||
tui.Wrap(tui.BACKYELLOW+tui.FOREWHITE, "ftp"),
|
||||
vIP(ip.SrcIP),
|
||||
vIP(ip.DstIP),
|
||||
vIP(srcIP),
|
||||
vIP(dstIP),
|
||||
vPort(tcp.DstPort),
|
||||
tui.Bold(what),
|
||||
tui.Yellow(cred),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue