FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 11-12-2008, 07:54 PM
"Frank M. Ramaekers"
 
Default Terminal emulation scripting

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.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-12-2008, 07:58 PM
Max Hetrick
 
Default 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
 
Old 11-12-2008, 08:04 PM
Bill Campbell
 
Default Terminal emulation scripting

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
--
INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
Voice: (206) 236-1676 Mercer Island, WA 98040-0820
Fax: (206) 232-9186

Many citizens because of their respect for what only appears to be a law
are cunningly coerced into waiving their rights due to ignorance.
-- U.S. v. Minker
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-14-2008, 09:17 PM
"Frank M. Ramaekers"
 
Default Terminal emulation scripting

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.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-14-2008, 11:31 PM
"Amos Shapira"
 
Default Terminal emulation scripting

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.
>
> 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.
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

--
Sent from Google Mail for mobile | mobile.google.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-20-2008, 08:24 AM
Nifty Cluster Mitch
 
Default Terminal emulation scripting

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.
> >
> > 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.
> >

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 ’
’ (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.




--
T o m M i t c h e l l
Found me a new hat, now what?

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org