def runseccommands(self, command_delay, commandheader=0, done=False): for command in self.getcommands(): self.shell.send(command.strip() + '\r') time.sleep(command_delay) if commandheader: self.addtooutput(['\n' + Format.underline(command), ]) self.addtooutput(self.shell.recv(500000).split('\n')[1:]) if done: self.logout() return self.getoutput()
def rununseccommands(self, command_delay, commandheader=0, done=False): for command in self.commands: self.session.write(command.strip() + '\r') n, m, output = self.session.expect([self.prompt, ], command_delay) time.sleep(command_delay) if commandheader: self.addtooutput(['\n' + Format.underline(command), ]) self.addtooutput(output.split('\n')[1:]) if done: self.logout() return self.getoutput()