• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

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?
0
MeridianManagement
Asked:
MeridianManagement
  • 3
1 Solution
 
woolmilkporcCommented:
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
 
0
 
omarfaridCommented:
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
0
 
MeridianManagementAuthor Commented:
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?
0
 
omarfaridCommented:
yes, expect can do that
0
 
omarfaridCommented:
if you can provide sample, we might be able to help
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now