A PCAP file extractor tool to recover embedded images and data files from network capture files (.pcap/.pcapng). The tool provides both a command-line interface (CLI) and a GUI built with PyQt5, and is designed to run on Windows (also works on Linux/macOS).
-
Multi-format support:
Extracts common file types i.e.JPEG,PNG,BMP,PDF,Office documents,ZIP/GZIP,MP3,MP4, etc.) from PCAPs. -
CLI mode:
Script-based usage with options to select file types (e.g.,--jpg,--png, or--all). -
GUI mode:
User-friendlyQtinterface with progress bar and status messages. PCAP/PCAPNG: Supports both pcap and pcapng formats. -
Self-contained executable:
Can build a single Windows.EXEusingPyInstaller(no Python install needed on target). -
Lightweight:
No heavy dependencies beyondPyQt5; uses nativetsharkfor packet parsing.
- Python: Version 3.6 or higher.
- PyQt5: GUI framework (install via pip install PyQt5).
- Wireshark/TShark:
The tshark CLI tool (usually included with Wireshark) must be installed and in your system PATH. - PyInstaller: (Optional)
Only needed if you want to build a standalone executable.
- Clone the repository or download the source code.
- Install dependencies:
pip install PyQt5 - Install Wireshark: Download and install Wireshark for your OS. Ensure that the tshark executable is accessible (add it to your PATH on Windows).
- PyInstaller: (Optional) If you plan to create an executable, install PyInstaller:
pip install pyinstaller
-
Run the CLI script directly with Python. For example, to extract all supported file types from a PCAP:
python PCAP_Extractor.py path/to/capture.pcap --all -o output_dir
-
This scans capture.pcap, extracts every supported file type, and saves results under output_dir/ (created if needed). The script prints progress messages and a summary. You can also specify individual types instead of --all. For example, to extract only images:
python PCAP_Extractor.py capture.pcap --jpg --png --gif -o images_out
- If no types are selected (and --all is not used), the tool will prompt you to choose something.
-
Launch the GUI version to use a graphical interface:
python PCAP_Extractor_GUI.py
-
In the GUI window, click
Browseto select the input PCAP file and the output directory. Check the boxes for thefile typesyou want to extract (or click Select All). Then clickStart Extraction. The progress bar will update and a status message will appear when done. -
The GUI window is themed in dark mode. It uses the provided
icon.pngas the application icon. (On Windows, the title bar and taskbar icon will show this icon.)
-
To create a standalone Windows executable with
PyInstaller, run the following commands in your project directory:pip install pyinstaller pyinstaller --onefile --windowed --icon=icon.png PCAP_Extractor_GUI.py
-
The
--onefileoption bundles everything into a singleEXE. -
The
--windowedflag (or--noconsole) prevents a console window from appearing (useful for GUI apps). -
--icon=icon.pngtells PyInstaller to use the providedicon.pngas the application’s icon. -
After running PyInstaller, you’ll find
PCAP_Extractor_GUI.exein thedist/folder. You can similarly build a CLI executable (without --windowed) by running:pyinstaller --onefile PCAP_Extractor.py
Note: On Windows, run these commands in the Command Prompt or PowerShell. Make sure icon.png is in the current directory so PyInstaller can include it.
- Encrypted/Unsupported Traffic: Encrypted streams (HTTPS, TLS) or proprietary protocols will not yield extractable data. Only clear-text TCP payloads are scanned.
- TShark dependency: This tool relies on the external
tsharkutility. The PCAP is fed totshark(via subprocess) to extract raw TCP payloads. If tshark is not installed or not in PATH, extraction will fail. - File Types: Only the file signatures listed in the code are detected. Files using the same headers but different formats may be falsely identified.
- Performance: Very large PCAP files may consume significant memory and time, as all TCP payloads are concatenated in memory before scanning. Use adequate system resources.
- Filename Collisions: Extracted files are named with a timestamp to reduce collisions, but if run rapidly, files may overwrite. You can change the naming scheme in the code if needed.
- Windows Paths: On Windows, avoid extremely long file paths. Use short directory names or run from a root directory if path-length errors occur.
- Developer: Developed by Uzzam Arif.
- Libraries: Built with
PyQt5and Python’s standard library. - Tools: Extraction logic leverages Wireshark Tshark for packet parsing.
- Icon: The GUI icon is provided (
icon.png) – sourced from the public domain. - Inspiration: This tool was inspired by various network forensics scripts and exercises in packet analysis.
This project is released under the MIT License. See the LICENSE file for details.