Return to site

Kali Linux Docker

broken image


Docker build -t yourname/imagename path/to/theDockerfile (don't actually put ‘Dockerfile' in the path). Do change ‘imagename' to something apropos, such as ‘kali' Run it docker run -ti -p 80:80 -p 443:443 -v /Users/yourname/Desktop:/root yourname/imagename. The above examples require you to replace ‘yourname' with your Mac username-ti. Installing Docker on Kali Linux. To install Docker on Kali you need to remember that there is already a package named 'docker', therefore Docker has to be installed under a different name. If you install docker you will not end up with the container version. The version we will be installing is named docker.io. Docker is a amazing system to run other Operating System in our primary OS Kali Linux. The system is not similar with VMWare or Virtual Box. Unlike the virtual machines, docker is a containers based system. VMWare runs the full size operating system over our primary system so. Now if we exit out of the 'Kali Linux Image' we can now run 'docker ps –a' and we now should our image and the associated container. To resume, run 'docker attach '.

Hey everyone today I am going to show you how to easily deploy a kali instance on docker and install all tools necessary to start your penetration tests with a single command !!!

I will start by supposing that you already have docker installed on your system, if you don't have a look at their documentation on how to install on your OS here. (if you encounter a Hyper-V error while trying to deploy the machine on windows have a look at my post here)

Note: Do not forget to run the following commands on Linux distros using sudo and if you use Windows instead, you have to run powershell or cmd as administrator. Also to use docker you have to enable hyper-v therefore causing any machines that you use on VMware or Oracle VM to be unusable until you disable that again, but good news is that VMware will update their platform to support hyper-v in a near future !!!

Ok lets begin the first step is to pull the kali image from the docker repository here is the code for that:

docker pull kalilinux/kali-rolling

After this step completed you have to start a new 'machine' to host the image:

docker run -t -i kalilinux/kali-rolling /bin/bash

The command /bin/bash will open a bash for you as root, let's update our system so we can have the latest packages installed and updated:

apt-get update && apt-get install -y

Now for the last step, we will use a special command to install all tools that you would find on the traditional kali for VMs.

apt -y install kali-linux-large

This will take a while, during the installation the bash will stop and ask some preferences and settings for the applications being installed on the container, but mostly you can just press enter to skip them. They won't affect your experience at all, well at least from what I have seen, but it still a good idea to have a quick look what each prompt is asking you for.

Bonus !!!

Ok, now that you are set let's rename your container so then you don't need to force yourself to use the random generated name by the docker. To check your name use the following command (remember to use a different bash than your container running linux)

docker ps

Now it will display something like this:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

456465445656454 kalilinux/kali-rolling 'bin/bash' today up 10 minutes arandomname

Now get the random name displayed on the prompt and write the following command:

docker rename arandomname myKali

Now type docker ps again a tah dah your machine is named to your desired name, you can find more command to use on docker on thispage. Now have fun 🙂

Hope I have helped you somehow, as always, have a wonderful day 🐳

A few times now, I find myself wondering why I need a full blown VM. I like need to quickly get my tools up and running on any hardware I find myself on. Most of the time that is a fresh installed Windows 10 on my Surface Book—I like messing things up to a point of no return… what can I say?

As I illustrated the beauty of 'Bash on Ubuntu on Windows' in the Azure Security Center's SQL-Injection Playbook, I realized there really must be a better way to bring Kali Linux over to Windows as well. As many know, Kali is a customized Linux distribution, based on Debian. I could, in theory, install Ubuntu and install the Kali repositories and go from there—in addition, I like to stay away from multiple repositories from multiple parties on the same packages. Possible, but a configuration nightmare to maintain and troubleshoot. Kali's official documentation seems to agree with me.

The next best thing is Containers. In the Windows world, this requires Windows 10 Anniversary Edition+. You'll be able to enable Containers, Install Docker, and pull a Kali Linux image all in 10 minutes or less (download speeds may vary ).

Installing the Containers Feature and Installing Docker

First, we must enable the 'Containers' feature. Run (ctrl+r) 'optionalfeatures'.

And make sure this 'Containers' option is checked off.

Once that completes, follow these instructions to install docker: https://docs.docker.com/docker-for-windows/install/. Grab the Stable channel Windows MSI and install it. Once you get it to install, you need to log out and log back in. NOTE: Although Docker stated it just needed a log-out/log-in, in order for the Docker service to run on my machine it required a reboot.

After logging back in, in your notifications, you should get a 'Docker is starting…'.

Pull Official Kali Linux Docker Image

We will be following the guidance here: https://www.kali.org/news/official-kali-linux-docker-images/

Open up your favorite command line interface (CLI). Then type 'docker pull kalilinux/kali-linux-docker'. This will pull the image from the Docker Store.

Now, let us enter an interactive bash session with that image by typing 'docker run -t -I kalilinux/kali-linux-docker /bin/bash'

We are now in our fresh install of Kali. Since this install is meant to be the minimal, you need to grab the packages you actually care about. This helps keep the image small but does require a good Internet connection to get up and running.

Before installing any package, let's upgrade our Kali Linux and remove all packages we no longer need via 'apt update && apt full-upgrade && apt auto-remove && apt-autoclean'

Installing the Metasploit Framework

Lastly, let us install the go-to package for most pentesters… Metasploit. A simple command of 'apt install metasploit-framework ruby' will do the trick.

Install Docker On Kali Linux

Kali linux docker vnc

Kali Docker Container


Just start up the PostgresSQL database that Metasploit uses, initialize the database, and to msfconsole we go!

Happy Hunting,

Andrew (@ciberesponce)





broken image