For registering script console commands
Regular example:
def test_command(args):
print(args)
commandes.register('test_command', test_command)
Decorator example:
@commands.command('test_command')
def test_command(args):
print(args)
set_quote_replacement(replacement)Set the default quote_replacement value. Passing quote_replacement= to
register() or @command() overrides this.
See register() for more information.
Arguments:
replacement: Quote replacement string
register(name, callback, quote_replacement=None)Register a command
Regarding the quote_replacement argument: Cobalt Strike's Script Console
uses double quotes to enclose arguments with spaces in them. There's no way
to escape double quotes within those quotes though. Set quote_replacement
to a string and PyCobalt will replace it with " in each argument.
Arguments:
name: Name of commandcallback: Callback for commandquote_replacement: Replace this string with " in each argument.
command(name, quote_replacement=None)Decorator for command registration