katana.units.pdf.pdfcrack — PDFCrack - Crack Password

Crack a password-protected PDF

This unit attempt to unlock a password-protected PDF file. This is done with the PyPDF2 module in Python, which must be installed for this work. First the unit will try with an empty password, and then it will try with the user-supplied password argument. Finally, it will bruteforce with a supplied dictionary file.

The unit inherits from katana.unit.FileUnit to ensure the target is a PDF file.

Note

Note that it only (potentially) determines the password, but does nothing else with the file.

class katana.units.pdf.pdfcrack.Unit(*args, **kwargs)

Bases: katana.unit.FileUnit

BLOCKED_GROUPS = ['pdf']

PDFs shouldn’t come out of this. So no reason to look.

GROUPS = ['pdf', 'pdfcrack']

These are “tags” for a unit. Considering it is a pdf unit, “pdf” is included.

PRIORITY = 25

Priority works with 0 being the highest priority, and 100 being the lowest priority. 50 is the default priorty. This unit has a high priority if this is detected…

RECURSE_SELF = False

Again no PDF from this. So recursion is silly.

enumerate()

This function will first yield an empty password, then the supplied password argument, then loop through each line of a provided dictionary file. The password will then be used by the evaluate function to try and open the encrypted PDF.

evaluate(case: Any) → None

Evaluate the target. Attempt to open the PDF document with a supplied password given by enumerate.

Parameters:case – A case returned by enumerate. In this case, this will be a string value supplied as an argument or bruteforce via a supplied dictionary file.
Returns:None. This function should not return any data.