Click to See Complete Forum and Search --> : Shell Script to Automatically Authenticate with proxy


canon006
01-25-2004, 05:53 PM
I think I have most of this problem figured out, in the dorms at my school we are required to authenticate with the proxy in order to get internet access. We have to go to a certain page every 24 hours(give or take), a box pops up asking for our student ID and password, fill them in and it's done.

It's not so annoying, but it would be nice to be able to automate this. What I was thinking is a small shell script that would use Lynx to authenticate. Something like

lynx -auth=ID:password auth.site

and set it up in cron to run every 12 hours or so.

The thing is, if I do that, am I going to have a new instance of lynx running every 12 hours, or is there a way that after it's authenticated, I can have it close lynx. I know the proxy is Squid if that helps. Thanks in advance for any input.

bwkaz
01-25-2004, 07:20 PM
If your proposed lynx invocation works (try it to be sure), then you can do something like this:

lynx -auth=ID:password auth.site &
/bin/sleep 15 # in seconds
kill $! As long as lynx doesn't die within 15 seconds (or whatever you use for sleep), this should work. Make sure the sleep time is long enough for the page to load.

canon006
01-25-2004, 09:17 PM
Thanks bwkaz that's just what I was looking for. I checked the lynx help doc before I posted and found out about the -auth option, if that doesn't work, there's a -pauth option which is specificly for authenticating against a proxy.