Python script for using clogin to logon to network devices

Thread Starter

KMK

Joined Feb 11, 2010
69
I have compiled the below program for run clogin script to login to router.

however im unable to pass the input from the command variable to the clogin string.

the string value on the command will contain spaces, eg : show version

any help appreciated
==========================
import os
import subprocess

hostname = raw_input("Enterlink name: ")
command = raw_input ("Enter command: ")


cmd = "clogin -c '{command}' " + hostname

subprocess.call(cmd, shell=True)

===================================

the output is as follows :

==========
XXX#
XXX#terminal length 0
XXX#terminal width 132
XXX#{command}
% Bad IP address or host name
% Unknown command or computer name, or unable to find computer address
XXX#exit
Connection closed by foreign host.
 
Top