def add_server(self): while "self.flag": print """\033[1;34m 1:增加 2:删除 0:返回\033[0m """ choice = function.choose() choice_list = ['1','2','0'] if choice not in choice_list: print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" self.flag = 0 break if choice == '1': add_server.add_server() if choice == '2': show_server.show_all_server() if choice == '0': self.flag = 0 break
def execute_cmd(self): while "self.flag": print """\033[1;34m 1:在服务器端执行命令 2:在服务器端执行cmd.sh脚本(root权限执行) 0:返回\033[0m """ choice = function.choose() choice_list = ['1','2','0'] if choice not in choice_list: print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" self.flag = 0 break if choice == '1': execute_command.execute() if choice == '2': execute_command.execute_cmd() if choice == '0': self.flag = 0 break
def send_files(self): while "self.flag": print """\033[1;34m 1:向服务器传送文件 2:向服务器传送cmd.sh脚本 0:返回\033[0m """ choice = function.choose() choice_list = ['1','2','0'] if choice not in choice_list: print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" self.flag = 0 break if choice == '1': send_files.send_file() if choice == '2': send_files.send_cmdfile() if choice == '0': self.flag = 0 break
def show_server(self): while "self.flag": print """\033[1;34m 1:查看所有组 2:查看所有服务器 0:返回\033[0m """ choice = function.choose() choice_list = ['1', '2', '0'] if choice not in choice_list: print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" self.flag = 0 break if choice == '1': function.ShowServer().show_all_group() if choice == '2': function.ShowServer().show_all_server() if choice == '0': self.flag = 0 break
from include import function from include import tab from include import headline showmenu=menu.ShowMenu(0) showserver=function.Show_Server() headline #print """ #------------------------------------------------------------------------------------------------------- # THIS IS A BEAUTIFUL WELCOM SCREEN ! #------------------------------------------------------------------------------------------------------- # """ while True: showmenu.main_menu() try: choice = function.choose() choice_list = ['1','2','3','0','exit','quit'] if choice not in choice_list: print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" continue if choice == '1': showmenu.flag = 1 showmenu.send_files() if choice == '2': showmenu.flag = 1 showmenu.execute_cmd() if choice == '3': showmenu.flag = 1 showmenu.show_server() # if choice == '4': # showmenu.flag = 1
from include import tab from include import showmenu from include import readconfig from include import function from include import headline #from include.termcolor import termcolor from include.termcolor import colored #from termcolor import colored showmenus=showmenu.ShowMenu(0) #headline.head_line() while True: showmenus.main_menu() try: choice = function.choose() choice_list = ['1','2','3','0','exit','quit'] if choice not in choice_list: #print "\033[33;40;1m没有这个选项,返回主菜单!\033[0m" info = "没有这个选项,返回主菜单!" print colored(info,color='yellow',on_color=None,attrs=['bold']) continue if choice == '1': pass showmenus.flag = 1 showmenus.send_files() if choice == '2': pass showmenus.flag = 1 showmenus.execute_cmd() if choice == '3':