Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
D3vil0p3r committed Dec 1, 2024
1 parent a6c7815 commit ff3bf3a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
31 changes: 21 additions & 10 deletions empire/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,31 @@ def check_config_permission(config_dict: dict, config_type: str):
if config_type == "server":
paths_to_check = {
("api", "cert_path"): config_dict.get("api", {}).get("cert_path"),
("database", "sqlite", "location"): config_dict.get("database", {}).get("sqlite", {}).get("location"),
("starkiller", "directory"): config_dict.get("starkiller", {}).get("directory"),
("database", "sqlite", "location"): config_dict.get("database", {})
.get("sqlite", {})
.get("location"),
("starkiller", "directory"): config_dict.get("starkiller", {}).get(
"directory"
),
("logging", "directory"): config_dict.get("logging", {}).get("directory"),
("debug", "last_task", "file"): config_dict.get("debug", {}).get("last_task", {}).get("file"),
("directories", "downloads"): config_dict.get("directories", {}).get("downloads"),
("debug", "last_task", "file"): config_dict.get("debug", {})
.get("last_task", {})
.get("file"),
("directories", "downloads"): config_dict.get("directories", {}).get(
"downloads"
),
}
config_path = CONFIG_SERVER_PATH # Use the server config path

elif config_type == "client":
paths_to_check = {
("logging", "directory"): config_dict.get("logging", {}).get("directory"),
("directories", "downloads"): config_dict.get("directories", {}).get("downloads"),
("directories", "generated-stagers"): config_dict.get("directories", {}).get(
"generated-stagers"
("directories", "downloads"): config_dict.get("directories", {}).get(
"downloads"
),
("directories", "generated-stagers"): config_dict.get(
"directories", {}
).get("generated-stagers"),
}
config_path = CONFIG_CLIENT_PATH # Use the client config path

Expand Down Expand Up @@ -95,11 +105,12 @@ def check_config_permission(config_dict: dict, config_type: str):

return config_dict


def paths2str(data):
if isinstance(data, dict):
return {key: paths2str(value) for key, value in data.items()}
elif isinstance(data, list):
if isinstance(data, list):
return [paths2str(item) for item in data]
elif isinstance(data, Path):
if isinstance(data, Path):
return str(data)
return data
return data
10 changes: 3 additions & 7 deletions empire/server/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,16 @@ class EmpireConfig(EmpireBaseModel):
database: DatabaseConfig = DatabaseConfig(
sqlite=SQLiteDatabaseConfig(),
mysql=MySQLDatabaseConfig(),
defaults=DatabaseDefaultsConfig()
defaults=DatabaseDefaultsConfig(),
)
plugins: dict[str, dict[str, str]] = {}
directories: DirectoriesConfig = DirectoriesConfig(
downloads=Path("empire/server/downloads"),
module_source=Path("empire/server/modules"),
obfuscated_module_source=Path("empire/server/modules_obfuscated")
)
directories: DirectoriesConfig = DirectoriesConfig()
logging: LoggingConfig = LoggingConfig()
debug: DebugConfig = DebugConfig(last_task=LastTaskConfig())

model_config = ConfigDict(extra="allow")

def __init__(self, config_dict: dict = None):
def __init__(self, config_dict: dict | None = None):
if config_dict is None:
config_dict = {}
if not isinstance(config_dict, dict):
Expand Down
3 changes: 1 addition & 2 deletions empire/server/modules/bof/nanodump.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def generate(
module=module, params=params, obfuscate=obfuscate
)

for name in params:
value = params[name]
for name, value in params.items():
if name == "write":
if value != "":
dump_path = value
Expand Down

0 comments on commit ff3bf3a

Please sign in to comment.