Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return True
else:
print("The mod_id can not be None!")
if self.mod["port"] and self.mod["protocol"] !="icmp":
module = self.mod
return True
else:
print("The port can not be None!")
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
else:
# No sub-command was provided, so call help
self.do_help('help')
def do_add(self,args):
"""Adds gophish module to the project """
global module
module = self.mod
return True
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
def do_add(self,args):
"""Adds letsencrypt module to the project """
if not self.mod["domain_name"]:
print("Variable domain_name can not be None")
elif not self.mod["mod_id"]:
print("Variable mod_id can not be None")
else:
global module
module = self.mod
return True
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
if 'type' in i:
x.add_row([idx+1,i["module"] + "/"+ i["type"] , i["id"]])
else:
x.add_row([idx+1,i["module"], i["id"]])
x.align["DESCRITPION"] = "l"
print(x)
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
CMD_CAT_PROJECT = 'Project (type help )'
#Help Menu
cmd2.categorize((do_create,do_new,do_save,do_deploy,do_delete,do_load,do_rename, do_clone), CMD_CAT_PROJECT)
cmd2.categorize((do_usemodule,do_editmodule,do_delmodule), CMD_CAT_MODULE)
cmd2.categorize((do_set,do_info), CMD_CAT_GENERAL)
def addModule(module,campaign):
"""Adds a module to the campaign"""
if module:
campaign.insert(len(campaign),dict(module))
mod = cmd2.ansi.style(module["module"], fg='blue', bg='',bold=True, underline=False)
mod_id = cmd2.ansi.style(module["id"], fg='blue', bg='',bold=True, underline=False)
notification = cmd2.ansi.style("***", fg='red', bg='',bold=True, underline=False)
print(f"""\n{notification} Module {mod} with ID {mod_id} has been added to the campaign {notification}\n""")
def updateModulesIdList(campaign,m):
"""Updates the Modules ID list (main use is the argparse choices)"""
modules_ids = []
for c in campaign:
modules_ids.insert(len(modules_ids),c["id"])
if len(modules_ids) > 0 and m != "edit":
self.do_help('help')
def do_add(self,args):
"""Adds c2 module to the project """
global module
if self.mod["redirector_id"]:
module = self.mod
return True
else:
print("The variable redirector_id can not be None!")
# Command categories
CMD_CAT_GENERAL = 'General'
CMD_CAT_MODULE = 'Module'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
#Create a random String
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
if self.mod["hosts"]:
module = self.mod
return True
else:
print("The hosts can not be None!")
if self.mod["playbook"]:
module = self.mod
return True
else:
print("The playbook can not be None!")
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
provided with 'help --verbose'
This is after a blank line and won't de displayed in the verbose help
"""
self.poutput('SSL Connector Ciphers')
def do_vminfo(self, _):
"""VM Info command"""
self.poutput('VM Info')
# Tag the above command functions under the category Server Information
cmd2.categorize(do_resources, CMD_CAT_SERVER_INFO)
cmd2.categorize(do_status, CMD_CAT_SERVER_INFO)
cmd2.categorize(do_serverinfo, CMD_CAT_SERVER_INFO)
cmd2.categorize(do_thread_dump, CMD_CAT_SERVER_INFO)
cmd2.categorize(do_sslconnectorciphers, CMD_CAT_SERVER_INFO)
cmd2.categorize(do_vminfo, CMD_CAT_SERVER_INFO)
# The following command functions don't have the HELP_CATEGORY attribute set
# and show up in the 'Other' group
def do_config(self, _):
"""Config command"""
self.poutput('Config')
def do_version(self, _):
"""Version command"""
self.poutput(cmd2.__version__)
@cmd2.with_category("Command Management")
def do_disable_commands(self, _):
"""Disable the Application Management commands"""
message_to_print = "{} is not available while {} commands are disabled".format(COMMAND_NAME,
func(self, args)
else:
# No sub-command was provided, so call help
self.do_help('help')
def do_add(self,args):
"""Adds c2 module to the project """
global module
module = self.mod
return True
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))
break
if not aws_flag:
print("No aws module was set!")
else:
module = self.mod
return True
else:
module = self.mod
return True
# Command categories
CMD_CAT_GENERAL = 'General (type help )'
CMD_CAT_MODULE = 'Module (type help )'
cmd2.categorize((do_add,do_set), CMD_CAT_MODULE)
cmd2.categorize(do_info, CMD_CAT_GENERAL)
def randomString(stringLength=6):
"""Generate a random string of fixed length """
letters = string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(stringLength))