[docs]classTuoniAlias:""" A class that provides data and functionality for a command alias. Attributes: alias_id (GUID): The unique identifier (GUID) for the alias. name (str): The name of the alias. qualifiedName (str): The qualified name of the alias. fullyQualifiedName (str): The fully qualified name of the alias. description (str): A description of the alias. fixedConfiguration (dict): The fixed configuration settings for the base command. pluginVersion (str): The version of the associated plugin. baseTemplate (dict): The base template used for the alias. """def__init__(self,conf,c2):""" Constructor for the alias class. Args: conf (dict): Data from the server. c2 (TuoniC2): The related server object that manages communication. """self._load_conf(conf)self.c2=c2def_load_conf(self,conf):self.alias_id=conf["id"]self.name=conf["name"]self.qualifiedName=conf["qualifiedName"]self.fullyQualifiedName=conf["fullyQualifiedName"]self.description=conf["description"]self.fixedConfiguration=conf["fixedConfiguration"]self.pluginVersion=conf["pluginVersion"]self.baseTemplate=conf["baseTemplate"]
[docs]defreload(self):""" Reload the alias data from the C2 server. """ifself.alias_idisNone:raiseExceptionTuoniDeleted("")data=self.c2.request_get("/api/v1/command-alias/%s"%self.alias_id)self._load_conf(data)
[docs]defdelete(self):""" Delete the alias. """ifself.alias_idisNone:raiseExceptionTuoniDeleted("")data=self.c2.request_delete("/api/v1/command-alias/%s"%self.alias_id)self._load_conf(data)