[GH-ISSUE #2018] Pdf2john.py #1357

Closed
opened 2026-10-14 03:45:41 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @PracaGrande on GitHub (Feb 3, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2018

Hello, I came across an encrypted PDF file that pdf2john was not able to extract the hash. Do not know why.

$ ./pdf2john.py /tmp/attached_1.final.pdf
/tmp/attached_1.final.pdf : Could not find object id

After speaking with Dhiru he pointed me to https://github.com/kholia/npdf2john. I gave it a try the hash retrieval was successful.

./npdf2john /home/user/attached_1.final.pdf
/home/user/attached_1.final.pdf:$pdf$2_3_128_1073741823_1_32_3034363765643536353134333361626334386434313435343865386236663164_32_0f45ddc9d6cdf4d3b5e3a20be36b6002367c4a6f60c4a77ac488556ca685b537_32_26f2fa264466de642b9aaf1059e8602336f9565ddad7a3e9897f2705ddd1f74d

./john /tmp/hash --fork=4 --mask=?u?u?u?u
Using default input encoding: UTF-8
Loaded 1 password hash (PDF [MD5 SHA2 RC4/AES 32/64])
Node numbers 1-4 of 4 (fork)
Press 'q' or Ctrl-C to abort, almost any other key for status
JAWS (/home/user/attached_1.final.pdf)
3 1g 0:00:00:02 25.00% (ETA: 19:09:43) 0.4405g/s 45269p/s 45269c/s 45269C/s JAWS
4 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 48408p/s 48408c/s 48408C/s ZZZZ
1 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 47404p/s 47404c/s 47404C/s ZZMG
Waiting for 3 children to terminate
2 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 47208p/s 47208c/s 47208C/s ZZZM
Session completed

Would be interesting to understand why pdf2john.py was not able to process this file.

Originally created by @PracaGrande on GitHub (Feb 3, 2016). Original GitHub issue: https://github.com/openwall/john/issues/2018 Hello, I came across an encrypted PDF file that pdf2john was not able to extract the hash. Do not know why. $ ./pdf2john.py /tmp/attached_1.final.pdf /tmp/attached_1.final.pdf : Could not find object id After speaking with Dhiru he pointed me to https://github.com/kholia/npdf2john. I gave it a try the hash retrieval was successful. ./npdf2john /home/user/attached_1.final.pdf /home/user/attached_1.final.pdf:$pdf$2_3_128_1073741823_1_32_3034363765643536353134333361626334386434313435343865386236663164_32_0f45ddc9d6cdf4d3b5e3a20be36b6002367c4a6f60c4a77ac488556ca685b537_32_26f2fa264466de642b9aaf1059e8602336f9565ddad7a3e9897f2705ddd1f74d ./john /tmp/hash --fork=4 --mask=?u?u?u?u Using default input encoding: UTF-8 Loaded 1 password hash (PDF [MD5 SHA2 RC4/AES 32/64]) Node numbers 1-4 of 4 (fork) Press 'q' or Ctrl-C to abort, almost any other key for status JAWS (/home/user/attached_1.final.pdf) 3 1g 0:00:00:02 25.00% (ETA: 19:09:43) 0.4405g/s 45269p/s 45269c/s 45269C/s JAWS 4 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 48408p/s 48408c/s 48408C/s ZZZZ 1 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 47404p/s 47404c/s 47404C/s ZZMG Waiting for 3 children to terminate 2 0g 0:00:00:02 25.00% (ETA: 19:09:43) 0g/s 47208p/s 47208c/s 47208C/s ZZZM Session completed Would be interesting to understand why pdf2john.py was not able to process this file.
bsakaguchi 2026-10-14 03:45:41 +07:00
Author
Owner

@kholia commented on GitHub (Mar 28, 2016):

Should we try making https://github.com/kholia/npdf2john the default PDF hash extraction tool?

"npdf2john" seems to be pretty robust but it is written in Perl which I don't know anything about.

<!-- gh-comment-id:202504148 --> @kholia commented on GitHub (Mar 28, 2016): Should we try making https://github.com/kholia/npdf2john the default PDF hash extraction tool? "npdf2john" seems to be pretty robust but it is written in Perl which I don't know anything about.
Author
Owner

@kholia commented on GitHub (Mar 28, 2016):

http://www.openwall.com/lists/john-users/2016/03/28/4

"pdf2john.py" seems to be failing here too. Let's wait and see if "npdf2john" is any better.

<!-- gh-comment-id:202505252 --> @kholia commented on GitHub (Mar 28, 2016): http://www.openwall.com/lists/john-users/2016/03/28/4 "pdf2john.py" seems to be failing here too. Let's wait and see if "npdf2john" is any better.
Author
Owner

@ShaneQful commented on GitHub (Jan 5, 2017):

Could you give a sample file or if you can't could you uncomment L56 and send us the trailer of the pdf ?

<!-- gh-comment-id:270773200 --> @ShaneQful commented on GitHub (Jan 5, 2017): Could you give a sample file or if you can't could you uncomment L56 and send us the trailer of the pdf ?
Author
Owner

@kholia commented on GitHub (Jan 24, 2017):

Update: We now have pdf2john.pl (formerly called npdf2john) committed in this repository.

<!-- gh-comment-id:274798671 --> @kholia commented on GitHub (Jan 24, 2017): Update: We now have `pdf2john.pl` (formerly called npdf2john) committed in this repository.
Author
Owner

@magnumripper commented on GitHub (Jan 24, 2017):

Since the original issue was solved with npdf2john I'm closing this.

<!-- gh-comment-id:274897951 --> @magnumripper commented on GitHub (Jan 24, 2017): Since the original issue was solved with npdf2john I'm closing this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1357
No description provided.