?
Solved

Linux terminal window redirection , screen scraping

Posted on 2006-05-05
5
Medium Priority
?
427 Views
Last Modified: 2008-02-26
I'm trying to create a c program that opens a lynx application (linux command line web browser) in a terminal window and automatically fills some blanks with a username and password. It's for automatic reconnection to a website in case the internet connection is lost. I was thinking running the program and redirecting a string to the /dev/tty is running on. But i'm not sure how to do that and how to redirect an character string to certain coordinates on screen.
0
Comment
Question by:CYTA
  • 2
  • 2
5 Comments
 
LVL 6

Assisted Solution

by:liviutudor
liviutudor earned 300 total points
ID: 16621167
have tried creating a pipe to the stdin of the program? (same as myprogram < input.txt)
0
 
LVL 1

Expert Comment

by:vishwa_karthick
ID: 16625671
The best solution for such scenarios is using expect programming. It works by using the concept of checking the current output of your script/program and giving the input that matches this. You can refer to the book "Exploring Expect" by Don Libes for this.

Thanks and regards,
Karthick S.
0
 

Author Comment

by:CYTA
ID: 16626169
The problem with piping to stdin and with using expect programming is that that the application doesnt wait for an input and a carriage return in order to continue. Is like a webpage with text boxes that you have to fill but in a terminal window (command line form) and then use the cursor keys to highlight a word and press enter to submit the data . The approach i was thiinking was either sending the corresponding characters for arrow down and up to the terminal and filling the blanks or output text to certain coordinates to the screen. Also in the case of expect i think you must use tcl. I would like to use,if it is possible only c code.
0
 
LVL 1

Accepted Solution

by:
vishwa_karthick earned 500 total points
ID: 16656307
How about trying with "curl"?

Thanks and regards,
Karthick S.
0
 

Author Comment

by:CYTA
ID: 16680027
I read about "curl" and as i understand you can send a post command to a website. I would prefer to use a more "high level" approach since the login site changes frequently and i cannot find the connection string that is send when i press the submit button (the pass is encrypted and i cannot see it even if i sniff my network to see the connection string). Also i want for lynx to login and allow people to continue working with the webbrowser. Is like an automatic login that will enable the users to enter a site and continue their work on lynx without having to know the password of the login.

But since Karthick S. gave me an answer that would probably work with the way i posted original question, liviutudor gave me a good approach and no one else  answered i'll divide the points between them..
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question