BC-SECURITY / Empire

Empire is a post-exploitation and adversary emulation framework that is used to aid Red Teams and Penetration Testers.
https://bc-security.gitbook.io/empire-wiki/
BSD 3-Clause "New" or "Revised" License
4.06k stars 564 forks source link

[BUG] TypeError: constr() got an unexpected keyword argument 'regex' #705

Closed Atreus75 closed 7 months ago

Atreus75 commented 7 months ago

Is there an existing issue for this?

Empire Version

5.7.3

Python Version

Python 3

Operating System

Kali Linux 2023.3

Database

MySQL

Current Behavior

After installing all the Python libraries and dependencies, i try to run ./ps-empire server , but i always receive this error message (PS: My linux user is atreus_75 and i'm trying to run Empire on /home/atreus_75/Ferramentas/Post/Empire/):

└─$ ./ps-empire server

/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pydantic/_internal/_config.py:318: UserWarning: Valid config keys have changed in V2: * 'orm_mode' has been renamed to 'from_attributes' warnings.warn(message, UserWarning) Traceback (most recent call last): File "/home/atreus_75/Ferramentas/Post/Empire/empire.py", line 11, in import empire.server.server as server File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/server.py", line 14, in from empire.server.common import empire File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/common/empire.py", line 21, in from empire.server.core.agent_service import AgentService File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/core/agent_service.py", line 9, in from empire.server.api.v2.agent.agent_dto import AggregateBucket File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/api/v2/agent/agent_dto.py", line 8, in from empire.server.api.v2.tag.tag_dto import Tag, domain_to_dto_tag File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/api/v2/tag/tag_dto.py", line 9, in TagStr = constr(regex=r"^[^:]+:[^:]+$") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: constr() got an unexpected keyword argument 'regex'

Expected Behavior

I've expected a normal initialization of the Empire Server.

Steps To Reproduce

  1. First, i run git clone https://github.com/BC-SECURITY/Empire.git.
  2. After it, i run Empire/Setup/install.shand everything seems to run normally.
  3. Finally, i run Empire/ps-empire server and i get the error message. I replicated this behavior twice.

Anything else?

image image image image This behavior is not limited to my personal user, as root still receives that error message. I've already updated pydantic with both root and my personal user.

vinnybod commented 7 months ago

This error is coming from pydantic v2, but the poetry lockfile is using pydantic 1.10. So somewhere along the line your virtual env got the wrong version. I'm not sure how that's possible with the install script since it runs poetry install

You mentioned >I've already updated pydantic with both root and my personal user. So maybe you manually installed the offending pydantic in your venv

You could rm -rf your virtual env and try poetry install again.

Atreus75 commented 7 months ago

Thank you for your support, friend.