Click to See Complete Forum and Search --> : keep alive
haroldsoh
August 3rd, 2001, 08:20 AM
I am a student at NUS (http://www.nus.edu.sg) The university has a strange network policy. No matter if students are active online or not, they get disconnected from the network every 30 minutes and have to relog-on using a web site provided by the university ( http://spnp.nus.edu.sg ) . I wish to write an application to keep the connection alive.
I was thinking about a telnet client into the site and POSTing the information (ie. my username and password) to the site. My questions are as follow:
1. I realised that the page was cgi-bin/login.py. What is a .py page ? just a script page ? will this require me to program the app differently ?
2. What is the HTTP command to post data (i.e. my username and password) and what is the format ?
3. What is the best way to achieve a connection to the server ? winsock ?
3. There is also a HTTPS site which I would prefer to code my application for. Anyone has any idea how to achieve this ?
I would really really appreciate any help! Thanks!
Harold Soh
Ghost308
August 3rd, 2001, 08:37 AM
Hi there,
I dont' think I can save the day for you but maybe I can offer a little more information...
1. cgi-bin/login.py is an application on the server written in Python (thus the .py) which is a language similar to Perl for writing cgi applications.
2. to post data through HTTP... are you trying to send the data that is posted to the login.py app? if so, you should just be able to login like normal, copy the link at the top of your browser that runs login.py with all its arguments, and put that link in your code... but it kinda depends on how the app was created so i can swear to that
3. find some info on the Microsoft Internet Transfer control which has support for HTTP and FTP transfers
Maybe that will shed a little light for you, good luck!
Alejandro Ochoa
August 3rd, 2001, 09:08 AM
Do you relog-on using a web browser?, I mean, go to an specific address I think this http://spnp.nus.edu.sg and then type your username and password?. If so, I may be able to help.
haroldsoh
August 3rd, 2001, 09:26 AM
Thanks for the message but after experimenting for an hour, I figured it out. Thanks!!!
Harold
haroldsoh
August 3rd, 2001, 09:27 AM
Thank you all for the replies. After meddling about for about an hour, I have figured it out. Thanks!
Harold
Cimperiali
August 3rd, 2001, 09:43 AM
Post your solution: it may be interesting
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
haroldsoh
August 5th, 2001, 08:52 AM
Hey All,
This is the solution I used to solve my problem. It may not be the best way but it is the solution easiest to implement.
I studied the web page and I found the variables which were submitted (i.e. the username and password variables) and read into HTTP's POST command.
I downloaded netcat (publicly available at www.hideaway.net). One of netcat's functions is to send information to a specific server on a specific port.
I wrote a batch file to run netcat in the following way
nc servername 80 < datafile > resultfile
The batch file runs netcat which connects to port 80 on the server specified by servername and sends the information contained in datafle to the server. in my case, datafile was just a regular text file which contained a POST command. Netcat would also place whatever it received in return in a file. In this case, the file would be resultfile.
For the GUI, I used Visual Basic. Using the ShellExecute function, I call the batch file I wrote at intervals.
What I've explained is a simplified description of the program I am writing. The actual program will check whether the authentication is successful or not using the result file. It will also provide a simple encryption procedure for storing my username and password.
I hope this helps anyone else encountering a problem like myself.
Harold
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.