fix: use os.path.join for rule paths in quick_crack and loopback_attack

Replace 6 instances of f-string slash concatenation with os.path.join()
for building rule file paths, consistent with get_rule_path() in main.py.
This commit is contained in:
Justin Bollinger
2026-03-16 14:32:14 -04:00
parent 79cb290c11
commit 6df74f7969
+10 -10
View File
@@ -138,7 +138,7 @@ def quick_crack(ctx: Any) -> None:
return
if "98" in rule_choice:
for rule in rule_files:
selected_hcatRules.append(f"-r {ctx.rulesDirectory}/{rule}")
selected_hcatRules.append(f"-r {os.path.join(ctx.rulesDirectory, rule)}")
elif "0" in rule_choice:
selected_hcatRules = [""]
else:
@@ -148,15 +148,15 @@ def quick_crack(ctx: Any) -> None:
choices = choice.split("+")
for rule in choices:
try:
combined_choice = f"{combined_choice} -r {ctx.rulesDirectory}/{rule_files[int(rule) - 1]}"
rule_path = os.path.join(ctx.rulesDirectory, rule_files[int(rule) - 1])
combined_choice = f"{combined_choice} -r {rule_path}"
except Exception:
continue
selected_hcatRules.append(combined_choice)
else:
try:
selected_hcatRules.append(
f"-r {ctx.rulesDirectory}/{rule_files[int(choice) - 1]}"
)
rule_path = os.path.join(ctx.rulesDirectory, rule_files[int(choice) - 1])
selected_hcatRules.append(f"-r {rule_path}")
except IndexError:
continue
@@ -229,7 +229,7 @@ def loopback_attack(ctx: Any) -> None:
return
if "98" in rule_choice:
for rule in rule_files:
selected_hcatRules.append(f"-r {ctx.rulesDirectory}/{rule}")
selected_hcatRules.append(f"-r {os.path.join(ctx.rulesDirectory, rule)}")
elif "0" in rule_choice:
selected_hcatRules = [""]
else:
@@ -239,15 +239,15 @@ def loopback_attack(ctx: Any) -> None:
choices = choice.split("+")
for rule in choices:
try:
combined_choice = f"{combined_choice} -r {ctx.rulesDirectory}/{rule_files[int(rule) - 1]}"
rule_path = os.path.join(ctx.rulesDirectory, rule_files[int(rule) - 1])
combined_choice = f"{combined_choice} -r {rule_path}"
except Exception:
continue
selected_hcatRules.append(combined_choice)
else:
try:
selected_hcatRules.append(
f"-r {ctx.rulesDirectory}/{rule_files[int(choice) - 1]}"
)
rule_path = os.path.join(ctx.rulesDirectory, rule_files[int(choice) - 1])
selected_hcatRules.append(f"-r {rule_path}")
except IndexError:
continue