katana.units.crypto.rot47 — ROT47 Cipher

ROT47 decoder

The gist of this code is ripped from https://rot47.net/_py/rot47.txt.

This unit inherits from the katana.unit.NotEnglishAndPrintableUnit class, as we can expect the data to still be printable characters (letters, numbers and punctuation) but not readable English. It also inherits from the katana.units.crypto.CryptoUnit class to ensure it is not a viable URL or potentially useful file.

class katana.units.crypto.rot47.Unit(manager: katana.manager.Manager, target: katana.target.Target)

Bases: katana.unit.NotEnglishAndPrintableUnit, katana.units.crypto.CryptoUnit

BLOCKED_GROUPS = ['crypto']

These are tags for groups to not recurse into. Recursing into other crypto units would be silly.

GROUPS = ['crypto', 'rot47']

These are “tags” for a unit. Considering it is a Crypto unit, “crypto” is included, and the name of the unit, “rot47”.

PRIORITY = 45

Priority works with 0 being the highest priority, and 100 being the lowest priority. 50 is the default priorty. This unit has a slightly higher priority.

RECURSE_SELF = False

Do not recurse into self

do_rot47(s)

Shamelessly stolen from https://rot47.net/_py/rot47.txt

This function takes a string and performs the ROT47 operation on it.

Parameters:s – The byte string to perform the ROT47 operation on.
evaluate(case: Any) → None

Evaluate the target.

Parameters:case – A case returned by enumerate. For this unit, the enumerate function is not used.
Returns:None