ubuntu搭建sqli-labs靶场
时间: 2023-12-26 18:24:28 浏览: 253
好的,以下是搭建sqli-labs靶场的步骤:
1. 安装LAMP环境(Linux + Apache + MySQL + PHP):
```
sudo apt-get update
sudo apt-get install apache2 mysql-server php libapache2-mod-php php-mysql
```
2. 下载sqli-labs代码:
```
git clone https://github.com/Audi-1/sqli-labs.git
```
3. 将sqli-labs代码放到Apache的根目录下:
```
sudo mv sqli-labs /var/www/html/
```
4. 创建MySQL数据库并导入数据:
```
mysql -u root -p
create database security;
use security;
source /var/www/html/sqli-labs/sql-connections/db-creds.inc
source /var/www/html/sqli-labs/schema/mysql.sql
```
5. 修改sqli-labs配置文件:
```
cd /var/www/html/sqli-labs/
sudo cp config.inc.example config.inc
sudo nano config.inc
```
将以下两行代码的注释去掉,并修改为自己的MySQL用户名和密码:
```
$dbuser='root';
$dbpass='password';
```
6. 重启Apache服务:
```
sudo service apache2 restart
```
7. 访问sqli-labs靶场:
在浏览器中输入:http://localhost/sqli-labs/
阅读全文