Hello,
I need to write a python script for performing telnet between two windows machine, that is Host and Client. After doing Telnet Successfully I need to run some application on other machine and there in that application I need to give commands via my script aswell after giving command I need to receive feedback in my script.
I am Good in C/C++ but novice in Python, So Please tell me how to Begin. Any good link or good book would help.
Below is the code which I found on several websites but its not working.
Thanks
#!usr/bin/python
import getpass
import sys
import telnetlib
HOST = "192.168.10.15"
PORT=22
TIMEOUT=10
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
print tn.read_all()