With Docker containers, we can create penetration test environments or audit environments as needed. We can also show the containers to the client as part of the evidence, or give them to the client for auditing

Docker is the world’s leading software packaging platform, for different types of penetration testing, we can use Docker to create the corresponding environment. With Docker containers, you can put your test environment on a USB stick or in the cloud.

What is the Docker

Docker is an open source technology that allows you to create, run, test and deploy applications in a software container. Dcoker allows you to deploy applications quickly, reliably, and stably in any environment. Containers are portable, convenient and fast. With Docker, you can create an image on which to build other environments. For example, we downloaded Kali Linux as the base container, which didn’t have the tools we needed. We treat it as a base container, install the necessary tools on it, and save it as a new image without affecting the original image. That is, containers containing forensics tools, Web penetration testing tools can be created from the original image.

Tools for Web penetration testing

In this article, only the console tools are used.

W3af-console

SQLMap

Arachni

Nikto

Websploit

Nmap

The installation

The installation of Docker depends on the operating system you are using, however, the installation packages for most systems can now be found in the official repository. In this article, we use the OpenSuse system.

_0x4a0x72@pwned ~ sudo zypper se docker

S | Nome | Resumo | Tipo

– + + – – – – – – – – – + – – –

| docker | The Linux container runtime | pacote

_0x4a0x72@pwned ~ sudo zypper in docker

After the installation is successful, you must enable and start the service

_0x4a0x72@pwned ~ sudo systemctl enable docker

_0x4a0x72@pwned ~ sudo systemctl start docker

_0x4a0x72@pwned ~ sudo docker info

Containers: 0

Running: 0

Paused: 0

Stopped: 0

Images: 0

Server Version: 1.11.2

Storage Driver: btrfs

The Build Version: Btrfs v4.5.3 + 20160516

… .

Docker Root Dir: /var/lib/docker

Debug mode (client): false

Debug mode (server): false

Registry: index.docker.io/v1/

WARNING: No swap limit support

Container installation

The Kali publisher has an official image on the HUB Docker, which greatly speeds up our work. Using the command: sudo docker search Kali, you can list the images on the Docker HUB. Let’s choose the first one.

_0x4a0x72@pwned ~ sudo docker search kali

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

kalilinux/kali-linux-docker Kali Linux Rolling Distribution Base Image 193 [OK]

Let’s do the pull image for our machine, This step depends on the internet connection.

_0x4a0x72@pwned ~ sudo docker pull kalilinux/kali-linux-docker

Using default tag: latest

latest: Pulling from kalilinux/kali-linux-docker

b2860afd831e: Pull complete

340395ad18db: Pull complete

d4ecedcfaa73: Pull complete

3f96326089c0: Pull complete

e5b4b7133863: Pull complete

Digest:

sha256:0aa8342172aacbe79957f66e7029c1fb38e14765bf35eff30624f90cb813a56f

Status: Downloaded newer image for kalilinux/kali-linux-docker:latest

_0x4a0x72@pwned ~ sudo docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

Kalilinux/kalali-linux-docker latest F321257D50F7 6 days ago 602.4 MB

The container can be opened using the following command.

_0x4a0x72@pwned ~ sudo docker run — name WebPentest -t -d Kalilinux /kali-. Linux -docker

_0x4a0x72@pwned ~ sudo docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

A5fb073e53c8 Kalilinux /kali-linux-docker “/bin/bash” 10 seconds ago Up 8 seconds WebPentest

Tools installation

We can install it outside of the container, but here I’ll show you how to access the container like a virtual machine. We execute the following command to get the shell of the container.

_0x4a0x72@pwned ~ sudo docker exec -it WebPentest bash

root@a5fb073e53c8:/#

Once we got the shell, we updated the container and installed the tools we needed for web penetration testing.

root@a5fb073e53c8:/# apt-get update

root@a5fb073e53c8:/# apt-get upgrade

root@a5fb073e53c8:/# apt-get install websploit w3af-console arachni nikto sqlmap websploit nmap

After the installation is complete, we can execute commands normally from inside the container

root@a5fb073e53c8:/# nmap localhost

Starting Nmap 7.12 (nmap.org) at 2016-06-30 09:09 UTC

Nmap scan report for localhost (127.0.0.1)

Host is up (latency).

Other addresses for localhost (not scanned): ::1

All 1000 scanned ports on localhost (127.0.0.1) are closed

Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

Or you can run it outside of the container. After completing the command, use the escape sequence Ctrl-p + Ctrl-q to disconnect the shell instead of exiting it.

_0x4a0x72@pwned ~ sudo docker exec -it WebPentest nikto

– the Nikto v2.1.6

— — — — — — — — — — —

ERROR: No host specified

-config+ Use this config file

… .

requires a value

Note: This is the short help output. Use -H for full help text.

With commit, you can save your changes as images.

_0x4a0x72@pwned ~ sudo docker commit -a “Junior Carreiro” -m “Install WebPentest Tools” WebPentest

Conclusion Using Docker container, we can create penetration test environment or audit environment according to needs. We can also show the containers to the client as part of the evidence, or give them to the client for auditing. ———————————————— Copyright notice: This article is originally published BY CSDN blogger “HBohan” under CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement. The original link: blog.csdn.net/HBohan/arti…