fix: Add -nn flag to tcpdump commands to resolve macOS capture issues
This commit is contained in:
@@ -55,7 +55,8 @@ func (c *Capturer) Start(iface string, port int) error {
|
|||||||
// -l: line buffered for real-time output
|
// -l: line buffered for real-time output
|
||||||
// -A: print packet payload in ASCII
|
// -A: print packet payload in ASCII
|
||||||
// -s 0: capture full packets
|
// -s 0: capture full packets
|
||||||
cmd := fmt.Sprintf("sudo tcpdump -l -A -s 0 -i %s port %d 2>/dev/null", iface, port)
|
// -nn: don't resolve hostnames or port names
|
||||||
|
cmd := fmt.Sprintf("sudo tcpdump -l -nn -A -s 0 -i %s port %d 2>/dev/null", iface, port)
|
||||||
|
|
||||||
stdout, stderr, cleanup, err := c.sshClient.StartCommand(cmd)
|
stdout, stderr, cleanup, err := c.sshClient.StartCommand(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ func (c *LocalCapturer) Start(iface string, port int) error {
|
|||||||
// -l: line buffered
|
// -l: line buffered
|
||||||
// -A: print packet payload in ASCII
|
// -A: print packet payload in ASCII
|
||||||
// -s 0: capture full packets
|
// -s 0: capture full packets
|
||||||
args := []string{"-l", "-A", "-s", "0", "-i", iface, "port", fmt.Sprintf("%d", port)}
|
// -nn: don't resolve hostnames or port names
|
||||||
|
args := []string{"-l", "-nn", "-A", "-s", "0", "-i", iface, "port", fmt.Sprintf("%d", port)}
|
||||||
c.cmd = exec.CommandContext(ctx, "tcpdump", args...)
|
c.cmd = exec.CommandContext(ctx, "tcpdump", args...)
|
||||||
|
|
||||||
stdout, err := c.cmd.StdoutPipe()
|
stdout, err := c.cmd.StdoutPipe()
|
||||||
|
|||||||
Reference in New Issue
Block a user