環(huán)境搭建
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
設(shè)置數(shù)據(jù)庫
訪問
http://localhost:18080/
點擊
"Setup/reset Database for labs"
進行初始化數(shù)據(jù)庫
會自動創(chuàng)建 SECURITY 等數(shù)據(jù)庫
開啟 mysql 調(diào)試
? ~ 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 進行調(diào)試献雅。