我是靠谱客的博主 专一黑猫,最近开发中收集的这篇文章主要介绍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!

转载于:https://www.cnblogs.com/NexTen/p/7671280.html

最后

以上就是专一黑猫为你收集整理的Linux下搭建sqli-labs环境的全部内容,希望文章能够帮你解决Linux下搭建sqli-labs环境所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部