Commit dc597dae authored by Emanuele Acri (Kali Developer)'s avatar Emanuele Acri (Kali Developer)

Merge tag 'upstream/0.2r183'

Upstream version 0.2r183
parents e4a2652f d77f6f77
......@@ -3,7 +3,7 @@
# http://peepdf.eternal-todo.com
# By Jose Miguel Esparza <jesparza AT eternal-todo.com>
#
# Copyright (C) 2012 Jose Miguel Esparza
# Copyright (C) 2011-2013 Jose Miguel Esparza
#
# This file is part of peepdf.
#
......@@ -53,6 +53,7 @@ FILE_ADD = 2
VAR_WRITE = 3
VAR_ADD = 4
newLine = os.linesep
errorsFile = 'errors.txt'
filter2RealFilterDict = {'b64':'base64','base64':'base64','asciihex':'/ASCIIHexDecode','ahx':'/ASCIIHexDecode','ascii85':'/ASCII85Decode','a85':'/ASCII85Decode','lzw':'/LZWDecode','flatedecode':'/FlateDecode','fl':'/FlateDecode','runlength':'/RunLengthDecode','rl':'/RunLengthDecode','ccittfax':'/CCITTFaxDecode','ccf':'/CCITTFaxDecode','jbig2':'/JBIG2Decode','dct':'/DCTDecode','jpx':'/JPXDecode'}
warningColor = Fore.YELLOW
errorColor = Fore.RED
......@@ -68,6 +69,7 @@ class PDFConsole(cmd.Cmd):
'''
Class of the peepdf interactive console. To see details about commands: http://code.google.com/p/peepdf/wiki/Commands
'''
def __init__(self, pdfFile, outputColors = False, stdin = None):
cmd.Cmd.__init__(self, stdin = stdin)
if COLORIZED_OUTPUT:
......@@ -88,6 +90,7 @@ class PDFConsole(cmd.Cmd):
self.loggingFile = None
self.output = None
self.redirect = None
self.leaving = False
self.outputVarName = None
self.outputFileName = None
self.avoidOutputColors = outputColors
......@@ -101,6 +104,10 @@ class PDFConsole(cmd.Cmd):
else:
return line
def postloop(self):
print newLine + 'Leaving the Peepdf interactive console...Bye! ;)' + newLine
self.leaving = True
def do_bytes(self, argv):
if self.pdfFile == None:
message = '*** Error: You must open a file!!'
......@@ -2287,11 +2294,13 @@ class PDFConsole(cmd.Cmd):
object = self.pdfFile.getObject(id, v)
objectType = object.getType()
if objectType == 'dictionary' or objectType == 'stream':
type = object.getElementByName('/Type').getValue()
if type == '/Metadata':
value = object.getValue()
if value != '':
output += 'Object '+str(id)+' in version '+str(v)+':' + newLine*2+value+newLine*2
subType = object.getElementByName('/Type')
if subType != []:
subType = subType.getValue()
if subType == '/Metadata':
value = object.getValue()
if value != '':
output += 'Object '+str(id)+' in version '+str(v)+':' + newLine*2+value+newLine*2
self.log_output('metadata ' + argv, output, storeOutput = True)
else:
message = '*** No metadata found!!'
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment