Link to home
Start Free TrialLog in
Avatar of MeridianManagement
MeridianManagementFlag for United States of America

asked on

unix screen scrape from within unix

Okay, I know you can screen scrape a unix terminal from a PC, but can you screen scrape a unix telnet session from another unix? So let's say I'm interacting with an application in unix that has prompts, and depending on what the program says, I want to call different patterns of keystrokes. This would require me to be able to read the program output without closing the program, and then sending input and reading more output. What is the best way to accomplish this?
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Hi,
look at 'expect'.
This is its manpage -
http://linux.die.net/man/1/expect
and here is its homepage -
http://expect.nist.gov/
download -
http://expect.nist.gov/#unix
wmp
 
Is your requirement to automate responses to the application? Do you want to do this from a remote system where you have to login (either by telnet or ssh) first and then run the application? expect is one option (as woolmilkporc recommended), but certain applications can be redirected from scripts:

command <<END
response1
response2
END
Avatar of MeridianManagement

ASKER

Actually I misspoke, I would like to have the script on the same box as the program it's interacting with. I think "expect" looks right, my only concern is if this can be compiled.

To clarify, there is this banking application on a mainframe that works entirely in green screens, so all the menus and interaction has to be done through a terminal session. Some of the menus are confusing or certain processes require manipulation of several different menus. Although I can't modify the menus, I would like to automate some of these processes.

For this to work, I need full capabilities read all output of the text from the application itself, and then using custom logic, send different input based on what comes out. On top of that, I'm looking for the scraping script itself to be able to accept input from the user who is executing to send back into the application.

Does this sound like something expect can handle?
ASKER CERTIFIED SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you can provide sample, we might be able to help