Python Forum
Telnet to switch from jump start server(linux)
Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Telnet to switch from jump start server(linux)
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Paramiko Server -- Exception (server): Error reading SSH protocol banner ujlain 3 4,649 Jul-24-2023, 06:52 AM
Last Post: Gribouillis
  telnet from ssh tunnel oldfart 3 7,194 Jul-17-2020, 02:28 PM
Last Post: noobami99
  telnet to a device under tacacs management kang18 0 1,582 Jun-05-2020, 06:11 AM
Last Post: kang18
  3.6 telnet eyler 3 11,317 Jun-28-2019, 05:22 AM
Last Post: Khanhamid90
  Any suggestion on python library to use for both ssh and telnet? lord_mani 4 3,793 Jun-25-2019, 04:07 PM
Last Post: gb74razor
  telnet question jacklee26 2 2,521 Mar-30-2019, 06:45 AM
Last Post: jacklee26
  Retrieve output from telnet command Networker 1 4,134 Mar-12-2019, 01:36 PM
Last Post: searching1
  Aggregate multiple telnet connections Jibeji 1 4,283 Mar-02-2018, 07:21 PM
Last Post: mpd
  Multithread telnet not working Parallel anna 7 7,509 Feb-05-2018, 01:17 PM
Last Post: anna
  Python telnet script for IP list mangesh 1 61,680 Jun-26-2017, 11:12 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020