telnet from linux pc to windows pc using python script

i am trying to telnet a windows pc from linux using python script(pexpect).when i try to connect this error pop's up The operation completed successfully...Login Failed below is my python script.

import pexpect,time,sys
from ftplib import FTP
def tel(ipadrr,login,password):

        try:    
                global telconn
                telconn = pexpect.spawn(ipadrr)
                telconn.logfile = open("/tmp/telnetlog", "a") 

                print "connected to telnet"
                print
        except:
                print "telconnnet connection refused"
                print 
                sys.exit() 

        try:
                time.sleep(15)
                #telconn.expect(": ")
                print "username"
                telconn.sendline(login + '\r')
                telconn.expect(":")
                print "password"
                telconn.sendline(password + '\r')
                #telconn.sendline("\r")
                #time.sleep(30)
                telconn.expect(">") 
                print "Authentication Sucesss"
                print
        except:
                print "Authentication Failure"
                print        
                sys.exit()

Answers


I think your password is not entering via script. Try with,

telconn.sendline(password + '\n')

@vish..its already answered the same question..plz verfiy the same

import pexpect
import time,sys
telconn = pexpect.spawn('telnet 192.168.0.105')
time.sleep(20)
telconn.logfile = sys.stdout
telconn.expect(":")
time.sleep(20)
telconn.send("user" + "\r")
telconn.expect(":")
telconn.send("user@123" + "\r")
telconn.send("\r\n")
time.sleep(20)
telconn.expect(">")

Need Your Help

jQuery Applications Pattern / Architecture

jquery

im looking best practices for jQuery application architecture.

Android - Custom image as app background

android background themes background-image

I am attempting to us a png file that I have imported into the drawable-mdpi folder as my background. however, just setting it as the background through main.xml results in the process stopping

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.