katana.units.crypto.caesar — Caesar Cipher with 26 Letters

Perform a Caesar cipher on the target.

You can read more about the Caesar cipher here: https://en.wikipedia.org/wiki/Caesar_cipher

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.caesar.Unit(manager: katana.manager.Manager, target: katana.target.Target)

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

BLOCKED_GROUPS = ['crypto']

This unit does not recurse into other Crypto units because that might spiral into a disaster.

GROUPS = ['crypto', 'caesar']

These are “tags” for a unit. Considering it is a Crypto unit, “crypto” is included, as well as the name of the unit, “caesar”.

PRIORITY = 40

Priority works with 0 being the highest priority, and 100 being the lowest priority. 50 is the default priorty. This unit has a somewhat higher priority due to how common this is within CTFs.

RECURSE_SELF = False

This unit should not recurse into itself. That could spiral in to an infinite loop.

enumerate() → Generator[Any, None, None]

Yield unit cases. The end-user can either supply a shift value as an argument, or it will bruteforce all the possible shift values within in the English alphabet (i.e. try the numbers 1-25).

Returns:Generator of target cases, in this case an integer for the shift value (provided, or range 1-25).
evaluate(case: Any) → None

Perform the caesar cipher on the target.

Parameters:case – A case returned by enumerate, in this case, the shift value to use for the Caesar Cipher operation.
Returns:None. This function should not return any data.
katana.units.crypto.caesar.shift_char(c: str, shift: int, alphabet: str) → str

This is a convenience function that will perform the most primitive operation of the Caesar Cipher – shifting one character by a given amount within the given alphabet.