Telnet to switch from jump start server(linux)

时间:2019-01-09 22:06:46

标签: python python-3.x python-2.7 network-programming paramiko

I just want to ask if anyone here has script or idea what method, library etc should. My target is to SHH first from my workstation to Linux jumpstart server then from jumpstart server I'll access the network devices like switch and routers to execute some show commands.

PYTHON SCRIPT ----SSH---> Jumpstart server(ubuntu) ----Telnet---> Network Devices (Cisco)

import base64, time, sys
import paramiko, getpass, telnetlib

#ENTER Password
##pword = getpass.getpass('Password: ')

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='xxxxx', username='xxxxx', password='xxxxx')
stdin, stdout, stderr = client.exec_command('pwd')

for line in stdout:
    print('Teton: ' + line.strip('\n'))
    client.close()

I'm now able to access the jumpstart server from my PC, the next thing is just to telnet from the jumpstart server?

Thank you

0 个答案:

没有答案