Пример #1
0
	def run(self):
		if self.pool: self.pool.acquire()
		if self.tty.login(): 
			if self.tty.os == 1:self.tty.setcommands(self.alucommands)
			elif self.tty.os == 2:self.tty.setcommands(self.xrcommands)
			elif self.tty.os == 3:self.tty.setcommands(self.ioscommands)
			elif self.tty.os == 4:self.tty.setcommands(self.junoscommands)
			elif self.tty.os == 5:self.tty.setcommands(self.asacommands)
			else: return
			output = self.tty.runcommands(self.commanddelay, commandheader=self.commandheader, done=True)
		else:
			print "Could not log in to " + self.host.strip()
			if self.pool: self.pool.release()
			return
		self.tty.setoutput(Format.siftoutput(output, siftout=[self.username, self.password, self.tty.prompt]))
		if self.pool: self.pool.release()
		return
Пример #2
0
	def run(self):
		if self.pool: self.pool.acquire()
		if self.tty.login(): 
			if self.tty.os == 1: commands = self.alucommands
			elif self.tty.os == 2: commands = self.xrcommands
			elif self.tty.os == 3: commands = self.ioscommands
			elif self.tty.os == 4: commands = self.junoscommands
			elif self.tty.os == 5: commands = self.asacommands
			else: return
			self.tty.setcommands(commands[0])
			output = self.tty.runcommands(self.commanddelay, commandheader=self.commandheader) 
			for command in commands[1]:
				if command.commanddelay: self.commanddelay = command.commanddelay
				self.tty.setcommands(Command_parser.generate_commands(command, output))
				output = self.tty.runcommands(self.commanddelay, commandheader=self.commandheader) 
		else:
			print "Could not log in to " + self.host.strip()
			if self.pool: self.pool.release()
			return
		output = self.tty.getoutput()
		self.tty.setoutput(Format.siftoutput(output, siftout=[self.username, self.password, self.tty.prompt]))
		if self.pool: self.pool.release()
		return