nerdexam
CompTIA

XK0-005 · Question #237

A junior systems administrator needs to make a packet capture file that will only capture HTTP protocol data to a file called test.pcap. Which of the following commands would allow the administrator…

The correct answer is D. tcpdump -i eth0 port 80 -w test.pcap. To create a packet capture file specifically for HTTP traffic on a network interface, tcpdump with appropriate filters and output options is the correct tool.

Troubleshooting

Question

A junior systems administrator needs to make a packet capture file that will only capture HTTP protocol data to a file called test.pcap. Which of the following commands would allow the administrator to accomplish this task?

Options

  • Anetcat -p 80 -w test.pcap
  • Btshark -r test.pcap -o http
  • Ctcpdump -i eth0 port 80 -r test.pcap
  • Dtcpdump -i eth0 port 80 -w test.pcap

How the community answered

(33 responses)
  • A
    12% (4)
  • B
    3% (1)
  • C
    9% (3)
  • D
    76% (25)

Why each option

To create a packet capture file specifically for HTTP traffic on a network interface, `tcpdump` with appropriate filters and output options is the correct tool.

Anetcat -p 80 -w test.pcap

`netcat` (nc) is a general-purpose networking utility for reading and writing data across network connections; it is not designed for promiscuous packet capturing and filtering like `tcpdump`.

Btshark -r test.pcap -o http

`tshark -r test.pcap -o http` specifies reading packets *from* an existing file (`-r`) rather than capturing them live, and `-o http` sets a preference for HTTP dissection, not a capture filter.

Ctcpdump -i eth0 port 80 -r test.pcap

`tcpdump -i eth0 port 80 -r test.pcap` incorrectly uses the `-r` option (read from file) with a capture interface (`-i eth0`) and a filter, preventing it from performing a live capture to a new file as requested.

Dtcpdump -i eth0 port 80 -w test.pcapCorrect

The command `tcpdump -i eth0 port 80 -w test.pcap` correctly captures network traffic on the `eth0` interface, filters it to only include data on port `80` (HTTP), and writes all the captured packets to a file named `test.pcap`.

Concept tested: tcpdump packet capture and filtering

Source: https://www.tcpdump.org/manpages/tcpdump.1.html

Topics

#tcpdump#Packet Capture#Networking#CLI

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice