Skip to content

Commit e819827

Browse files
authored
Merge pull request #18 from prompt-security/sort_and_improve_attacks_list_display
Sort listed attack types and improve visual display of the description (word wrap it)
2 parents 35e6964 + 6726cf8 commit e819827

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ps_fuzz/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from .interactive_mode import interactive_shell
1515
from .prompt_injection_fuzzer import run_fuzzer
1616
from .logo import print_logo
17+
from .util import wrap_text
1718

1819
# Initialize colorama
1920
colorama.init()
@@ -43,8 +44,8 @@ def main():
4344
attack_config = AttackConfig(FakeChatClient(), 1)
4445
tests = instantiate_tests(client_config, attack_config)
4546
print("Available attacks:")
46-
for test_name, test_description in [(cls.test_name, cls.test_description) for cls in tests]:
47-
print(f" {BRIGHT}{test_name}{RESET}: {test_description}")
47+
for test_name, test_description in sorted([(cls.test_name, cls.test_description) for cls in tests]):
48+
print(f"{BRIGHT}{test_name}{RESET}:\n{wrap_text(test_description)}")
4849
sys.exit(0)
4950

5051
# Setup debug level (default 1)

0 commit comments

Comments
 (0)