diff --git a/hate_crack/attacks.py b/hate_crack/attacks.py index 9a26d32..5038726 100644 --- a/hate_crack/attacks.py +++ b/hate_crack/attacks.py @@ -400,6 +400,16 @@ def prince_attack(ctx: Any) -> None: ctx.hcatPrince(ctx.hcatHashType, ctx.hcatHashFile) +def pcfg_attack(ctx: Any) -> None: + _notify.prompt_notify_for_attack("PCFG") + ctx.hcatPCFG(ctx.hcatHashType, ctx.hcatHashFile) + + +def prince_ling_attack(ctx: Any) -> None: + _notify.prompt_notify_for_attack("PRINCE-LING") + ctx.hcatPrinceLing(ctx.hcatHashType, ctx.hcatHashFile) + + def yolo_combination(ctx: Any) -> None: _notify.prompt_notify_for_attack("YOLO Combination") ctx.hcatYoloCombination(ctx.hcatHashType, ctx.hcatHashFile) diff --git a/tests/test_attacks_pcfg.py b/tests/test_attacks_pcfg.py new file mode 100644 index 0000000..c489105 --- /dev/null +++ b/tests/test_attacks_pcfg.py @@ -0,0 +1,22 @@ +from unittest.mock import MagicMock + +from hate_crack.attacks import pcfg_attack, prince_ling_attack + + +def _make_ctx(hash_type: str = "1000", hash_file: str = "/tmp/hashes.txt") -> MagicMock: + ctx = MagicMock() + ctx.hcatHashType = hash_type + ctx.hcatHashFile = hash_file + return ctx + + +def test_pcfg_attack_invokes_hcatPCFG(): + ctx = _make_ctx() + pcfg_attack(ctx) + ctx.hcatPCFG.assert_called_once_with("1000", "/tmp/hashes.txt") + + +def test_prince_ling_attack_invokes_hcatPrinceLing(): + ctx = _make_ctx() + prince_ling_attack(ctx) + ctx.hcatPrinceLing.assert_called_once_with("1000", "/tmp/hashes.txt")