I am a student at an university that maintains an internal mail server(zimbra). All the important mails are delivered to this account. But the fact is that no one bothers to check their mail. I am writing this bash script that notifies the user when a new mail is delivered to the inbox.I have figured out a way to find the number of unread mails from the page that is returned after the login(post method)[the title has the unread mail count,so it is just a few "greps" and "seds" away from the number].....
I guess zimbra suite has an api,but I have just started to learn python so I have no other choice but to rely on curl. The form is as follows(i've filtered out the input tags)
<input type="hidden" name="loginOp" value="login"/>
<input id="username" class="zLoginField" name="username" type="text" value="" />
<input id="password" class="zLoginField" name="password" type="password" value=""/>
<td><input id="remember" value="1" type="checkbox" name="zrememberme" /></td>
<td><input type="submit" class="zLoginButton" value="Log In"/></td>
We need to use a proxy server to connect to the internet. And the https connection is not secure,,so the -k I am not sure about the last line but I managed to form this
curl -A 'Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0' -c cookies.txt -k -x 10.1.1.26:8080 -d "loginOp=login&username=xxxxx&password=xxxxx&zrememberme=1&Log+In" https://warrior.bits-goa.ac.in/zimbra/?zinitmode=http > 2.html
The "Log In" button doesn't have a name. That's weird! (ok! I accept I have never come across a similar form) Or is it the cookie? The curl manual recommends the netscape cookie.
The output file is the same as the login page but with an added "Your browser doesn't support cookies" line. What do I do??
Also there is this wonderful addon called tamperdata for firefox. I am not able to install it cause for some reason the net admin has blocked the link to download the addon.[ I don't trust the proxy sites ;) ].Can someone post the post data with a random login on this site. http://warrior.bits-goa.ac.in
Thanks! And sorry for the elaborate question.I want to learn this once and for all :)