I need to write a script that will contact a remote system using TELNET with VT52/1xx/2xx/320 and perform some operations. I am familiar with TELNET but it appears that it won't work for my purposes.
TIA,
Frank M. Ramaekers Jr. Systems Programmer MCP, MCP+I, MCSE & RHCE American Income Life Insurance Co. Phone: (254)761-6649 1200 Wooded Acres Dr. Fax: (254)741-5777 Waco, Texas 76710
_____________________________________________________ This message contains information which is privileged and confidential and is solely for the use of the intended recipient. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution, or use of the contents of this message is strictly prohibited. If you have received this in error, please destroy it immediately and notify us at PrivacyAct@ailife.com.
Frank M. Ramaekers wrote:
I need to write a script that will contact a remote system using TELNET with VT52/1xx/2xx/320 and perform some operations. I am familiar with TELNET but it appears that it won't work for my purposes.
Check out expect. I had to do this with some data radios as of late, and it worked out pretty well.
http://linux.die.net/man/1/expect
Regards, Max
Okay, here are some things I found out.
1) Linux telnet is sending a 0x0a for the enter key 2) Windows putty program is sending a 0x0d for the enter key 3) Windows telnet is sending a 0x0d0a for the enter key 4) The device (don't ask) I'm working with doesn't like the Linux telnet
I've tried coding the expect with 0x0d:
expect ">" send "m2" send "\x0d"
But, this doesn't seem to work.
I'm starting to run out of ideas.
Frank M. Ramaekers Jr. Systems Programmer MCP, MCP+I, MCSE & RHCE American Income Life Insurance Co. Phone: (254)761-6649 1200 Wooded Acres Dr. Fax: (254)741-5777 Waco, Texas 76710 -----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Max Hetrick Sent: Wednesday, November 12, 2008 2:59 PM To: CentOS mailing list Subject: Re: [CentOS] Terminal emulation scripting
Frank M. Ramaekers wrote:
I need to write a script that will contact a remote system using
TELNET
with VT52/1xx/2xx/320 and perform some operations. I am familiar with TELNET but it appears that it won't work for my purposes.
Check out expect. I had to do this with some data radios as of late, and
it worked out pretty well.
http://linux.die.net/man/1/expect
Regards, Max
_______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
_____________________________________________________ This message contains information which is privileged and confidential and is solely for the use of the intended recipient. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution, or use of the contents of this message is strictly prohibited. If you have received this in error, please destroy it immediately and notify us at PrivacyAct@ailife.com.
I'm not near a computer to dig this but there should be a way to tell unix telnet to change the chars it sends for enter, read telnet(1).
Hope this helps.
--Amos
On 11/15/08, Frank M. Ramaekers FRamaekers@ailife.com wrote:
Okay, here are some things I found out.
- Linux telnet is sending a 0x0a for the enter key
- Windows putty program is sending a 0x0d for the enter key
- Windows telnet is sending a 0x0d0a for the enter key
- The device (don't ask) I'm working with doesn't like the Linux
telnet
I've tried coding the expect with 0x0d:
expect ">" send "m2" send "\x0d"
But, this doesn't seem to work.
I'm starting to run out of ideas.
Frank M. Ramaekers Jr. Systems Programmer MCP, MCP+I, MCSE & RHCE American Income Life Insurance Co. Phone: (254)761-6649 1200 Wooded Acres Dr. Fax: (254)741-5777 Waco, Texas 76710
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Max Hetrick Sent: Wednesday, November 12, 2008 2:59 PM To: CentOS mailing list Subject: Re: [CentOS] Terminal emulation scripting
Frank M. Ramaekers wrote:
I need to write a script that will contact a remote system using
TELNET
with VT52/1xx/2xx/320 and perform some operations. I am familiar with TELNET but it appears that it won't work for my purposes.
Check out expect. I had to do this with some data radios as of late, and
it worked out pretty well.
http://linux.die.net/man/1/expect
Regards, Max
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
This message contains information which is privileged and confidential and is solely for the use of the intended recipient. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution, or use of the contents of this message is strictly prohibited. If you have received this in error, please destroy it immediately and notify us at PrivacyAct@ailife.com. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Sat, Nov 15, 2008 at 11:31:23AM +1100, Amos Shapira wrote:
I'm not near a computer to dig this but there should be a way to tell unix telnet to change the chars it sends for enter, read telnet(1).
Hope this helps.
--Amos
On 11/15/08, Frank M. Ramaekers FRamaekers@ailife.com wrote:
Okay, here are some things I found out.
- Linux telnet is sending a 0x0a for the enter key
- Windows putty program is sending a 0x0d for the enter key
- Windows telnet is sending a 0x0d0a for the enter key
- The device (don't ask) I'm working with doesn't like the Linux
telnet
I've tried coding the expect with 0x0d:
expect ">" send "m2" send "\x0d"
But, this doesn't seem to work.
I'm starting to run out of ideas.
Look at stty and the notion of cooked and raw tty devices. This is a key difference with Windows and Linux text.
Windows newline is a pair Unix/Linux is 0A LF ā\nā (new line) and the line discipline expands the LF to the pair.
In you may need to set the tty to raw and then revisit your expect code. Also terminals can be wonkey. If you set $TERM to dumb you may find some sanity in your problem.
You can telnet to local host and run "od -xc" to see what you are sending. By tinkering with the stty setting you can toggle from cooked to half cooked to raw...
I think your problem is that your expectation is that the tty will reflect what you type and not cook it to something else.
In the early days of Unix the ability to have a newline not advance the roll permits overstrikes and simple line edits. LF need not imply a CR+LF pair. Thus this can be printed with seven bytes on the old yellow roll. a b c d
If you tinker with stty settings in scripts or programs save the initial settings so you can restore them. See stty's man page for stuff like: [-]icrnl translate carriage return to newline ... [-]igncr ignore carriage return ... [-]inlcr translate newline to carriage return ... etc.
On Wed, Nov 12, 2008, Frank M. Ramaekers wrote:
I need to write a script that will contact a remote system using TELNET with VT52/1xx/2xx/320 and perform some operations. I am familiar with TELNET but it appears that it won't work for my purposes.
Many systems don't allow telnet connections because of security issues, using ssh (secure shell instead).
If the issue is dealing with programs on the remote system that are designed for interactive use, this is difficult to do reliably although not impossible using ``expect'' via some kind of remote connection, ssh, telnet, etc. (I was running Tandy's Xenix accounting applications on a Tandy Model 16 24 years ago using nothing but input and output redirection from the shell, but that was not pretty :-).
The ``expect'' program is built around ``tcl'' scripting, but there are perl and python modules that work reasonably well too.
Bill