nerdexam
EC-Council

312-50V10 · Question #322

What is the correct PCAP filter to capture all TCP traffic going to or from host 192.168.0.125 on port 25?

The correct answer is D. tcp.port == 25 and ip.host == 192.168.0.125. Wireshark display filters use a field-based syntax where tcp.port matches traffic on either source or destination port, and ip.host resolves to the target IP.

Sniffing

Question

What is the correct PCAP filter to capture all TCP traffic going to or from host 192.168.0.125 on port 25?

Options

  • Atcp.src == 25 and ip.host == 192.168.0.125
  • Bhost 192.168.0.125:25
  • Cport 25 and host 192.168.0.125
  • Dtcp.port == 25 and ip.host == 192.168.0.125

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    12% (3)
  • C
    4% (1)
  • D
    80% (20)

Why each option

Wireshark display filters use a field-based syntax where tcp.port matches traffic on either source or destination port, and ip.host resolves to the target IP.

Atcp.src == 25 and ip.host == 192.168.0.125

tcp.src == 25 only matches packets where port 25 is the source port, missing all inbound traffic destined for port 25 and therefore failing to capture all traffic 'to or from' the host.

Bhost 192.168.0.125:25

The syntax host 192.168.0.125:25 is not valid in either BPF capture filter or Wireshark display filter format and will produce a parse error.

Cport 25 and host 192.168.0.125

port 25 and host 192.168.0.125 is valid BPF capture filter syntax but does not restrict results to TCP-only traffic, potentially including UDP port 25 traffic.

Dtcp.port == 25 and ip.host == 192.168.0.125Correct

The display filter tcp.port == 25 correctly matches TCP segments where port 25 appears in either the source or destination field, capturing traffic both to and from that port. Combined with ip.host == 192.168.0.125, the full filter isolates all TCP port 25 traffic for that specific host using valid Wireshark display filter syntax, which is the correct approach for this type of targeted capture.

Concept tested: Wireshark display filter syntax for TCP host and port

Source: https://www.wireshark.org/docs/man-pages/wireshark-filter.html

Topics

#PCAP filter#Wireshark#TCP filter#BPF syntax

Community Discussion

No community discussion yet for this question.

Full 312-50V10 Practice