Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.8.4 into main #713

Merged
merged 4 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.8.4] - 2023-12-22

### Fixed

- Fixed `Path` variables in EmpireConfig not properly expanding `~` (@Vinnybod)

## [5.8.3] - 2023-12-15

### Fixed
Expand Down Expand Up @@ -704,7 +710,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated shellcoderdi to newest version (@Cx01N)
- Added a Nim launcher (@Hubbl3)

[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.8.3...HEAD
[Unreleased]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.8.4...HEAD

[5.8.4]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.8.3...v5.8.4

[5.8.3]: https://github.com/BC-SECURITY/Empire-Sponsors/compare/v5.8.2...v5.8.3

Expand Down
2 changes: 1 addition & 1 deletion empire/server/common/empire.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

from . import agents, credentials, listeners, stagers

VERSION = "5.8.3 BC Security Fork"
VERSION = "5.8.4 BC Security Fork"

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion empire/server/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


class EmpireBaseModel(BaseModel):
@classmethod
@field_validator("*")
@classmethod
def set_path(cls, v):
if isinstance(v, Path):
return v.expanduser().resolve()
Expand Down
7 changes: 7 additions & 0 deletions empire/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import pytest
import yaml
from starlette.testclient import TestClient

from empire.client.src.utils.data_util import get_random_string
Expand Down Expand Up @@ -442,3 +443,9 @@ def client_config_dict():
config_dict = yaml.safe_load(f)

yield config_dict


def load_test_config():
with open(SERVER_CONFIG_LOC) as f:
loaded = yaml.safe_load(f)
return loaded
12 changes: 12 additions & 0 deletions empire/test/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pathlib import Path

from empire.server.core.config import EmpireConfig
from empire.test.conftest import load_test_config


def test_config_resolves_path():
server_config_dict = load_test_config()
server_config_dict["directories"]["downloads"] = "~/.empire/server/downloads"
empire_config = EmpireConfig(server_config_dict)
assert isinstance(empire_config.directories.downloads, Path)
assert not str(empire_config.directories.downloads).startswith("~")
18 changes: 5 additions & 13 deletions empire/test/test_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from pathlib import Path
from unittest.mock import MagicMock

import yaml

from empire.test.conftest import SERVER_CONFIG_LOC
from empire.test.conftest import SERVER_CONFIG_LOC, load_test_config


def test_simple_log_format(monkeypatch):
Expand Down Expand Up @@ -43,7 +41,7 @@ def test_extended_log_format(monkeypatch):
from empire.server.server import setup_logging
from empire.server.utils.log_util import LOG_FORMAT, ColorFormatter

test_config = _load_test_config()
test_config = load_test_config()
test_config["logging"]["simple_console"] = False
modified_config = EmpireConfig(test_config)
monkeypatch.setattr("empire.server.server.empire_config", modified_config)
Expand All @@ -70,7 +68,7 @@ def test_log_level_by_config(monkeypatch):
from empire.server.core.config import EmpireConfig
from empire.server.server import setup_logging

test_config = _load_test_config()
test_config = load_test_config()
test_config["logging"]["level"] = "WaRNiNG" # case insensitive
modified_config = EmpireConfig(test_config)
monkeypatch.setattr("empire.server.server.empire_config", modified_config)
Expand Down Expand Up @@ -101,7 +99,7 @@ def test_log_level_by_arg():
from empire.server.server import setup_logging

config_mock = MagicMock()
test_config = _load_test_config()
test_config = load_test_config()
test_config["logging"]["level"] = "WaRNiNG" # Should be overwritten by arg
config_mock.yaml = test_config

Expand All @@ -124,17 +122,11 @@ def test_log_level_by_debug_arg():
from empire.server.server import setup_logging

config_mock = MagicMock()
test_config = _load_test_config()
test_config = load_test_config()
test_config["logging"]["level"] = "WaRNiNG" # Should be overwritten by arg
config_mock.yaml = test_config

args = arguments.parent_parser.parse_args() # Force reparse of args between runs
setup_logging(args)

assert logging.getLogger().level == logging.DEBUG


def _load_test_config():
with open(SERVER_CONFIG_LOC) as f:
loaded = yaml.safe_load(f)
return loaded
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "empire-bc-security-fork"
version = "5.8.3"
version = "5.8.4"
description = ""
authors = ["BC Security <[email protected]>"]
readme = "README.md"
Expand Down
Loading