简介

vulfocus是一个管理靶场的docker容器。做为一个学习网安,渗透的小白,不乏会碰到搭建练习靶场,以及一些漏洞环境来学习。比如dvwa、pikachu等等。搭建不仅费事费时,而且再次学习还要重新搭建或者搭建部分,简直是学习路上的绊脚石。
vulfocus管理着常用的靶场和漏洞,只需要动动手指点击鼠标,vulfocus就会自动从官网拉取环境,且依赖docker部署环境。当再次使用时,只需docker启动vulfocus,通过vulfocus启动即可,当然也可以使用docker启动,因为vulfocus也是安装的靶场或者漏洞环境也是docker容器。

安装

首先需要安装docker。我使用的是ubuntu系统。
参考的菜鸟教程,然而没有安装成功。先附上菜鸟教程的安装方法。

使用官方安装脚本自动安装

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
或者:
curl -sSL https://get.daocloud.io/docker | sh

手动安装

  1. 卸载旧版本

Docker 的旧版本被称为 docker,docker.io 或 docker-engine。ubuntu默认安装旧版本的docker。
$ sudo apt-get remove docker docker-engine docker.io containerd runc

  1. 更新 apt 包索引。
    $ sudo apt-get update
  2. 安装 apt 依赖包,用于通过HTTPS来获取仓库:
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
  1. 添加 Docker 的官方 GPG 密钥:
    $ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  2. 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 通过搜索指纹的后8个字符,验证您现在是否拥有带有指纹的密钥。
$ sudo apt-key fingerprint 0EBFCD88
   
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]
  1. 置稳定版仓库
$ sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"
  1. 更新 apt 包索引。
    $ sudo apt-get update
  2. 安装最新版本的 Docker Engine-Community 和 containerd
    $ sudo apt-get install docker-ce docker-ce-cli containerd.io
  3. 测试 Docker 是否安装成功
$ sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete                                                                                                                                  Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for hello-world:latest


Hello from Docker!
This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.


To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash


Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/


For more examples and ideas, visit:
 https://docs.docker.com/get-started/

以下是我的安装方法,很方便。

  1. 卸载旧版本
    $ sudo apt-get remove docker docker-engine docker.io containerd runc
  2. 更新 apt 包索引
    $ sudo apt-get update
  3. 安装docker和docker.io
    $ sudo apt-get install docker docker.io
  4. 测试 Docker 是否安装成功
    $ sudo docker run hello-world

对docker不是很了解,按照菜鸟教程的安装方法一直报错,可能是我的问题,也有可能菜鸟教程的方法是很早之前写的已经不适用了。网上百度了很多辣鸡教程和菜鸟的一模一样(i服)。不知道我有没有少安装什么,但是就是能用。

安装vulfocus

  1. 启动docker
    systemctl start docker
  2. 拉取镜像
    docker pull vulfocus/vulfocus:latest

镜像拉取很慢,更换了国内镜像源也挺慢的,下面是更换镜像源的方法。

创建或修改 /etc/docker/daemon.json 文件,修改:

{
    "registry-mirrors" : [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://cr.console.aliyun.com",
    "https://mirror.ccs.tencentyun.com"
  ]
}

重启docker服务使配置生效:
systemctl daemon-reload
systemctl restart docker.service

查看配置是否成功:
docker info
  1. 查看docker镜像
    docker images

屏幕截图 2022-10-04 171649.png

  1. 启动镜像

上图标红的 IMAGE ID 是镜像id,启动会用。
docker run -d -p 8080:80 -v /var/run/docker.sock:/var/run/docker.sock -e VUL_IP=192.168.0.0 065610407810
192.168.0.0 换成本机IP,可以使用ifconfig命令查看。

使用

经过以上步骤完成了vulfocus的安装,试用一下吧。
浏览器访问 192.168.0.0:8080 ,192.168.0.0依旧换成本机IP。
屏幕截图 2022-10-04 172819.png
用户名和密码都是 admin
屏幕截图 2022-10-04 173415.png
点击 镜像管理 、 一键同步 。等待漫长事件之后,就可以看到很多靶场或者漏洞环境。如上图。
同步之后,可以直接搜索相练习的靶场,如dvwa。点击下载,然后再等待漫长的时间,然后就下载成功了。
屏幕截图 2022-10-04 173453.png
点击首页,就会看到下载好的环境,点击启动就会启动,如下图:
屏幕截图 2022-10-04 173605.png
标红的就是靶场环境的访问地址,浏览器直接访问即可。

结语

感觉非常好用,虽然下载速度太慢了。还记得直接自己的搭建靶场练习,简直是费了老大的劲,靶场练习的时间都没有我搭建所费的时间长,苦哉哀哉。
一直在学习的路上,有何问题,欢迎大家指正。