473,788 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using telnetlib

Hi All,
I am trying to use the telnetlib module.

Manually when I do
telnet 172.31.128.244
I get:

Login: (I type root)
Password: ( I type Password)
And it enters to the Telnet Session:
[root]#

Now, I am trying to use telnetlib module
>>import telnetlib
tn = telnetlib.Telne t("172.31.128.2 44")
tn.read_until ("Login: ")
'\r\nLogin: '
>>tn.write("roo t\n:")
tn.read_unti l("Password: ")
Cursor stays over here forever!. Delays are not working. I tried all
the codes mentioned n c.l.p, but i have not yet been able to get
telnetlib working.
Any suggestions as how to troubleshoot and resolve this issue?

Thanks,
Senthil

Feb 28 '07 #1
3 3250
Phoe6 wrote:
>>>import telnetlib
tn = telnetlib.Telne t("172.31.128.2 44")
tn.read_unti l("Login: ")
'\r\nLogin: '
>>>tn.write("ro ot\n:")
^^^

With telnet, use "\r\n" for line breaks at *all* times to be on the
safe side. Also, what's the ":" at the end for?
Regards,
Björn

--
BOFH excuse #88:

Boss' kid fucked up the machine

Feb 28 '07 #2
On Feb 28, 4:15 pm, Bjoern Schliessmann <usenet-
mail-0306.20.chr0n.. .@spamgourmet.c omwrote:
Phoe6 wrote:
>>import telnetlib
tn = telnetlib.Telne t("172.31.128.2 44")
tn.read_until ("Login: ")
'\r\nLogin: '
>>tn.write("roo t\n:")

^^^

With telnet, use "\r\n" for line breaks at *all* times to be on the
safe side.
Thanks a lot, Björn.
That did help and solved my problem. ":" after \n was just a typo.

--
Senthil

Feb 28 '07 #3
Phoe6 wrote:
That did help and solved my problem. ":" after \n was just a typo.
Thanks for feedback :) I've had a similar problem once, too.

Regards,
Björn

--
BOFH excuse #166:

/pub/lunch

Feb 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4808
by: walala | last post by:
Dear all, I recently came across a Python program which used "telnetlib" to automate things in the several unix machines in our local networks; I attached the script as follows; I wonder if it is possible to have the equivlent libary for "rlogin" in Python? Because our local networks support only SSH or RLOGIN. This script used Telnet so it could not be used in our local networks;
1
2087
by: ÕÅÖ¾Ã÷ | last post by:
code below cannt work import getpass import sys import telnetlib import select tn = telnetlib.Telnet() print tn.open("162.105.31.222",23)
1
1901
by: Stephen Ferg | last post by:
I'm trying to use telnetlib to run a Java program on a remote server. I'm having strange problems, and I'm wondering if anyone might be able to help. I have two UNIX servers, A and Z. I have an application named LATTE that runs on server A. When the user starts LATTE, the user can choose to create a telnet connection back to A, or to Z. Then LATTE uses the telnet connection to run a Java program (run it several times, on different...
3
4983
by: Svha | last post by:
Greetings I'd like to do some tweaks on a telnet session as I have no control over the server side what so ever. However I cannot correctly negotiate a telnet connection to the server. I've gone back to basics on the code for simplicity here; Linux 2.6 : Python 2.3.4
2
2415
by: Nitin Chaumal | last post by:
I sarched the existing threads but didnt find an answer to this. I am writing simple script which uses telentlib to open a session with a unix machine and run "tail -f logfile.txt" on one of the logfiles. import telnetlib HOST = "192.X.X.X" user = "myname" password = "mypass"
3
12482
by: Wojciech Halicki-Piszko | last post by:
How to know if connection is active after telnetlib.Telnet.open(host,port)?
4
10520
by: vercingetorix52 | last post by:
I'm trying to use a python script to access an embedded computer running linux and connected via a crossover ethernet cable using the following script... ....and I realize the username and password is not realistic... I'm still in "proof of concept" stage here :) ######################### import telnetlib
20
3963
by: valpa | last post by:
I'm a net admin for about 20 unix servers, and I need to frequently telnet on to them and configure them. It is a tiring job to open a xterm and telnet, username, password to each server. Can I do it automatically by python? After that, there have 20 xterm consoles opened and telneted to their corresponding servers. Then I could start to type command in these xterms. Any suggestion appreciate. Much thanks.
1
8388
by: dudds | last post by:
Hi Guys, I just started learning Python a couple of days ago and to put some of what I learnt into practice. As such I thought I might try and write a simple program (based on examples I had seen) that would allow me to log into a Cisco router, enter configuration mode, change an interface description and also grab a snapshot of the running configuration. So far I've managed to be able to log in and change the interface configuration....
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10121
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.