katana.units.zip.unzip — Unzip/Crack ZIP Password

ZIP file extraction

This unit attempt to extract a ZIP file. 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 upplied dictionary file. The process is done with a dependency, using the unzip command like so:

unzip -P <password> <target_path>

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

class katana.units.zip.unzip.Unit(*args, **kwargs)

Bases: katana.unit.FileUnit

DEPENDENCIES = ['unzip']

This process is done with the unzip command because the Python method bottlenecks.

GROUPS = ['zip', 'office', 'archive']

These are “tags” for a unit. Considering it is a zip unit, “zip” is included, as well as a few other key words.

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 moderately high priority due to speed and broadness of applicability

RECURSE_SELF = True

In can case we have nested ZIPs, we can recurse into ourselves

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 extract the ZIP fike.

evaluate(case: str)

Evaluate the target. Extract the target with ZIP and recurse on any new found files.

Parameters:case – A case returned by enumerate. For this unit, case will first be an empty password, then the password supplied as an argument, then the contents of a provided dictionary file.
Returns:None. This function should not return any data.