Python Forum

Full Version: Telnet to switch from jump start server(linux)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

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