def main(): Settings.path = os.getcwd() if args.debug: Settings.debug = True if args.dev: Settings.development = True if args.verbose: Settings.verbose = True if not args.q: utils.banner(db.index_modules()) if args.x: for c in args.x.split(";"): Cli.start(c) Cli.start() elif args.r: try: with open(args.r, "r") as f: cmds = f.readlines() for cmd in cmds: Cli.start(cmd.strip()) Cli.start() except: error("Can't open the specifed resource file!") exit(0) else: Cli.start() #You think it's simple when you look here huh :"D sys.exit()
def main(): Settings.path = os.getcwd() if args.debug: Settings.debug = True if args.dev: Settings.development = True if args.verbose: Settings.verbose = True if not args.q: utils.banner(db.index_modules()) if args.x: for c in args.x.split(";"): Cli.start(c) Cli.start() elif args.r: try: with open(args.r,"r") as f: cmds = f.readlines() for cmd in cmds: Cli.start(cmd.strip()) Cli.start() except: error("Can't open the specifed resource file!") exit(0) else: Cli.start() #You think it's simple when you look here huh :"D sys.exit()
def handle(c): if c == "" or c[0] == "#": return c = c.strip() head = c.lower().split(" ")[0] args = " ".join(c.split(" ")[1:]) try: # Yeah, we don't have switch case in python... if not Cli.general_commands(head, args, module_help): if head in [ "database", "debug", "dev", "verbose", "reload", "refresh", "list", "show", "resource", "os", "use", "exec", "search", "info", "previous", "sessions", "jobs", "eval", "report" ]: exec("Cli.command_{}(args)".format(head)) Settings.update_history(c) else: handler = globals()["command_{}".format(head)] handler(args) Settings.update_history(c) except Exception as e: if Settings.debug: print("Exception -> " + str(e)) print(" Input -> " + str(c)) print("Trackback -> ") traceback.print_exc() error(head + " is not recognized as an internal command !") #To check for the wanted command on typos wanted = utils.grab_wanted(head, module_keywords) if len(wanted) > 0: status("Maybe you meant : " + wanted) status("Type help or ? to learn more..")
def handle(c): if c=="" or c[0]=="#":return c = c.strip() head = c.lower().split(" ")[0] args = " ".join(c.split(" ")[1:]) try: # Yeah, we don't have switch case in python... if not Cli.general_commands(head, args, module_help): if head in ["database","debug","dev","verbose","reload","refresh","list","show","resource","os","use","exec", "search","info","previous","sessions","jobs","eval","report"]: exec("Cli.command_{}(args)".format(head)) Settings.update_history(c) else: handler = globals()["command_{}".format(head)] handler(args) Settings.update_history(c) except Exception as e: if Settings.debug: print("Exception -> "+str(e)) print(" Input -> "+str(c)) print("Trackback -> ") traceback.print_exc() error( head + " is not recognized as an internal command !") #To check for the wanted command on typos wanted = utils.grab_wanted(head,module_keywords) if len(wanted)>0: status( "Maybe you meant : " + wanted ) status( "Type help or ? to learn more..")