Add CME config option for color coding

main
Alex 2023-08-15 21:59:16 +02:00
parent 67c99b87dd
commit a9f95d1930
3 changed files with 11 additions and 6 deletions

View File

@ -17,6 +17,11 @@ ignore_opsec = cme_config.getboolean("CME", "ignore_opsec", fallback=False)
pwned_label = cme_config.get("CME", "pwn3d_label", fallback="Pwn3d!") pwned_label = cme_config.get("CME", "pwn3d_label", fallback="Pwn3d!")
audit_mode = cme_config.get("CME", "audit_mode", fallback=False) 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)) 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 # this should probably be put somewhere else, but if it's in the config helpers, there is a circular import
def process_secret(text): def process_secret(text):

View File

@ -32,7 +32,7 @@ from impacket.ldap import ldapasn1 as ldapasn1_impacket
from impacket.smb import SMB_DIALECT from impacket.smb import SMB_DIALECT
from impacket.smbconnection import SMBConnection, SessionError 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.connection import *
from cme.helpers.bloodhound import add_user_bh from cme.helpers.bloodhound import add_user_bh
from cme.logger import CMEAdapter, cme_logger from cme.logger import CMEAdapter, cme_logger
@ -305,8 +305,8 @@ class ldap(connection):
else: else:
self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP" self.logger.extra["protocol"] = "SMB" if not self.no_ntlm else "LDAP"
self.logger.extra["port"] = "445" if not self.no_ntlm else "389" 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']) 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}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', 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.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.extra["protocol"] = "LDAP"
# self.logger.display(self.endpoint) # self.logger.display(self.endpoint)

View File

@ -27,7 +27,7 @@ from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED
from impacket.krb5.kerberosv5 import SessionKeyDecryptionError from impacket.krb5.kerberosv5 import SessionKeyDecryptionError
from impacket.krb5.types import KerberosException 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.connection import *
from cme.logger import CMEAdapter from cme.logger import CMEAdapter
from cme.protocols.smb.firefox import FirefoxTriage from cme.protocols.smb.firefox import FirefoxTriage
@ -361,8 +361,8 @@ class smb(connection):
return True return True
def print_host_info(self): 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']) 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}", 'magenta', attrs=['bold']) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", 'cyan', 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.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: if self.args.laps:
return self.laps_search(self.args.username, self.args.password, self.args.hash, self.domain) return self.laps_search(self.args.username, self.args.password, self.args.hash, self.domain)