[AddOn] Auto-Load from SavedState

2012-09-11
2012-09-25
  • Unglued2012
    Unglued2012
    2012-09-11

    Hello folks, I've written a script (BATCH) to automatically load the program
    from a previous saved state.
    This script only works on Windows, but I guess it could be adapted to other OS
    as well.
    I've written it based around multi-core extension given in the link below.
    Another feature of this script is that it automatically saves the password to
    a txt file. (Tee.exe is used for this intent).

    Prerequisites:
    - Use Andreas Meier's PDF multi-threating extension - download
    - tee.exe -> it was hard for me to find this linux command for windows, but I've uploaded it for your benefit
    - continueBruteForceFromSavedState.bat

    How to use it:
    Just place the tee.exe and the batch file in the same directory as
    pdfcrack.exe
    Run the pdfcrack as normal, according to your own parameters, then when you
    close the program, you can just resume the brute force attack by running /
    double clicking the batch file.

    Just in case, here is the script for the batch file I've created:

    @echo off
    :: NUMBER_OF_THREADS - This next line sets the maximum number of cores / threads to be used
    set numOfThreads=4
    
    :: display the header
    echo Resuming the Brute Force Attack using %numOfThreads% threads
    
    :: if 'savedstateperiodic.sav' is newer than 'savedstatecrash.sav' then copy it's contents to *..crash.sav
    xcopy /d /q /y savedstateperiodic.sav savedstatecrash.sav > nul
    
    :: start the brute force attack
    @ echo on
    pdfcrack.exe -l savedstatecrash.sav -t %numOfThreads% | tee log.doc
    @echo off
    
    :: Save / Append Password
    findstr /c:"found user-password:" log.doc >> passwords.txt && echo. >> passwords.txt && echo User-Password was saved to: passwords.txt
    
    :: delete the log file
    del log.doc
    
    :: display message and exit
    echo Press any key to exit . . .
    pause > nul
    exit