-
Notifications
You must be signed in to change notification settings - Fork 11
/
pdfanalysis.py
32 lines (32 loc) · 1012 Bytes
/
pdfanalysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from PyPDF2 import PdfFileReader
R = '\033[1;31;40m'
G = '\033[1;32;40m'
C = '\033[1;36;40m'
Y = '\033[1;33;40m'
def pdfinfo():
filep=input("File path >> ")
with open(filep, 'rb') as f:
pdf = PdfFileReader(f)
info = pdf.getDocumentInfo()
number_of_pages = pdf.getNumPages()
try:
author = info.author
creator = info.creator
producer = info.producer
print(C+"[+] Author : ",author)
print(C+"[+] Creator : ",creator)
print(C+"[+] Producer : ",producer)
cdate=info['/CreationDate']
cyear=cdate[2:6]
cmonth=cdate[6:8]
cd=cdate[8:10]
print(C+"[+] Creation Date : ",cd,":",cmonth,":",cyear)
mdate=info['/ModDate']
myear=cdate[2:6]
mmonth=cdate[6:8]
md=cdate[8:10]
print(C+"[+] Modified Date : ",md,":",mmonth,":",myear)
except:
print(R+"[-] Meta data not available")
if __name__=="__main__":
pdfinfo()