Wampserver搭建DVWA和sqli-labs问题总结

发布时间 2023-08-11 05:08:27作者: 彬彬zhidao

Wampserver 搭建 DVWA 和 sqli-labs 问题总结

遇到问题解决的思路方法

  1. 百度,博客去搜索相关的问题,人工智能 chatgpt
  2. 查看官方文档,查看注释。
  • 本次解决方法就是在文档的注释里面发现修改配置需要到另外一个文件里面去修改

增加办公效率工具推荐

uTools
内含各种插件,非常方便。

  • 个人经常使用 OCR,截图翻译,快速查询本地 IP,编码和解码等等。

1.Apache 配置文件

问题: 可以在虚拟机内部访问靶场,但是不可以在物理机上面访问。显示禁止访问,未开通权限。403

解决方法:
配置文件的问题:
更改 httpd.conf 文件如下:

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 192.168.42.131:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
HostnameLookups Off

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/wamp64/www"
<Directory "C:/wamp64/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options +Indexes +FollowSymLinks +Multiviews
    #Options All
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
#   Don't modify this line - Instead modify Require of VirtualHost in httpd-vhost.conf
    Require all granted
</Directory>

根据百度的教程参考,这样应该是没问题的。但是!!!问题依旧没有解决。经过各种查阅,尝试。最后在一句注释里面找到了解决方法。

    #
    # Controls who can get stuff from this server.
    #
    #   Don't modify this line - Instead modify Require of VirtualHost in httpd-vhost.conf
    Require all granted

来翻译一下:
不要修改此行,而是修改 httpd vhost conf 中虚拟主机的要求
折腾好长时间,问题终于解决了。

2. sqli-labs 无法正常使用

问题:
前面十分顺利,再导入数据库的时候出现了问题。解决完这个之后又无法打开 lab。

解决方法:

刚刚出现问题的时候想的是配置文件是否发生错误。于是经过一番检查发现没有问题。那么怎么回事呢?

于是从报错的语句入手。
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\wamp64\www\sql1\sql-connections\sql-connect.php on line 6

经过百度和 chatgpt 之后终于找出原因,我现在使用的是 php8.x;但是文件太老了,使用的 php 代码仍然是 php5.x 的;两个版本的代码特性已经有了一些不同。

于是,我把报错的两个文件进行手动更改,好了,这个页面不会报错了,问题又来了,我进入下一个 lab1 页面的时候又会出现同样的问题。

不改了,去网上去找最新版本的吧!这个版本太旧了。


找了,没有 php7 的,于是只能从 wamp 的配置上面入手了。

刚开始按照这个博客疯狂尝试了一个多小时
解决博客尝试

个人对于各种配置实在不熟悉,一直不成功,突然去官网发现了新大陆。官网解决方法都写好了,白浪费折磨长时间。官网


好吧!我又来了,发现 php5.x 不兼容 phpMyAdmin5.x。
于是我又安装了 phpMyAdmin4.9.11
这一次兼容了,又是各种重启配置数据库。


数据库 mysql 又是连不上进不去
各种搜索是因为 MySQL8.x 字符集变了。
干脆直接安装一个 MySQL5.5.62
折腾了半天,终于数据库连上了。

另外,注意教程中的最后一步不需要手动导入数据库,直接点击靶场中的一个按钮就可以。

参考链接

靶场搭建