2023-04-12 02:17:12 +00:00
|
|
|
# coding=utf-8
|
2023-04-06 00:09:07 +00:00
|
|
|
import os
|
|
|
|
import configparser
|
|
|
|
from cme.paths import CME_PATH
|
|
|
|
from cme.first_run import first_run_setup
|
|
|
|
|
|
|
|
cme_config = configparser.ConfigParser()
|
2023-04-12 02:17:12 +00:00
|
|
|
cme_config.read(os.path.join(CME_PATH, "cme.conf"))
|
2023-04-06 00:09:07 +00:00
|
|
|
|
2023-05-27 22:09:37 +00:00
|
|
|
if "CME" not in cme_config.sections():
|
2023-04-12 02:17:12 +00:00
|
|
|
first_run_setup()
|
2023-04-21 11:30:18 +00:00
|
|
|
cme_config.read(os.path.join(CME_PATH, "cme.conf"))
|
2023-04-06 00:09:07 +00:00
|
|
|
|
|
|
|
cme_workspace = cme_config.get("CME", "workspace", fallback="default")
|
2023-04-07 16:32:30 +00:00
|
|
|
config_log = cme_config.getboolean("CME", "log_mode", fallback=False)
|
2023-04-08 18:39:27 +00:00
|
|
|
ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False)
|
2023-04-12 02:17:12 +00:00
|
|
|
pwned_label = cme_config.get("CME", "pwn3d_label")
|
|
|
|
audit_mode = cme_config.get("CME", "audit_mode")
|
2023-08-11 12:00:39 +00:00
|
|
|
reveal_chars_of_pwd = int(cme_config.get("CME", "reveal_chars_of_pwd", fallback=0))
|
2023-04-12 02:17:12 +00:00
|
|
|
|
|
|
|
# this should probably be put somewhere else, but if it's in the config helpers, there is a circular import
|
|
|
|
def process_secret(text):
|
2023-08-10 22:37:05 +00:00
|
|
|
hidden = text[:reveal_chars_of_pwd]
|
|
|
|
return text if not audit_mode else hidden+audit_mode * 8
|