viernes, 24 de febrero de 2012

livebox2 reset internet connection

Being with Orange for some years means that I used to have a livebox 1 and now have a livebox 2. With the new one however it seems that from time to time my connection is stuck, if you look at the web page everything seems fine, but packets don't get passed the livebox, resetting the Internet connection is the quickest way to solve this. Here is a script to reset the connection from the command line:
wget --post-data="page=home&authaction=login&authlogin=admin&authpasswd=YOURPASSWORD" http://192.168.0.1/index.cgi -O - 2>/dev/null|(URL=$(sed -n 's|.*index.cgi?page=internet\(&sessionid[^"]*\)".*|http://192.168.0.1/index.cgi?page=internet\&action=reset\1|p');wget "$URL" -O - >/dev/null 2>&1)
One warning, here we have the password on the command line, you can use --post-file instead of --post-data to be safer, but anyway, please note that we are sending the password in the clear without any ciphering, while the livebox web page sends it as a hash, so it should be somewhat safer if they do things right.