LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

How do you extract the files transferred in a pcap, and how do you recognise a file that pretends to be another type?

tshark -r capture.pcap --export-objects "http,/tmp/out/" writes every file transferred over HTTP into a folder; the file command then identifies each by its content (magic bytes), revealing, for example, a Windows executable named like a picture or document.

Extraction. tshark is Wireshark's command-line version. With --export-objects http,<dir> it reassembles each HTTP response body from the capture and saves it as a file, ready for analysis. Wireshark offers the same under File → Export Objects. Other protocols such as SMB and TFTP are supported too.

Spotting disguised files. File names and extensions are just labels the sender chooses. Malware is often delivered as invoice.jpg or update.txt to look harmless. The Unix file command ignores the name and inspects the first bytes, the magic number that identifies the real format:

Magic bytes Real type
MZ (4D 5A) Windows PE executable or DLL
%PDF PDF document
PK (50 4B) ZIP (also .docx, .jar, .apk)
\x89PNG PNG image

A file named like an image or text file whose file output says PE32 executable is a strong red flag. Handle extracted samples only on an isolated system, since they may be live malware.

Go deeper:

From Quiz: ISLAB / Network Security Monitoring | Updated: Dec 01, 2026