コード例 #1
0
ファイル: EmpDaemon.py プロジェクト: dstar4138/emp_draft
 def __cmd_help(self, *args):
     if len(args) <= 0: #cant be less but i like being complete.
         cmds = CommandList(self.get_commands())
         return cmds.getHelpDict()
     else:
         if args[0] == "all":
             cmds = CommandList(self.get_commands())
             all = {"Daemon":cmds.getHelpDict()}
             try:
                 logging.debug("trying to get other commands.")
                 alist = self.aman.getAllPlugins()
                 logging.debug("got %d attachments",len(alist))
                 for attach in self.aman.getAllPlugins():
                     logging.debug("getting commands from plug: %s", attach.module)
                     cmds = CommandList(attach.plugin_object.get_commands())
                     all[attach.name] = cmds.getHelpDict()
             except Exception as e:logging.exception(e)
             return all
         else: # its a plug or an alert id.
             if args[0] == "daemon":
                 cmds = CommandList(self.get_commands())
                 return cmds.getHelpDict()
             elif self.registry.isRegistered(args[0]):
                 attach = self.aman.getAttachment(args[0])
                 if attach is None: raise Exception("Could not get target's commands.")
                 cmds = CommandList(attach.get_commands())
                 return cmds.getHelpDict()
             else:
                 raise Exception("Invalid target")
コード例 #2
0
ファイル: EmpDaemon.py プロジェクト: dstar4138/emp_draft
 def __cmd_cmds(self, *args):
     cmdlst = CommandList(self.get_commands())
     return cmdlst.getNames()