473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

telnet read_sb_data

Hello!

Task: Connecting to a unix server and getting the directory list .
OS: XP

Connecting to the server via telnet is no problem.
I also want to get the directory list. I know by using read_all I can get
all the output (starting from the login up to the end).
1. What I look for is the option to get only certain parts of the output. It
seems to me that the command "read_sb_data" can do this. The documentation
says, that I will get the data between the SB/SE pair. But I don't know how
to invoke the SE command in Unix. Even I don't know the SE command.

2. I thing when this command work I can also get the directory size for each
directory in root (using df and du Unix commands)
Using os.stat(path) doesen't work on XP, I am always getting a 0 return
(i.e. (16895, 0L, 3, 1, 0, 0, 0L, 315529200, 315529200, 315529200))

Please be so kind and post a little bit of a code.

Thanks a lot!
Arne
Apr 13 '06 #1
2 4904
Thank you for your reply.

Yes I have read the documentation. But I am not sure what is the SB/SE
suboption. Is this a suboption on the remote machine or for Python.
Maybe you could be so kind and explain it to me with a little code example.

Thany you very much!
Arne

"Dennis Lee Bieber" <wl*****@ix.netcom.com> schrieb im Newsbeitrag
news:2k********************************@4ax.com...
On Thu, 13 Apr 2006 23:45:06 +0200, "Arne" <ar***********@gmx.de>
declaimed the following in comp.lang.python:
1. What I look for is the option to get only certain parts of the output.
It
seems to me that the command "read_sb_data" can do this. The
documentation
says, that I will get the data between the SB/SE pair. But I don't know
how
to invoke the SE command in Unix. Even I don't know the SE command.

Did you read the full documentation? "SB/SE" are "suboption
begin/end", and there is also mention of a "callback". The ONLY other
entry in telnetlib that mentions callbacks is the one for negotiating
telnet options.

read_sb_data( )
Return the data collected between a SB/SE pair (suboption begin/end).
The callback should access these data when it was invoked with a SE
command. This method never blocks.

set_option_negotiation_callback( callback)
Each time a telnet option is read on the input flow, this callback (if
set) is called with the following parameters : callback(telnet socket,
command (DO/DONT/WILL/WONT), option). No other action is done afterwards
by telnetlib.

Using os.stat(path) doesen't work on XP, I am always getting a 0 return


No surprise -- os.stat can only access files mounted on the local
machine. Telnet is remote /terminal/ connection. You'll have to behave
like a terminal... How would you, as a user at a terminal, know when any
command had finished? Probably by seeing a console prompt...

Try

read_until( expected[, timeout])
Read until a given string, expected, is encountered or until timeout
seconds have passed.
When no match is found, return whatever is available instead, possibly
the empty string. Raise EOFError if the connection is closed and no
cooked data is available.

You'll have to know what the prompt string will be...
--
================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Apr 14 '06 #2
On 2006-04-14, Arne <ar***********@gmx.de> wrote:
Yes I have read the documentation. But I am not sure what is
the SB/SE suboption. Is this a suboption on the remote machine
or for Python. Maybe you could be so kind and explain it to me
with a little code example.


SB/SE are used for telnet protocol option negotation for telnet
protocol options that are more complicated that just on/off.
It has absolutely nothing to do with what you're trying to do.

For more info, read the RFC on the telnet protocol option
negotiation:

http://www.faqs.org/rfcs/rfc855.html

Here's another decent article:

http://www.scit.wlv.ac.uk/~jphb/comms/telnet.html

--
Grant Edwards grante Yow! .. I
at feel... JUGULAR...
visi.com
Apr 14 '06 #3

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

Similar topics

2
by: Dan | last post by:
I'm writing a simplistic telnet client in VB6 and I've run into a small snag. The program has a textbox to write in the string to be sent using ..SendData and has another textbox that displays...
3
by: Yannick Turgeon | last post by:
Hello all, I'm currently trying to pass commands to a telnet session and get the texte generated (stdin + stdout) by the session. The problem I get is that the Telnet.read_until() function...
4
by: Donnal Walter | last post by:
On Windows XP I am able to connect to a remote telnet server from the command prompt using: telnet nnn.nnn.nnn.nnn 23 where nnn.nnn.nnn.nnn is the IP address of the host. But using telnetlib,...
2
by: john brown | last post by:
I'm telnetting into a router. Apart from the fact I can't seem to view the output when iniciating the session, I can't match one of the expressions using Net::Telnet. I can telnet into the router...
0
by: CJ | last post by:
Can someone look at the code below and tell me whats going on? Here is the problem. I can successfully telnet one of our routers and successfully put in a command in the while statement, but...
2
by: eight02645999 | last post by:
hi i am using a telnet session to simulate an authentication mechanism USER = "user" PASSWORD = "password" try: telnet = telnetlib.Telnet(HOST) telnet.set_debuglevel(5)...
2
by: thilandeneth | last post by:
i need to do telnet via a web server please give me a idia to initiate the project following requirements are needed 1 Create web based custom telnet client to communicate with remote...
6
by: sherrygomindes | last post by:
Hi I have written a perl script using the Telnet module. I need to remotely login in from one windows XP machine to another XP machine. But i get errors which i can't figure out the reason....
17
by: ravimath | last post by:
Dear all, I have written following script to loin to router bu it is showing error. #!c:\Perl\bin; use strict; use warnings; my $hostname = 'REMOVED FOR YOUR PROTECTION'; my $password =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.