How to extract files from HTTP traffic in a PCAP and hash them

When a host downloads something over plain HTTP, the whole file crosses the wire and the capture holds every byte. Rebuilding it lets you hash it, compare it with known-bad lists and hand it to malware analysis, without going back to the server it came from.

By Stuart Mathieson7 minute readWireshark + tsharkUpdated 12 October 2026
The quick way

PCAPNG Analyzer Pro rebuilds every file sent or received over plain HTTP for you, decoded and hashed. It marks uploads and incomplete files, and checks every hash against your threat-intel lists. One click copies a hash or downloads the file.

Try it free on your own computer →
In this guide
  1. What can be recovered
  2. Export objects in Wireshark
  3. Export from the command line
  4. Hash and identify the files
  5. Check each file is complete
  6. Handle files safely
  7. Manual vs automated workflow

1. What can be recovered

Only clear-text transfers can be rebuilt from a capture alone. In practice that means:

Files fetched over HTTPS are encrypted. Without the session keys, recorded at capture time (for example via a browser's SSLKEYLOGFILE), they can't be recovered from the capture, however complete it is.

2. Export objects in Wireshark

Choose File → Export Objects → HTTP. Wireshark reassembles each HTTP conversation and lists every body it found, with the packet, host name, content type, size and file name. Type in the filter box to narrow the list, then Save one object or Save All.

If HTTP runs on an unusual port and nothing is listed, right-click a packet in that conversation and use Decode As to treat the port as HTTP, then export again.

3. Export from the command line

tshark writes every HTTP object into a directory:

tshark -r capture.pcapng -q --export-objects http,objects

File names come from the URL, so expect names built from query strings, and numbered copies where names repeat. Don't trust a file name or its extension to say what a file is; the next step checks that. Swap http for smb, tftp or imf to export those protocols instead.

4. Hash and identify the files

# Linux and macOS (macOS: shasum -a 256)
sha256sum objects/*

# Windows PowerShell
Get-FileHash -Algorithm SHA256 objects\*

To compare against a list of known-bad SHA-256 hashes, one per line:

sha256sum objects/* | grep -i -F -f hashes.txt

Then check what each file really is. On Linux and macOS, file objects/* reads the first bytes rather than the name, so it shows an executable posing as an image. It also shows whether a body was saved still compressed (gzip compressed data). Threat feeds list the hash of the decoded file, so hash the decompressed version of any body that was sent with Content-Encoding: gzip.

5. Check each file is complete

A hash only means something for the whole file. A file is likely incomplete when:

An incomplete file can still be useful for its type, strings or embedded addresses, but its hash won't match any list. Say so in your notes rather than reporting "hash not found".

6. Handle files safely

A clean hash isn't a clean file.

"Not found" in a database only means nobody has reported that exact file. New or tailored malware is unknown by definition, and one changed byte changes the hash.

Manual method vs PCAPNG Analyzer

Manual method

  1. Export HTTP objects with Wireshark or tshark.
  2. Hash every file and compare with your lists.
  3. Check each file's real type and completeness.
  4. Decompress encoded bodies before hashing.
  5. Look up unknown hashes by hand.

With PCAPNG Analyzer

  1. Upload the capture.
  2. Under HTTP Hosts, choose See files: every file with its type, size and SHA-256 hash, with uploads and incomplete files marked.
  3. Copy a hash to look it up, or download the file to analyse in isolation. A hash on your threat-intel lists raises a finding.
How the app rebuilds files

Each conversation that carried an HTTP request is reassembled from the original capture, then bodies are de-chunked and decoded (gzip and deflate), so the hash is of the file itself, which is what threat feeds list. Brotli-encoded bodies are hashed as sent. Decoding stops at 64 MB per file and 256 MB per capture, so a compression "bomb" can't exhaust memory; a file past either limit is hashed as sent and marked incomplete. Downloads are always saved as files, never opened in the browser.

Every HTTP file, hashed and checked

See what crossed your network in clear text, with hashes matched against your own lists, on a server you control.

Compare Free and ProSelf-host it