Simulating a terminal

Simulating a terminal

Post by Patrick Zagie » Sun, 10 Sep 2000 18:02:24



I there on Solaris a program that permit to launch another program making
believe him that he is connected
to a terminal.
As you know a lot of programs works differently when they are connected to a
terminal, specially concerning
the buffering of stdout an stderr.

Thanks in advance


 
 
 

Simulating a terminal

Post by Andrew Su » Sun, 10 Sep 2000 23:44:22


I use a very small (5k source) pty/tty redirector to do
what I think you're requesting.  It's available as:
     ftp://ftp.ora.com/published/oreilly/nutshell/umppp/ptysh2-sysv.c

There's also the expect utility available, http://expect.nist.gov/,
which enables automating interactive terminal based applications.

With ptysh2-sysv, to send a file to a target that only accepts telnet,
we can arrange "tip" to launch "telnet".  Telnet thinks it's connected
to a terminal, but it's really talking with tip.

ss2> uuencode data data > data.uue
ss2> c/ptysh2-sysv /var/tmp/terminal &
[1]     24131
ss2> ls -la /var/tmp/terminal
lrwxrwxrwx   1 me       me            10 Sep  9 10:15 /var/tmp/terminal -> /dev/
pts/3
ss2> tip -9600 /var/tmp/terminal
connected

$ $ telnet localhost
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

SunOS 5.7
. . .

$ cd /tmp
$ ~[put] data.uue
959 lines transferred in 12 seconds
!
$ uudecode data.uue
$ exit
Connection closed by foreign host.
$ exit

Connection Closed
[EOT]
ss2>


> I there on Solaris a program that permit to launch another program making
> believe him that he is connected
> to a terminal.
> As you know a lot of programs works differently when they are connected to a
> terminal, specially concerning
> the buffering of stdout an stderr.

> Thanks in advance




 
 
 

1. Simulate input from terminal keybord?

Hi,

I am writing a shell script (guess you already figured that one out.
Lets see if you can figure this next thing out?).

I have a sh script where i do:

#!/bin/sh
ftp <hostname>

#The ftp server replies with waiting for input, carrige return (\r).

ls

How can I send a carrige return (so to say simulate a that the <RETURN>
has been pressed) so the next step, ls, in my script will be performed?

//Mikael

2. Sparc 10's max serial speed.

3. Simulate Terminal Input

4. FreeBSD with COMPEX wireless LAN

5. Simulating no controlling terminal from a login shell?

6. Microsoft could face huge EU fine

7. Simulating the internet with a Linux machine

8. Confused about partition limits

9. How to simulate mouse buttons by shift/ctrl/alt ?

10. tar.gz simulate zip move/update/freshen

11. How to use IPTABLES to simulate major network outages for testing purposes?

12. Simulate root privileges??

13. Newbie: How can I simulate Windows environment in Linux?