示例#1
0
文件: remote.py 项目: codebang/dms-sa
 def execute(self, options, subargs):
     if not options.accountId:
         self.parser.error("accountId is required")
     account = Account.get(options.accountId)
     if account is None or len(account) == 0:
         print "account does not exist in db"
         return
     try:
         task = (
             DBNode()
             .session.query(DMSToolTask)
             .filter(DMSToolTask.accountId == options.accountId)
             .filter(DMSToolTask.task_name == "tcpdump")
             .one()
         )
     except NoResultFound, e:
         map = {}
         map["firewall"] = options.firewall_interface
         map["ipsecvpn"] = options.ipsecvpn_interface
         map["dns"] = options.dns_interface
         map["vrouter"] = options.vrouter_interface
         TcpdumpExecutor(account).start(map)
         task = DMSToolTask()
         task.task_name = "tcpdump"
         task.accountId = options.accountId
         DBNode().session.add(task)
         DBNode().session.commit()
示例#2
0
文件: remote.py 项目: codebang/dms-sa
 def execute(self, options, subargs):
     if not options.accountId:
         self.parser.error("accountId is required")
     account = Account.get(options.accountId)
     if account is None or len(account) == 0:
         print "account does not exist in db"
         return
     print TcpdumpExecutor(account).status()
示例#3
0
文件: show.py 项目: codebang/dms-sa
 def execute(self,options,subargs):
     if not options.accountId:
         self.parser.error("accountid is required...")
     account = Account.get(options.accountId)
     if account!= None:
         print_tabulate(Node,account[0].listnodes())
     else:
         print "Error: accountid is not exisit"
示例#4
0
文件: show.py 项目: notlcry/dms_sa_hy
 def execute(self, options, subargs):
     if not options.accountId:
         self.parser.error("accountid is required...")
     account = Account.get(options.accountId)
     if account != None:
         print_tabulate(Node, account[0].listnodes())
     else:
         print "Error: accountid is not exisit"
示例#5
0
 def execute(self, options, subargs):
     if not options.accountId:
         self.parser.error("accountId is required")
     account = Account.get(options.accountId)
     if account is None or len(account) == 0:
         print "account does not exist in db"
         return
     print TcpdumpExecutor(account).status()
示例#6
0
    def execute(self,options,subargs):
        if not options.accountId:
            self.parser.error("accountId is required")
        account = Account.get(options.accountId)
        if account is None or len(account) == 0:
            print "account does not exist in db"
            return

        try:
            task = DBNode().session.query(DMSToolTask).filter(DMSToolTask.accountId == options.accountId).filter(DMSToolTask.task_name== "tcpdump").one()
        except NoResultFound,e:
            print "Info: no tcpdump task need to stop on this accounit"
示例#7
0
    def execute(self, options, subargs):
        if not options.accountId:
            self.parser.error("accountId is required")
        account = Account.get(options.accountId)
        if account is None or len(account) == 0:
            print "account does not exist in db"
            return

        try:
            task = DBNode().session.query(DMSToolTask).filter(
                DMSToolTask.accountId == options.accountId).filter(
                    DMSToolTask.task_name == "tcpdump").one()
        except NoResultFound, e:
            print "Info: no tcpdump task need to stop on this accounit"
示例#8
0
 def execute(self, options, subargs):
     if not options.accountId:
         self.parser.error("accountId is required")
     account = Account.get(options.accountId)
     if account is None or len(account) == 0:
         print "account does not exist in db"
         return
     try:
         task = DBNode().session.query(DMSToolTask).filter(
             DMSToolTask.accountId == options.accountId).filter(
                 DMSToolTask.task_name == "tcpdump").one()
     except NoResultFound, e:
         map = {}
         map["firewall"] = options.firewall_interface
         map["ipsecvpn"] = options.ipsecvpn_interface
         map["dns"] = options.dns_interface
         map["vrouter"] = options.vrouter_interface
         TcpdumpExecutor(account).start(map)
         task = DMSToolTask()
         task.task_name = "tcpdump"
         task.accountId = options.accountId
         DBNode().session.add(task)
         DBNode().session.commit()
示例#9
0
文件: show.py 项目: codebang/dms-sa
 def execute(self,options,subargs):
     if options.accountId == "all":
         print_tabulate(Account,Account.list())
     else:
         print_tabulate(Account,Account.get(options.accountId))
示例#10
0
文件: show.py 项目: notlcry/dms_sa_hy
 def execute(self, options, subargs):
     if options.accountId == "all":
         print_tabulate(Account, Account.list())
     else:
         print_tabulate(Account, Account.get(options.accountId))