Linux下搭建sqli-labs環境


Host OS: win10
Guest OS:ubuntu-14.04.5-server-amd64

使用到的工具:putty+WinSCP(上傳文件)

sqli-labs下載:https://github.com/Audi-1/sqli-labs

使用LNMPweb集成開發環境,LNMP安裝:https://lnmp.org/install.html

lnmp安裝完成后會提示MySQL密碼,默認是安裝時候輸入的root密碼:

MySQL/MariaDB root password: yourrootpassword

並且LNMP自動start了,將下載好的sqli-labs文件上傳到/home/wwwroot/default/目錄

切換到sqli-labs/sql-connections目錄

cd /home/wwwroot/default/sqli-labs/sql-connections

修改此目錄下的 db-creds.inc文件

<?php

//give your mysql connection username n password
$dbuser ='root';
$dbpass ='yourrootpassword';
$dbname ="security";
$host = 'localhost';
$dbname1 = "challenges";



?>

接着運行setup-db.php

php setup-db.php

運行失敗,提示:
PHP Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in /home/wwwroot/default/sqlilabs/sql-connections/setup-db.php on line 29 [*]...................Could not connect to DB, check the creds in db-creds.inc: Access denied for user 'root'@'localhost' (using password: YES)

切換到root用戶,還是運行失敗。

解決方法:
修改MySQL密碼:

mysql -uroot -p

接着輸入密碼,

mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('mypassword') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit;

再一次php setup-db.php

················省略
[*]...................Old database 'SECURITY' purged if exists<br><br>
[*]...................Creating New database 'SECURITY' successfully<br><br>
[*]...................Creating New Table 'USERS' successfully<br><br>
[*]...................Creating New Table 'EMAILS' successfully<br><br>
[*]...................Creating New Table 'UAGENTS' successfully<br><br>
[*]...................Creating New Table 'REFERERS' successfully<br><br>
[*]...................Inserted data correctly into table 'USERS'<br><br>
[*]...................Inserted data correctly  into table 'EMAILS'<br><br>
················省略

[*]...................Old database purged if exists<br><br>
[*]...................Creating New database successfully<br><br>

················省略

[*]...................Creating New Table 'DCZUIX6QIR' successfully<br><br>
[*]...................Inserted data correctly  into table 'DCZUIX6QIR'<br><br>
[*]...................Inserted secret key 'secret_Z1FL' into table <br><br>
················省略

Host OS中訪問Guest OS:http://yourGuestOS-IP/sqlilabs/index.html

enjoy!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM