[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

wget and captcha puzzle !!!



Dear list,

My internet provider provides an online form accessed by local IP (the connection
is based on eth); so that the subscriber can provide username and password to activate
the login; additionally it also has a captcha as added security. I am trying to make a 
daemon which just do the login and activate the connection. Within the source of the
form the captcha link embedded as     src="http://192.168.1.108/captcha.phtml?r=003665dd765d04967a7e00071e6af4a1";
And the long string at end changes everytime I reload the form.

Anyways I can read the captcha code with

```````````
#!/bin/bash

wget http://192.168.1.108

#extract the captcha string like captcha.phtml?r=72eb74eb980688ae730dbb9cb7d6a5d8

cap_string=`cat index.php | grep src=\"captcha.phtml | cut -f 10 -d '"'`

wget http://192.168.1.108/$cap_string -O /tmp/captcha.png

gocr /tmp/captcha.png 
`````````````
And it really do the tricks, reading the captcha :-)

Though sending the same code through wget along-with username and password doesn't work.

wget --post-date 'username=xxx&password=xxx&captcha_code=<retrieved_code>' http://192.168.1.108

*BECAUSE*

If I visit the url http://192.168.1.108/captcha.phtml?r=003665dd765d04967a7e00071e6af4a1
again and again; every time I get a new captcha. So when I submitting the captcha
by wget; it is already changes to a new one !!!! How can I overcome this puzzle ?
The form (through browser) gives a failure notice when captcha code doesn't match. Is it possible to collect
the failure notice through wget somehow for debugging ?

Please give me some clue. I just like my linux script do the login and activate internet.
Thanks




Reply to: