Make-pdf-javascript

From aldeid
Jump to navigation Jump to search
You might also see: pdfid
You might also see: pdf-parser

Description

make-pdf-javascript.py is a set of tools written by Didier Stevens, that allow one to create a simple PDF document with embedded JavaScript that will execute upon opening of the PDF document. It’s essentially glue-code for the mPDF.py module which contains a class with methods to create headers, indirect objects, stream objects, trailers and XREFs.

Installation

$ mkdir -p /data/src/make-pdf-javascript/
$ cd /data/src/make-pdf-javascript/
$ wget http://didierstevens.com/files/software/make-pdf_V0_1_4.zip
$ unzip make-pdf_V0_1_4.zip
$ chmod +x make-pdf-*.py

Usage

make-pdf-javascript

Syntax

Usage: make-pdf-javascript.py [options] pdf-file

Options

--version
show program's version number and exit
-h, --help
show this help message and exit
-j JAVASCRIPT, --javascript=JAVASCRIPT
javascript to embed (default embedded JavaScript is app.alert messagebox)
-f JAVASCRIPTFILE, --javascriptfile=JAVASCRIPTFILE
javascript file to embed (default embedded JavaScript is app.alert messagebox)

make-pdf-embedded

Syntax

Usage: make-pdf-embedded.py [options] file-to-embed pdf-file

Options

--version
show program's version number and exit
-h, --help
show this help message and exit
-f FILTERS, --filters=FILTERS
filters to apply, f for FlateDecode (default), h for ASCIIHexDecode
-t, --nobinary
don't add the comment for binary format
-a, --autoopen
open the embedded file automatically when the PDF is opened
-b, --button
add a "button" to launch the embedded file
-s, --stego
"hide" the embedded file by replacing /EmbeddedFiles with /Embeddedfiles
-m MESSAGE, --message=MESSAGE
text to display in the PDF document

Examples

Javascript

Let's embed a javascript in a PDF file:

$ ./make-pdf-javascript.py -j "app.launchURL('http://www.aldeid.com');" launchurl.pdf

Once executed, the PDF warns the user and opens the URL with the default browser if the message is confirmed:

Embedded file

INCOMPLETE SECTION OR ARTICLE
This section/article is being written and is therefore not complete.
Thank you for your comprehension.

Comments