mufeedvh / pdfrip

A multi-threaded PDF password cracking utility equipped with commonly encountered password format builders and dictionary attacks.
MIT License
589 stars 67 forks source link

Reimplement src/core/engine.rs to fix race conditions #15

Closed Pommaq closed 8 months ago

Pommaq commented 8 months ago

Addresses #14 Pseudocode for the new engine algorithm:

            Start threads, they read until they get a RecvError::Disconnected 
                If successful, try the password. Send results if success

            Main thread:
                Loop:
                    * try_recv
                        if successful, break
                        if Disconnected, all threads have died. Exit
                        if Empty, proceed.

                    * producer:
                        if password generator is empty, close sender and break
                        else send next password in buffer. 
                            if Disconnected, break

                Close password sender.
                Block on result receiever.
                    If successfully received password: good
                    if RecvError::Disconnected, report failure. We did not find the password :(
Pommaq commented 8 months ago

Running the situation presented in #13 shows this appears to work.

Pommaq commented 8 months ago

There are issues in this implementation where unsuccessful cracks never exits. I will look at this later

Pommaq commented 8 months ago

Fixed

mufeedvh commented 8 months ago

Thank you! Merging this right away! :raised_hands: