Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating pdf crate from 0.8.1 to 0.9.0 #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adi928
Copy link

@adi928 adi928 commented Feb 14, 2025

I was facing a problem when decrrypting a pdf:

$ pdfrip -f ~/encrypted.pdf wordlist ~/forPdf.txt         
           .___ _____       .__        
______   __| _// ____\______|__|_____  
\____ \ / __ |\   __\\_  __ \  \____ \ 
|  |_> > /_/ | |  |   |  | \/  |  |_> >
|   __/\____ | |__|   |__|  |__|   __/ 
|__|        \/                 |__|    2.0.1

 2025-02-14T23:09:14.566Z INFO  engine > Starting password cracking job...
thread '<unnamed>' panicked at /Users/adi928/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pdf-0.8.1/src/crypt.rs:290:41:
range end index 128 out of range for slice of length 16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    32620 abort      pdfrip -f ~/encrypted.pdf wordlist ~/forPdf.txt

Basically, for some reason pdf crate was unable to execute function key_derivation_owner_password_rc4 and was performing hash.compute on a digest size of 16 with a keySize of 128. I'm don't know if it picked the correct algorithm for decryption since we don't provide that explicitly.

Updating pdf crate version was a shot in the dark and it seemed to have worked for me.

In order to actually update the crate, I had to add I guess a logging framework as a 5th parameter, which I chose as NoLog since I don't know the proper log framework in Rust (this is my first rust push).

Fix working:

➜  $ cd target/release 
➜  $ ./pdfrip -f ~/encrypted.pdf wordlist ~/forPdf.txt       
           .___ _____       .__        
______   __| _// ____\______|__|_____  
\____ \ / __ |\   __\\_  __ \  \____ \ 
|  |_> > /_/ | |  |   |  | \/  |  |_> >
|   __/\____ | |__|   |__|  |__|   __/ 
|__|        \/                 |__|    2.0.1

 2025-02-14T23:10:28.415Z INFO  engine > Starting password cracking job...
  [00:00:00] [████████████████████████████████████████]   10000/10000   100% 41711/s ETA: 0s
 2025-02-14T23:10:28.659Z INFO  cli_interface > Failed to crack file...

@adi928 adi928 mentioned this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant