ait-testbed/attackmate

after pydantic update webport variable accepts only strings

Closed this issue · 1 comments

The WEBPORT variable should accept integers.

Observed Behavior:
Playbook with

vars:
  NMAP: /usr/bin/nmap
  TARGET: localhost
  WEBPORT: 8000

leads to

Traceback (most recent call last):
  File "/usr/local/share/attackmate/venv/bin/attackmate", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/share/attackmate/venv/lib/python3.12/site-packages/attackmate/__main__.py", line 163, in main
    hacky = AttackMate(parse_playbook(args.playbook, logger), parse_config(args.config, logger))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/share/attackmate/venv/lib/python3.12/site-packages/attackmate/__main__.py", line 127, in parse_playbook
    playbook_object = Playbook.parse_obj(pb_yaml)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/share/attackmate/venv/lib/python3.12/site-packages/pydantic/main.py", line 1118, in parse_obj
    return cls.model_validate(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/share/attackmate/venv/lib/python3.12/site-packages/pydantic/main.py", line 551, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Playbook
vars.WEBPORT
  Input should be a valid string [type=string_type, input_value=8000, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type

Desired Behavior:
Webport variable should accept integers, ideally both integers and strings.

Fix Documentation accordingly.

Now it is possible to use str or int. Fixed in PR #79