Automation though wget
Posted: Sat Aug 25, 2007 5:20 pm
After many trials and tribulations, I managed to get wget to login to cms made simple, and to perform an admin action. To do anything requires intimate knowledge of the php at the back end (to know what parameters to supply, wether they are via post or get, etc). But it's possible.
Here's the script I ended up with. Of course, I could improve on it, but, you'll get the point.
Here's the script I ended up with. Of course, I could improve on it, but, you'll get the point.
Code: Select all
#!/bin/sh
rm /tmp/login.php* /tmp/index.php* /tmp/moduleinterface.php*
sitename='http://www.mysite.com'
cookies=/tmp/cookies.tmp
postdata='username=theusername&password=thepassword&loginsubmit=Submit'
cd /tmp
wget --save-cookies ${cookies} --keep-session-cookies --post-data=$postdata ${sitename}/admin/login.php
wget --load-cookies ${cookies} ${sitename}/admin/moduleinterface.php\?mact=FileMailer,m1_,admin_setfiles,0
rm /tmp/cookies.tmp