def start(self): """ Routersploit main entry point. Starting interpreter loop. """ print_info(self.banner) printer_queue.join() payloadFile = 0 # add a function # let me test iot automate self.loadAutoScript() while True: try: command, args = self.parse_line(input(self.prompt)) print_status('%s :: %s'%(command,args)) if not command: continue command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") break except KeyboardInterrupt: print_info() finally: printer_queue.join()
def loadAutoScript(self): payloadFile = 'NotThing' try: payloadFile = open("autoTmpScript.rc",'r') #automate file except: print_status('Don\'t have autoTmpScript.rc') if payloadFile != 'NotThing': for mycommand in payloadFile.readlines(): mycommand = mycommand.strip() print_status('%s'%(mycommand)) if not len(mycommand) or mycommand.startswith('#'): continue try: command, args = self.parse_line(mycommand) if not command: continue command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") break except KeyboardInterrupt: print_info() finally: printer_queue.join()
def start(self, argv): """ Routersploit main entry point. Starting interpreter loop. """ printer_queue.join() try: command, args = self.parse_line("use scanners/routers/router_scan") if not command: return -1 command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") return -1 except KeyboardInterrupt: print_info() finally: printer_queue.join() try: command, args = self.parse_line("set target " + argv) if not command: return -1 command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") return -1 except KeyboardInterrupt: print_info() finally: printer_queue.join() try: command, args = self.parse_line("run") if not command: return -1 command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") return -1 except KeyboardInterrupt: print_info() finally: printer_queue.join()
def start(self): """ Routersploit main entry point. Starting interpreter loop. """ print_info(self.banner) printer_queue.join() while True: try: command, args, kwargs = self.parse_line(input(self.prompt)) if not command: continue command_handler = self.get_command_handler(command) command_handler(args, **kwargs) except RoutersploitException as err: print_error(err) except (EOFError, KeyboardInterrupt, SystemExit): print_info() print_error("RouterSploit stopped") break finally: printer_queue.join()
def start(self): """ Routersploit main entry point. Starting interpreter loop. """ print_info(self.banner) printer_queue.join() while True: try: command, args = self.parse_line(input(self.prompt)) if not command: continue command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status("routersploit stopped") break except KeyboardInterrupt: print_info() finally: printer_queue.join()
def start(self): """ exploit main entry point. Starting interpreter loop. """ print_info(self.banner) printer_queue.join() while True: try: command, args = self.parse_line(input(self.prompt)) if not command: continue command_handler = self.get_command_handler(command) command_handler(args) except RoutersploitException as err: print_error(err) except EOFError: print_info() print_status(" stopped") break except KeyboardInterrupt: print_info() finally: printer_queue.join()
def nonInteractive(self, argv): """ Execute specific command and return result without launching the interactive CLI :return: """ module = "" set_opts = [] try: opts, args = getopt.getopt(argv[1:], "hm:s:", ["help=", "module=", "set="]) except getopt.GetoptError: print_info("{} -m <module> -s \"<option> <value>\"".format( argv[0])) printer_queue.join() return for opt, arg in opts: if opt in ("-h", "--help"): print_info("{} -m <module> -s \"<option> <value>\"".format( argv[0])) printer_queue.join() return elif opt in ("-m", "--module"): module = arg elif opt in ("-s", "--set"): set_opts.append(arg) if not len(module): print_error('A module is required when running non-interactively') printer_queue.join() return self.command_use(module) for opt in set_opts: self.command_set(opt) self.command_exploit() # Wait for results if needed printer_queue.join() return