mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-28 14:47:22 -07:00
feat(pcfg): add pcfg_attack and prince_ling_attack handlers in attacks.py
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
Reference in New Issue
Block a user