Esempio n. 1
0
 def aireos_press_any_key(self, transport, cmd):
     while True:
         key = wait_key()
         break
     print('\x08' * (len(self.get_prompt(transport)) + 1), end='')
     self.command_handler(transport, key)
     return True
Esempio n. 2
0
    def run(self):
        """ Runs the mock device on standard input/output """
        self.add_port(0, self.states[0])
        self.add_transport(sys.stdout, 0)

        while True:
            self.state_handler(sys.stdout)

            prompt = self.get_prompt(sys.stdout)

            print(prompt, end="", flush=True)

            cmd = ""
            if self.method_handler(sys.stdout, cmd):
                continue
            else:
                try:
                    while True:
                        key = wait_key()
                        if key in ['\x04']:
                            raise EOFError()
                        if key == '\n':
                            break
                        else:
                            cmd += key

                except EOFError:
                    break

                self.command_handler(sys.stdout, cmd)
Esempio n. 3
0
    def version_more(self, transport, cmd):
        # prompt = self.get_prompt(transport)
        # print(prompt, end="", flush=True)

        while True:
            key = wait_key()
            if key in ['\x04', ' ', '\r', '\n', 'q']:
                break
        if key == ' ':
            self.set_state(0, 'asa_enable_more')
            print('\x08 \x08' * 16, end='')
            self.command_handler(transport, ' ')
        return True
Esempio n. 4
0
 def press_enter(self, transport, cmd):
     while True:
         key = wait_key()
         if key in ['\x04', ' ', '\r', '\n', 'q']:
             break
     if key == ' ':
         self.set_state(0,'press_enter2')
     elif key == 'q':
         self.set_state(0,'vos_exec')
         print()
     else:
         print()
     return True