Python Forum
Telnet to switch from jump start server(linux) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: Telnet to switch from jump start server(linux) (/thread-15250.html)



Telnet to switch from jump start server(linux) - searching1 - Jan-09-2019

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