Skip to main content

peepdf-3 - peepdf for Python 3

peepdf-3 is a Python 3 tool to explore PDF files in order to find out if the file can be harmful or not. The aim of this tool is to provide all the necessary components that a security researcher could need in a PDF analysis without using 3 or 4 tools to complete the task.

With peepdf it's possible to see all the objects in the document showing the suspicious elements, supports all the most used filters and encodings, it can parse different versions of a file, object streams and encrypted files. With the installation of STPyV8 and Pylibemu it provides Javascript and shellcode analysis wrappers too. Apart of this it's able to create new PDF files and to modify/obfuscate existent ones.

As of version 3.0.0, peepdf-3 no longer includes pylibemu as a requirement in order to use peepdf-3 on Windows systems. However, all functionality of libemu, pylibemu, and sctest still exist, and will function on Linux systems.

PyPI - Version

Features

The main functionalities of peepdf are the following:

Analysis:

  • Decodings: hexadecimal, octal, name objects
  • More used filters
  • References in objects and where an object is referenced
  • Strings search (including streams)
  • Physical structure (offsets)
  • Logical tree structure
  • Metadata
  • Modifications between versions (changelog)
  • Compressed objects (object streams)
  • Analysis and modification of Javascript (STPyV8): unescape, replace, join
  • Shellcode analysis (Libemu python wrapper, pylibemu)
  • Variables (set command)
  • Extraction of old versions of the document
  • Easy extraction of objects, Javascript code, shellcodes (>, >>, $>, $>>)
  • Checking hashes on VirusTotal
  • Detection of common encryption methods
  • Output of XML and JSON data

Creation/Modification:

  • Basic PDF creation
  • Creation of PDF with Javascript executed wen the document is opened
  • Creation of object streams to compress objects
  • Embedded PDFs
  • Strings and names obfuscation
  • Malformed PDF output: without endobj, garbage in the header, bad header...
  • Filters modification
  • Objects modification

Ways to use peepdf:

  • Basic execution
  • Interactive console
  • Script mode
  • JSON Output
  • XML Output
  • VirusTotal analysis
  • OCR

TODO:

  • Embedded PDFs analysis
  • Improving automatic Javascript analysis
  • GUI

Related articles:

Included in:

Installation

You can install / use peepdf-3 via these methods:

  • From PyPI via pip - python3 -m pip install peepdf-3
  • From GitHub via pip and git - python3 -m pip install git+https://github.com/digitalsleuth/peepdf-3.git
  • Clone the GitHub repo, cd into the peepdf-3 folder, chmod +x peepdf.py and ./peepdf.py

Current Known Limitations

  • As of version 3.0.0, there are no limitations with the installation and usage of peepdf-3, as the hard requirement for pylibemu has been lifted. The functionality still remains for Linux systems.

Notes

  • The current maintainer of this project (Corey Forman - digitalsleuth), does not receive any funding for, and is not currently seeking any monetary contributions for this work. If you are willing to provide assistance, programming contributions, and feedback, that is always welcome.
  • As this project originated with Jose Miguel Esparza, I will continue to leave his sentiments, and PayPal link, below to acknowledge his original product.

You are free to contribute with feedback, bugs, patches, etc. Any help is welcome. Also, if you really enjoy using peepdf, you think it is worth it and you feel really generous today you can donate some bucks to the project ;) Thanks!

Metadata

Release files for peepdf-3 6.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for peepdf-3 6.0.3
File Size Uploaded
peepdf_3-6.0.3.tar.gz 230.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for peepdf-3 6.0.3
File Interpreter ABI Platform
peepdf_3-6.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 473.7 kB

Release files / peepdf_3-6.0.3.tar.gz

Download URL peepdf_3-6.0.3.tar.gz
Size 230.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bc5e71e29a164a120ef7f6929836fb82990e5cab2d1b82fb2a3a1abb9dfcd277
BLAKE2b-256 checksum
How to use checksums
711a99f8671e342a6f2ed2ad68dd214879b955f138fd89ad0eec284e8ca19596
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / peepdf_3-6.0.3-py3-none-any.whl

Download URL peepdf_3-6.0.3-py3-none-any.whl
Size 242.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2243f472139a0c2e72665ad7b9c5372315d2c444977434b85ba4154c48fc1caa
BLAKE2b-256 checksum
How to use checksums
f2b059cd8f95f23bb0dbea9e6a02fee14bd22c65070d0bad00b7b51f5c74300c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

6.0.3 This release

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.4.1

2 release files

5.4.0

2 release files

5.3.0

2 release files

5.2.0

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.10

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page