Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ http://twitter.com/peepdf

** Installation **

Run, in peepdf directory
You can either
pip install peepdf
This module comes from jbremer fork.

Or download the source and then run inside it :

easy_install .

Expand All @@ -42,38 +46,36 @@ There are two important options when peepdf is executed:

Shows the statistics of the file after being decoded/decrypted and analysed:

peepdf.py [options] pdf_file
peepdf [options] pdf_file


* Interactive console

Executes the interactive console to let play with the PDF file:

peepdf.py -i [options] pdf_file
peepdf -i [options] pdf_file

If no PDF file is specified it's possible to use the decode/encode/js*/sctest commands and create a new PDF file:

peepdf.py -i
peepdf -i


* Batch execution

It's possible to use a commands file to specify the commands to be executed in the batch mode. This type of execution is good to automatise analysis of several files:

peepdf.py [options] -s commands_file pdf_file
peepdf [options] -s commands_file pdf_file



** Updating **

The option has been desactivated as it is not working for now.
To update, cd to peepdf directory and type:
No more updating other than pip utility.
Or run inside peepdf dir :

git pull origin master
git pull <remote> <branch>
easy_install .



** Some hints **

If the information shown when a PDF file is parsed is not enough to know if it's harmful or not, the following commands can help to do it:
Expand Down
251 changes: 63 additions & 188 deletions peepdf/PDFConsole.py

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion peepdf/PDFCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import peepdf.aes as AES
from peepdf.PDFUtils import (
encodeName, unescapeString, encodeString, escapeString, numToHex,
numToString
numToString, vtcheck
)
from peepdf.PDFCrypto import (
RC4, computeObjectKey, computeUserPass, isUserPass, isOwnerPass,
Expand Down Expand Up @@ -4775,6 +4775,27 @@ def __init__(self):
self.numDecodingErrors = 0
self.maxObjectId = 0

def getVtInfo(self, vt_key):
ret = vtcheck(self.getMD5(), vt_key)
if ret[0] == -1:
self.addError(ret[1])
else:
self.parseVtReport(ret[1])

def parseVtReport(self, vtJsonDict):
if vtJsonDict.has_key('response_code'):
if vtJsonDict['response_code'] == 1:
if vtJsonDict.has_key('positives') and vtJsonDict.has_key('total'):
self.setDetectionRate([vtJsonDict['positives'], vtJsonDict['total']])
else:
self.addError('Missing elements in the response from VirusTotal!!')
if vtJsonDict.has_key('permalink'):
self.setDetectionReport(vtJsonDict['permalink'])
else:
self.setDetectionRate(None)
else:
self.addError('Bad response from VirusTotal!!')

def addBody(self, newBody):
if newBody is not None and isinstance(newBody, PDFBody):
self.body.append(newBody)
Expand Down
Loading