How do you get the hash from a PDF?
#1
Before you point me to pdf2hashcat.py, hear me out.

I tried this with a PDF file that I have, and the problem is that it returns this error:


Code:
b.pdf : Could not find /ID tag

It's a password-protected PDF that you can't read without entering the password.

The metadata I get from ExifTool is pasted below. 

Code:
ExifTool Version Number         : 10.88
File Name                       : b.pdf
Directory                       : .
File Size                       : 913 kB
File Modification Date/Time     : 2018:03:31 21:08:54+09:00
File Access Date/Time           : 2018:03:31 21:08:58+09:00
File Creation Date/Time         : 2018:03:31 21:08:54+09:00
File Permissions                : rw-rw-rw-
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.7
Linearized                      : No
Encryption                      : Standard V4.4 (128-bit)
User Access                     : Print, Modify, Copy, Annotate, Fill forms, Extract, Assemble, Print high-res
Warning                         : Document is password protected (use Password option)

I can't even get through the first hurdle of getting the hash for the password. Is there any way around this?
#2
I was able to get this by running it on pdfcrack.exe

Code:
PDF version 1.7
Security Handler: Standard
V: 2
R: 3
P: -4
Length: 128
Encrypted Metadata: True
FileID: a*d***23*****c4*******7****82**
U: 0****a6***37**e4**2**0**7**a**1**00**0**000**0**00***********00000
O: e***72***fd***d7**78**f9**c44**9*ac**0*f*a*8*7**e*e*a*e*2*0*25**d

I'm not sure how to interpret this: which is the hash for the password? U? O?
#3
They are both hashes which allow different access. U: is for user password, which will only allow you to view the content of the pdf. O: is for owner password, which will grant change permissions.

Hashcat only cracks encrypted PDFs, and the one you are posting about is password protected, not encrypted. There are many tools freely available that will strip out the password protection. Hashcat cannot crack password protected PDFs. I'm sure you can do the research to find these tools. Smile