MCPcopy
hub / github.com/Pennyw0rth/NetExec / format

Method format

nxc/logger.py:111–129  ·  view source on GitHub ↗

Format msg for output This is used instead of process() since process() applies to _all_ messages, including debug calls

(self, msg, *args, **kwargs)

Source from the content-addressed store, hash-verified

109 logging.getLogger("pypsrp").setLevel(logging.ERROR)
110
111 def format(self, msg, *args, **kwargs):
112 """Format msg for output
113
114 This is used instead of process() since process() applies to _all_ messages, including debug calls
115 """
116 if self.extra is None:
117 return f"{msg}", kwargs
118
119 if "module_name" in self.extra and len(self.extra["module_name"]) > 11:
120 self.extra["module_name"] = self.extra["module_name"][:8] + "..."
121
122 # If the logger is being called when hooking the 'options' module function
123 if len(self.extra) == 1 and ("module_name" in self.extra):
124 return (f"{colored(self.extra['module_name'], 'cyan', attrs=['bold']):<64} {msg}", kwargs)
125
126 # If the logger is being called from a protocol
127 module_name = colored(self.extra["module_name"], "cyan", attrs=["bold"]) if "module_name" in self.extra else colored(self.extra["protocol"], "blue", attrs=["bold"])
128
129 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)
130
131 @no_debug
132 def display(self, msg, *args, **kwargs):

Callers 15

displayMethod · 0.95
successMethod · 0.95
highlightMethod · 0.95
failMethod · 0.95
wrapperFunction · 0.80
on_admin_loginMethod · 0.80
on_admin_loginMethod · 0.80
mobaxterm_callbackMethod · 0.80
check_registryMethod · 0.80
on_admin_loginMethod · 0.80
on_loginMethod · 0.80
on_admin_loginMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected