[PLUG] command line http authentication
technical at dalvi.co.in
Sat Mar 7 11:02:37 PST 2009
You are probably looking for the script below.
1. Open the login page in browser
2. View the page source
3. Find out form tag
4. Check for input fields
5. Get the form action url
6. Fill in all <> fields below
7. Add the script into crontab with some interval
P.S. Sometimes the input fields are combined/manipulated using
to be submitted & the final URL.
Please remember that you are trying simulate what browser does!
# crontab -l
*/10 * * * * /usr/local/bin/connectme
$ cat /usr/local/bin/connectme
curl -L www.google.com &> /tmp/data;
cat /tmp/data | grep <Some identical word from ISP Login page> &> /dev/null;
if [ $EXITSTATUS == 0 ]
echo "Connecting to My ISP";
curl -d "username=$USERID&password=$PASSWORD" http://<ISP
Action URL> --retry 5
On Sat, Mar 7, 2009 at 8:15 PM, Mayuresh <mayuresh at acm.org> wrote:
> My ISP uses http authentication. So user has to go to a certain https URL and
> login with username password etc.
> This forces me to use a browser to start my internet connection.
> Is there any way to do above https interaction using (say) a command line
> tool - basically non interactively rather than command line vs gui?
> One reason to look for this is to generally avoid having to launch the browser
> just for authentication when you might not actually need it otherwise.
> Another, more compelling reason is, if you leave a large download unattended
> for hours and if the connection gets broken (let's bash ISP on some other
> thread for that ;-) it does not get reconnected automatically. There is no
> mechanism to keep retrying till the connection is re-established. (This used
> to happen so when I had a pppoe based connection.)
> Pune GNU/Linux Users Group Mailing List
More information about the plug-mail