环境搭建
docker search sqli-labs
docker pull acgpiano/sqli-labs
docker run -it -d --name sqli-labs -p 18080:80 -p 13306:3306 acgpiano/sqli-labs
设置数据库
访问
http://localhost:18080/
点击
"Setup/reset Database for labs"
进行初始化数据库
会自动创建 SECURITY 等数据库
开启 mysql 调试
➜ ~ docker run -dt --name sqli-labs -p 18080:80 -p 13306:3306 --rm acgpiano/sqli-labs
5dccd8d6a7d3e81215383e14eda39aff6c84975fa8708a46beaa1527404e97b9
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5dccd8d6a7d3 acgpiano/sqli-labs "/run.sh" 2 seconds ago Up 2 seconds 0.0.0.0:18080->80/tcp, 0.0.0.0:13306->3306/tcp sqli-labs
➜ ~ docker exec -it 5dc bash
root@5dccd8d6a7d3:/# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
开启完,可从本机连接 mysql 进行调试。