Skip to content

Commit 742ed96

Browse files
author
danwroy
committed
Removed print_msg(), convert to display()
1 parent f11e848 commit 742ed96

3 files changed

Lines changed: 7 additions & 15 deletions

File tree

nxc/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def gen_cli_args():
125125
sys.exit(1)
126126

127127
if args.version:
128-
nxc_logger.print_msg(f"{VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
128+
nxc_logger.display(f"{VERSION} - {CODENAME} - {COMMIT} - {DISTANCE}")
129129
sys.exit(1)
130130

131131
# Multiply output_tries by 10 to enable more fine granural control, see exec methods

nxc/database.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def open_config(config_path):
2727
config = configparser.ConfigParser()
2828
config.read(config_path)
2929
except Exception as e:
30-
nxc_logger.print_msg(f"[-] Error reading nxc.conf: {e}")
30+
nxc_logger.display(f"[-] Error reading nxc.conf: {e}")
3131
sys.exit(1)
3232
return config
3333

@@ -40,7 +40,7 @@ def set_workspace(config_path, workspace_name):
4040
config = open_config(config_path)
4141
config.set("nxc", "workspace", workspace_name)
4242
write_configfile(config, config_path)
43-
nxc_logger.print_msg(f"[*] Workspace set to {workspace_name}")
43+
nxc_logger.display(f"[*] Workspace set to {workspace_name}")
4444

4545

4646
def get_db(config):
@@ -63,7 +63,7 @@ def init_protocol_dbs(workspace_name, p_loader=None):
6363
proto_db_path = path_join(WORKSPACE_DIR, workspace_name, f"{protocol}.db")
6464

6565
if not exists(proto_db_path):
66-
nxc_logger.print_msg(
66+
nxc_logger.display(
6767
f"[*] Initializing {protocol.upper()} protocol database"
6868
)
6969
conn = connect(proto_db_path)
@@ -93,17 +93,17 @@ def create_workspace(workspace_name, p_loader=None):
9393
None
9494
"""
9595
if exists(path_join(WORKSPACE_DIR, workspace_name)):
96-
nxc_logger.print_msg(f"[-] Workspace {workspace_name} already exists")
96+
nxc_logger.display(f"[-] Workspace {workspace_name} already exists")
9797
else:
98-
nxc_logger.print_msg(f"[*] Creating {workspace_name} workspace")
98+
nxc_logger.display(f"[*] Creating {workspace_name} workspace")
9999
mkdir(path_join(WORKSPACE_DIR, workspace_name))
100100

101101
init_protocol_dbs(workspace_name, p_loader)
102102

103103

104104
def delete_workspace(workspace_name):
105105
shutil.rmtree(path_join(WORKSPACE_DIR, workspace_name))
106-
nxc_logger.print_msg(f"[*] Workspace {workspace_name} deleted")
106+
nxc_logger.display(f"[*] Workspace {workspace_name} deleted")
107107

108108

109109
def initialize_db():

nxc/logger.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ def format(self, msg, *args, **kwargs):
126126

127127
return (f"{module_name:<24} {self.extra['host']:<15} {self.extra['port']:<6} {self.extra['hostname'] if self.extra['hostname'] else 'NONE':<16} {msg}", kwargs)
128128

129-
@no_debug
130-
def print_msg(self, msg, to_file=False, *args, **kwargs):
131-
"""For print statements, with option to log to file"""
132-
text = Text.from_ansi(msg)
133-
nxc_console.print(text, *args, **kwargs)
134-
if to_file:
135-
self.log_console_to_file(text, *args, **kwargs)
136-
137129
@no_debug
138130
def display(self, msg, *args, **kwargs):
139131
"""Display text to console, formatted for nxc"""

0 commit comments

Comments
 (0)