BackTrack5R3下DVWA安装
最近在看《The Basics of Web Hacking》这本书,文中介绍了如何在BT5下安装DVWA。作者推荐的DVWA自动安装脚本有些问题,在此post自己安装的经验。
自动安装脚本如下所示(修改版,更正了原版中的错误):
#/bin/bash echo -e "\n#######################################" echo -e "# Damn Vulnerable Web App Installer Script #" echo -e "#######################################" echo " Coded By: Travis Phillips" echo " Website: http://theunl33t.blogspot.com" echo -e -n "\n[*] Changing directory to /var/www..." cd /var/www > /dev/null echo -e "Done!\n" echo -n "[*] Removing default index.html..." rm index.html > /dev/null echo -e "Done!\n" echo -n "[*] Changing to Temp Directory..." cd /tmp echo -e "Done!\n" echo "[*] Downloading DVWA..." wget -O DVWA-1.0.8.zip https://github.com/RandomStorm/DVWA/archive/v1.0.8.zip #wget http://voxel.dl.sourceforge.net/project/dvwa/DVWA-1.0.7.zip echo -e "Done!\n" echo -n "[*] Unzipping DVWA..." unzip DVWA-1.0.8.zip > /dev/null #unzip DVWA-1.0.7.zip > /dev/null echo -e "Done!\n" echo -n "[*] Deleting the zip file..." rm DVWA-1.0.8.zip > /dev/null #rm DVWA-1.0.7.zip > /dev/null echo -e "Done!\n" echo -n "[*] Copying dvwa to root of Web Directory..." cp -R DVWA-1.0.8/. /var/www > /dev/null #cp -R dvwa/* /var/www > /dev/null echo -e "Done!\n" echo -n "[*] Clearing Temp Directory..." rm -R DVWA-1.0.8 > /dev/null #rm -R dvwa > /dev/null echo -e "Done!\n" echo -n "[*] Enabling Remote include in php.ini..." cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini1 sed -e 's/allow_url_include = Off/allow_url_include = On/' /etc/php5/apache2/php.ini1 > /etc/php5/apache2/php.ini rm /etc/php5/apache2/php.ini1 echo -e "Done!\n" echo -n "[*] Enabling write permissions to /var/www/hackable/upload..." chmod 777 /var/www/hackable/uploads/ echo -e "Done!\n" echo -n "[*] Starting Web Service..." service apache2 start &> /dev/null echo -e "Done!\n" echo -n "[*] Starting MySQL..." service mysql start &> /dev/null echo -e "Done!\n" echo -n "[*] Updating Config File..." cp /var/www/config/config.inc.php /var/www/config/config.inc.php1 sed -e 's/'\'\''/'\''toor'\''/' /var/www/config/config.inc.php1 > /var/www/config/config.inc.php rm /var/www/config/config.inc.php1 echo -e "Done!\n" echo -n "[*] Updating Database..." wget --post-data "create_db=Create / Reset Database" http://127.0.0.1/setup.php &> /dev/null mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/gordonb.jpg" where user = "gordonb";' mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/smithy.jpg" where user = "smithy";' mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/admin.jpg" where user = "admin";' mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/pablo.jpg" where user = "pablo";' mysql -u root --password='toor' -e 'update dvwa.users set avatar = "/hackable/users/1337.jpg" where user = "1337";' echo -e "Done!\n"ged echo -e -n "[*] Starting Firefox to DVWA\nUserName: admin\nPassword: password" firefox http://127.0.0.1/login.php &> /dev/null & echo -e "\nDone!\n" echo -e "[\033[1;32m*\033[1;37m] DVWA Install Finished!\n"
按照上面进行DVWA按照之后,在浏览器中输入“http://127.0.0.1/login.php”之后,可能出现MySQL的连接错误。这需要修改/var/www/config/config.ini.php中的内容,具体修改部分如下: