From 2d337f1645d8e10ca842a5e2c575676a50a10a88 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Mon, 14 Aug 2023 08:44:57 -0400 Subject: [PATCH 01/10] Change info colors for smbv1 and signing to bold for readability --- cme/protocols/ldap.py | 4 ++-- cme/protocols/rdp.py | 2 +- cme/protocols/smb.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cme/protocols/ldap.py b/cme/protocols/ldap.py index 49471a6a..7a1236e6 100644 --- a/cme/protocols/ldap.py +++ b/cme/protocols/ldap.py @@ -305,8 +305,8 @@ class ldap(connection): else: self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP" self.logger.extra["port"] = "445" if not self.no_ntlm else "389" - signing = colored(f"signing:{self.signing}", 'green') if self.signing else colored(f"signing:{self.signing}", 'red') - smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow') if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue') + signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") self.logger.extra["protocol"] = "LDAP" # self.logger.display(self.endpoint) diff --git a/cme/protocols/rdp.py b/cme/protocols/rdp.py index 9f8c4555..9f334183 100644 --- a/cme/protocols/rdp.py +++ b/cme/protocols/rdp.py @@ -103,7 +103,7 @@ class rdp(connection): ) def print_host_info(self): - nla = colored(f"nla:{self.nla}", 'blue') if self.nla else colored(f"nla:{self.nla}", 'yellow') + nla = colored(f"nla:{self.nla}", 'blue', attrs=['bold']) if self.nla else colored(f"nla:{self.nla}", 'yellow', attrs=['bold']) if self.domain is None: self.logger.display("Probably old, doesn't not support HYBRID or HYBRID_EX" f" ({nla})") else: diff --git a/cme/protocols/smb.py b/cme/protocols/smb.py index 79338923..fdc6b37e 100755 --- a/cme/protocols/smb.py +++ b/cme/protocols/smb.py @@ -361,8 +361,8 @@ class smb(connection): return True def print_host_info(self): - signing = colored(f"signing:{self.signing}", 'green') if self.signing else colored(f"signing:{self.signing}", 'red') - smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow') if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue') + signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") if self.args.laps: return self.laps_search(self.args.username, self.args.password, self.args.hash, self.domain) From eb3342284a5731296522ae407db35f2f2f36ac9c Mon Sep 17 00:00:00 2001 From: mpgn Date: Tue, 15 Aug 2023 10:28:42 -0400 Subject: [PATCH 02/10] change colors --- cme/protocols/ldap.py | 4 ++-- cme/protocols/rdp.py | 2 +- cme/protocols/smb.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cme/protocols/ldap.py b/cme/protocols/ldap.py index 7a1236e6..c2a4ad8f 100644 --- a/cme/protocols/ldap.py +++ b/cme/protocols/ldap.py @@ -305,8 +305,8 @@ class ldap(connection): else: self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP" self.logger.extra["port"] = "445" if not self.no_ntlm else "389" - signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) - smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue', attrs=['bold']) + signing = colored(f"signing:{self.signing}", 'cyan', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") self.logger.extra["protocol"] = "LDAP" # self.logger.display(self.endpoint) diff --git a/cme/protocols/rdp.py b/cme/protocols/rdp.py index 9f334183..6882b25f 100644 --- a/cme/protocols/rdp.py +++ b/cme/protocols/rdp.py @@ -103,7 +103,7 @@ class rdp(connection): ) def print_host_info(self): - nla = colored(f"nla:{self.nla}", 'blue', attrs=['bold']) if self.nla else colored(f"nla:{self.nla}", 'yellow', attrs=['bold']) + nla = colored(f"nla:{self.nla}", 'blue', attrs=['bold']) if self.nla else colored(f"nla:{self.nla}", 'cyan', attrs=['bold']) if self.domain is None: self.logger.display("Probably old, doesn't not support HYBRID or HYBRID_EX" f" ({nla})") else: diff --git a/cme/protocols/smb.py b/cme/protocols/smb.py index fdc6b37e..948abd35 100755 --- a/cme/protocols/smb.py +++ b/cme/protocols/smb.py @@ -361,8 +361,8 @@ class smb(connection): return True def print_host_info(self): - signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) - smbv1 = colored(f"SMBv1:{self.smbv1}", 'yellow', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'blue', attrs=['bold']) + signing = colored(f"signing:{self.signing}", 'cyan', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") if self.args.laps: return self.laps_search(self.args.username, self.args.password, self.args.hash, self.domain) From 67c99b87dd4a6b80cdea36abe44435849ecad8d3 Mon Sep 17 00:00:00 2001 From: mpgn Date: Tue, 15 Aug 2023 10:30:47 -0400 Subject: [PATCH 03/10] change colors --- cme/protocols/ldap.py | 2 +- cme/protocols/smb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cme/protocols/ldap.py b/cme/protocols/ldap.py index c2a4ad8f..ced84945 100644 --- a/cme/protocols/ldap.py +++ b/cme/protocols/ldap.py @@ -305,7 +305,7 @@ class ldap(connection): else: self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP" self.logger.extra["port"] = "445" if not self.no_ntlm else "389" - signing = colored(f"signing:{self.signing}", 'cyan', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") self.logger.extra["protocol"] = "LDAP" diff --git a/cme/protocols/smb.py b/cme/protocols/smb.py index 948abd35..a0f17b2b 100755 --- a/cme/protocols/smb.py +++ b/cme/protocols/smb.py @@ -361,7 +361,7 @@ class smb(connection): return True def print_host_info(self): - signing = colored(f"signing:{self.signing}", 'cyan', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) + signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") if self.args.laps: From a9f95d193096eecd14661f4e721b2e110275c4c7 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 15 Aug 2023 21:59:16 +0200 Subject: [PATCH 04/10] Add CME config option for color coding --- cme/config.py | 5 +++++ cme/protocols/ldap.py | 6 +++--- cme/protocols/smb.py | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cme/config.py b/cme/config.py index eb168faf..304b84f4 100644 --- a/cme/config.py +++ b/cme/config.py @@ -17,6 +17,11 @@ ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) pwned_label = cme_config.get("CME", "pwn3d_label", fallback="Pwn3d!") audit_mode = cme_config.get("CME", "audit_mode", fallback=False) reveal_chars_of_pwd = int(cme_config.get("CME", "reveal_chars_of_pwd", fallback=0)) +host_info_colors = cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]) + +if len(host_info_colors) != 4: + host_info_colors = ["green", "red", "yellow", "cyan"] + # this should probably be put somewhere else, but if it's in the config helpers, there is a circular import def process_secret(text): diff --git a/cme/protocols/ldap.py b/cme/protocols/ldap.py index ced84945..c7826a0f 100644 --- a/cme/protocols/ldap.py +++ b/cme/protocols/ldap.py @@ -32,7 +32,7 @@ from impacket.ldap import ldapasn1 as ldapasn1_impacket from impacket.smb import SMB_DIALECT from impacket.smbconnection import SMBConnection, SessionError -from cme.config import process_secret +from cme.config import process_secret, host_info_colors from cme.connection import * from cme.helpers.bloodhound import add_user_bh from cme.logger import CMEAdapter, cme_logger @@ -305,8 +305,8 @@ class ldap(connection): else: self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP" self.logger.extra["port"] = "445" if not self.no_ntlm else "389" - signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) - smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) + signing = colored(f"signing:{self.signing}", host_info_colors[0], attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", host_info_colors[1], attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", host_info_colors[2], attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", host_info_colors[3], attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") self.logger.extra["protocol"] = "LDAP" # self.logger.display(self.endpoint) diff --git a/cme/protocols/smb.py b/cme/protocols/smb.py index a0f17b2b..0e689669 100755 --- a/cme/protocols/smb.py +++ b/cme/protocols/smb.py @@ -27,7 +27,7 @@ from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED from impacket.krb5.kerberosv5 import SessionKeyDecryptionError from impacket.krb5.types import KerberosException -from cme.config import process_secret +from cme.config import process_secret, host_info_colors from cme.connection import * from cme.logger import CMEAdapter from cme.protocols.smb.firefox import FirefoxTriage @@ -361,8 +361,8 @@ class smb(connection): return True def print_host_info(self): - signing = colored(f"signing:{self.signing}", 'green', attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", 'red', attrs=['bold']) - smbv1 = colored(f"SMBv1:{self.smbv1}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', attrs=['bold']) + signing = colored(f"signing:{self.signing}", host_info_colors[0], attrs=['bold']) if self.signing else colored(f"signing:{self.signing}", host_info_colors[1], attrs=['bold']) + smbv1 = colored(f"SMBv1:{self.smbv1}", host_info_colors[2], attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", host_info_colors[3], attrs=['bold']) self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.domain}) ({signing}) ({smbv1})") if self.args.laps: return self.laps_search(self.args.username, self.args.password, self.args.hash, self.domain) From 345f2d09fc7d0e48122963345fec58ec6c5bde24 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:07:01 +0200 Subject: [PATCH 05/10] Update config file if options are missing --- cme/config.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cme/config.py b/cme/config.py index 304b84f4..07a95a5d 100644 --- a/cme/config.py +++ b/cme/config.py @@ -1,8 +1,13 @@ # coding=utf-8 import os +from os.path import join as path_join import configparser -from cme.paths import CME_PATH +from cme.paths import CME_PATH, DATA_PATH from cme.first_run import first_run_setup +from cme.logger import cme_logger + +cme_default_config = configparser.ConfigParser() +cme_default_config.read(path_join(DATA_PATH, "cme.conf")) cme_config = configparser.ConfigParser() cme_config.read(os.path.join(CME_PATH, "cme.conf")) @@ -11,6 +16,12 @@ if "CME" not in cme_config.sections(): first_run_setup() cme_config.read(os.path.join(CME_PATH, "cme.conf")) +for option in cme_default_config.options("CME"): + if option not in cme_config.options("CME"): + cme_logger.info("Adding missing option '{}' to cme.conf".format(option)) + cme_config.set("CME", option, cme_default_config.get("CME", option)) + +# These options have to exist in the default config file!! cme_workspace = cme_config.get("CME", "workspace", fallback="default") config_log = cme_config.getboolean("CME", "log_mode", fallback=False) ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) From c97d81697d299fd93f0e4e468834916418a02621 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:10:45 +0200 Subject: [PATCH 06/10] Sort config options --- cme/config.py | 4 ++-- cme/data/cme.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cme/config.py b/cme/config.py index 07a95a5d..2695aa02 100644 --- a/cme/config.py +++ b/cme/config.py @@ -23,11 +23,11 @@ for option in cme_default_config.options("CME"): # These options have to exist in the default config file!! cme_workspace = cme_config.get("CME", "workspace", fallback="default") -config_log = cme_config.getboolean("CME", "log_mode", fallback=False) -ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) pwned_label = cme_config.get("CME", "pwn3d_label", fallback="Pwn3d!") audit_mode = cme_config.get("CME", "audit_mode", fallback=False) reveal_chars_of_pwd = int(cme_config.get("CME", "reveal_chars_of_pwd", fallback=0)) +config_log = cme_config.getboolean("CME", "log_mode", fallback=False) +ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) host_info_colors = cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]) if len(host_info_colors) != 4: diff --git a/cme/data/cme.conf b/cme/data/cme.conf index 264f0b72..4f6c21a0 100755 --- a/cme/data/cme.conf +++ b/cme/data/cme.conf @@ -2,7 +2,7 @@ workspace = default last_used_db = smb pwn3d_label = Pwn3d! -audit_mode = +audit_mode = False reveal_chars_of_pwd = 0 log_mode = False ignore_opsec = True From a030bbcfdf08292156ce66a562aeb84975c5b864 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:32:54 +0200 Subject: [PATCH 07/10] Make sure host_info_colors option is read properly from config --- cme/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cme/config.py b/cme/config.py index 2695aa02..52dcaa4e 100644 --- a/cme/config.py +++ b/cme/config.py @@ -5,6 +5,7 @@ import configparser from cme.paths import CME_PATH, DATA_PATH from cme.first_run import first_run_setup from cme.logger import cme_logger +import ast cme_default_config = configparser.ConfigParser() cme_default_config.read(path_join(DATA_PATH, "cme.conf")) @@ -28,10 +29,12 @@ audit_mode = cme_config.get("CME", "audit_mode", fallback=False) reveal_chars_of_pwd = int(cme_config.get("CME", "reveal_chars_of_pwd", fallback=0)) config_log = cme_config.getboolean("CME", "log_mode", fallback=False) ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) -host_info_colors = cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]) +host_info_colors = ast.literal_eval(cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"])) + if len(host_info_colors) != 4: - host_info_colors = ["green", "red", "yellow", "cyan"] + cme_logger.error("Config option host_info_colors must have 4 values! Using default values.") + host_info_colors = cme_default_config.get("CME", "host_info_colors") # this should probably be put somewhere else, but if it's in the config helpers, there is a circular import From ec42e4b3ef2c08a11c5fba3da2d2b84eae64d4a2 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:52:19 +0200 Subject: [PATCH 08/10] Add config options from default config if it is missing in the users config file --- cme/config.py | 15 ++++++++++----- cme/data/cme.conf | 1 + cme/first_run.py | 16 ---------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/cme/config.py b/cme/config.py index 52dcaa4e..691eab87 100644 --- a/cme/config.py +++ b/cme/config.py @@ -17,12 +17,17 @@ if "CME" not in cme_config.sections(): first_run_setup() cme_config.read(os.path.join(CME_PATH, "cme.conf")) -for option in cme_default_config.options("CME"): - if option not in cme_config.options("CME"): - cme_logger.info("Adding missing option '{}' to cme.conf".format(option)) - cme_config.set("CME", option, cme_default_config.get("CME", option)) +# Check if there are any missing options in the config file +for section in cme_default_config.sections(): + for option in cme_default_config.options(section): + if not cme_config.has_option(section, option): + cme_logger.display(f"Adding missing option '{option}' in config section '{section}' to cme.conf") + cme_config.set(section, option, cme_default_config.get(section, option)) -# These options have to exist in the default config file!! + with open(path_join(CME_PATH, "cme.conf"), "w") as config_file: + cme_config.write(config_file) + +#!!! THESE OPTIONS HAVE TO EXIST IN THE DEFAULT CONFIG FILE !!! cme_workspace = cme_config.get("CME", "workspace", fallback="default") pwned_label = cme_config.get("CME", "pwn3d_label", fallback="Pwn3d!") audit_mode = cme_config.get("CME", "audit_mode", fallback=False) diff --git a/cme/data/cme.conf b/cme/data/cme.conf index 4f6c21a0..7b75ff83 100755 --- a/cme/data/cme.conf +++ b/cme/data/cme.conf @@ -6,6 +6,7 @@ audit_mode = False reveal_chars_of_pwd = 0 log_mode = False ignore_opsec = True +host_info_colors = ["green", "red", "yellow", "cyan"] [BloodHound] bh_enabled = False diff --git a/cme/first_run.py b/cme/first_run.py index 3a6267a7..a55f0746 100755 --- a/cme/first_run.py +++ b/cme/first_run.py @@ -5,8 +5,6 @@ from os import mkdir from os.path import exists from os.path import join as path_join import shutil -import configparser -from configparser import NoSectionError, NoOptionError from cme.paths import CME_PATH, CONFIG_PATH, TMP_PATH, DATA_PATH from cme.cmedb import initialize_db from cme.logger import cme_logger @@ -40,20 +38,6 @@ def first_run_setup(logger=cme_logger): logger.display("Copying default configuration file") default_path = path_join(DATA_PATH, "cme.conf") shutil.copy(default_path, CME_PATH) - else: - # This is just a quick check to make sure the config file isn't the old 3.x format - try: - config = configparser.ConfigParser() - config.read(CONFIG_PATH) - config.get("CME", "workspace") - config.get("CME", "pwn3d_label") - config.get("CME", "audit_mode") - config.get("BloodHound", "bh_enabled") - config.get("CME", "log_mode") - except (NoSectionError, NoOptionError): - logger.display("Old configuration file detected, replacing with new version") - default_path = path_join(DATA_PATH, "cme.conf") - shutil.copy(default_path, CME_PATH) # if not exists(CERT_PATH): # logger.display('Generating SSL certificate') From e0570df5538648248356067bdd53d92c4edf8eb3 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:14:09 +0200 Subject: [PATCH 09/10] Implement color coding from config for nla --- cme/protocols/rdp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cme/protocols/rdp.py b/cme/protocols/rdp.py index 6882b25f..8f7ed278 100644 --- a/cme/protocols/rdp.py +++ b/cme/protocols/rdp.py @@ -12,6 +12,7 @@ from impacket.krb5.ccache import CCache from cme.connection import * from cme.helpers.bloodhound import add_user_bh from cme.logger import CMEAdapter +from cme.config import host_info_colors from aardwolf.connection import RDPConnection from aardwolf.commons.queuedata.constants import VIDEO_FORMAT @@ -103,7 +104,7 @@ class rdp(connection): ) def print_host_info(self): - nla = colored(f"nla:{self.nla}", 'blue', attrs=['bold']) if self.nla else colored(f"nla:{self.nla}", 'cyan', attrs=['bold']) + nla = colored(f"nla:{self.nla}", host_info_colors[3], attrs=['bold']) if self.nla else colored(f"nla:{self.nla}", host_info_colors[2], attrs=['bold']) if self.domain is None: self.logger.display("Probably old, doesn't not support HYBRID or HYBRID_EX" f" ({nla})") else: From b497f34b21707e6d3dae92ded133d2b850b44fa5 Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:45:00 +0200 Subject: [PATCH 10/10] Correct import and default audit_mode config --- cme/config.py | 4 ++-- cme/data/cme.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cme/config.py b/cme/config.py index 691eab87..a5ac6805 100644 --- a/cme/config.py +++ b/cme/config.py @@ -5,7 +5,7 @@ import configparser from cme.paths import CME_PATH, DATA_PATH from cme.first_run import first_run_setup from cme.logger import cme_logger -import ast +from ast import literal_eval cme_default_config = configparser.ConfigParser() cme_default_config.read(path_join(DATA_PATH, "cme.conf")) @@ -34,7 +34,7 @@ audit_mode = cme_config.get("CME", "audit_mode", fallback=False) reveal_chars_of_pwd = int(cme_config.get("CME", "reveal_chars_of_pwd", fallback=0)) config_log = cme_config.getboolean("CME", "log_mode", fallback=False) ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False) -host_info_colors = ast.literal_eval(cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"])) +host_info_colors = literal_eval(cme_config.get("CME", "host_info_colors", fallback=["green", "red", "yellow", "cyan"])) if len(host_info_colors) != 4: diff --git a/cme/data/cme.conf b/cme/data/cme.conf index 7b75ff83..5c4062a0 100755 --- a/cme/data/cme.conf +++ b/cme/data/cme.conf @@ -2,7 +2,7 @@ workspace = default last_used_db = smb pwn3d_label = Pwn3d! -audit_mode = False +audit_mode = reveal_chars_of_pwd = 0 log_mode = False ignore_opsec = True