πŸ•ΈοΈ
Th4ntis CyberSec
  • πŸ•·οΈ>whoami_
  • πŸ–₯️General Info
    • CyberSec News
    • Getting Started and other Resources
      • CompTIA Certs
        • Security+
        • Pentest+
    • MITRE ATT&CK
    • Cyber Kill Chain
    • Docker
  • πŸ’»Networking
    • General Networking
    • Common Ports and Protocols
    • TCP/IP Model
    • OSI Model
    • Subnetting
    • Wireshark
    • NMap
    • Wireless
      • Wardriving/WiFi Sniffing
    • 3-Way Handshake
  • 🐧Linux
    • Common commands
    • Sudo
    • Files and File contents
    • Sed Awk and Grep
    • Permissions
  • πŸͺŸWindows
    • Event Codes
    • Powershell
    • Internals
    • Active Directory
  • πŸ”ŽOSINT
    • OSINT Tools
    • IP/Domain OSINT
    • Email/Username OSINT
    • URL OSINT and Sandboxing
    • Social Media OSINT
    • Website OSINT
    • Password OSINT
    • Physical Location OSINT
    • Image OSINT
    • People OSINT
    • Phone Number OSINT
    • Shodan
    • Google Dorking
  • πŸ› οΈTools
    • Brute Force
      • Hydra
    • Credential Dumping
      • Mimikatz
    • Enumeration
      • Bloodhound
      • Certipy
      • Dirb/Dirbuster
      • Enum4Linux
      • GoBuster
    • Exploitation Framework
      • Metasploit
      • Sliver
      • Cobalt Strike
    • Hash Cracking
      • Hashcat
      • JohnTheRipper
    • Methods
      • Powershell Obfuscation
      • Privilege Escalation
      • Pass-The-Hash
      • Kerberos and Kerberoasting
    • Vulnerability Scanners
      • Nessus
      • OpenVAS
    • Web App
      • BurpSuite
      • OWASP Zap
    • Wireless
      • Aircrack-ng
      • Kismet
      • Bettercap
      • HCXDumptool
      • Wifite
    • Impacket
    • Social-Engineer Toolkit (SET)
  • πŸ“”Guides and How-To's
    • Lab Setup
      • Ubuntu VM
      • Kali VM
      • Windows User VM
      • Windows Server VM
    • Wardriving
      • Pwnagotchi
    • Wireless Pentesting
      • WiFi Pineapple Basics
      • Evil-Twin Attack
    • Over The Wire
      • Bandit
      • Natas
      • Leviathan
      • Krypton
      • Narnia
      • Behemoth
      • Utumno
      • Maze
      • Vortex
      • Manpage
    • Docker and Kali Linux
    • Staying Private and goin Dark Online
  • πŸ“•Quick References
    • Tools
      • Tmux
      • NMap
      • Ffuf
      • NetExec
      • CrackMapExec
      • Proxychains
      • OneDriveUser Enum
      • Hashcat
    • One-liners
    • Reverse Shells
    • Post Exploitation
    • Enumeration
      • Google
      • Sublist3r
      • NMap
      • DNSDumpster
    • Hashcracking
    • Wireless
  • πŸ““Courses
    • PNPT
      • Practical Ethical Hacking
      • Windows Privilege Escalation
      • Linux Privilege Escalation
      • OSINT Fundamentals
      • External Pentest Playbook
  • ☁️TryHackMe
    • Attacking Kerberos
    • Hacking with Powershell
    • Powershell for Pentesters
    • Linux PrivEsc
    • Windows PrivEsc
    • Blue
    • Kenobi
  • πŸ“¦HackTheBox
    • Starting Point
      • Tier 0
        • Meow
        • Fawn
        • Dancing
        • Redeemer
        • Explosion
        • Preignition
        • Mongod
        • Synced
      • Tier 1
        • Appointment
        • Sequel
        • Crocodile
        • Responder
        • Three
        • Ignition
        • Bike
        • Funnel
        • Pennyworth
        • Tactics
      • Tier 2
        • Archetype
        • Oopsie
        • Vaccine
        • Unified
        • Included
        • Markup
        • Base
    • Walkthroughs
      • Lame
      • Analytics
      • Manager
      • Codify
Powered by GitBook
On this page
  • Introduction
  • Links
  • Using Kali Docker Images
  • Installing tools
  • Setting up a share
  • Getting a Graphical User Interface(GUI)
  • Adding a new non-root user
  • Making a custom image
  • Conclusion
Edit on GitHub
  1. Guides and How-To's

Docker and Kali Linux

Last updated 1 year ago

helps developers build, share, run, and verify applications anywhere with containers. More info on containers .

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

My notes on Docker can be found .

Introduction

This will be a guide on setting up in a docker container. Including pulling a new image, setting it up with prefer tools, services, configs, and a GUI if we want. Then covering how to save the image to a file to use on other machines or upload to docker hub to share.

Links

  • on Docker Hub

Using Kali Docker Images

Grab the latest rolling docker image with

sudo docker pull docker.io/kalilinux/kali-rolling
image

Followed by

sudo docker run -it kalilinux/kali-rolling

NOTE: all the images do not come with the β€œdefault” metapackage. You will need to run:

apt update && apt upgrade -y

Installing tools

It’s pretty simple and basic from here - run

apt install -y [tool-name]

Eg.

apt install -y nano bloodhound.py xrdp

Setting up a share

To get file sharing setup between our container and host, we need to have a directory setup for that. On our host, we make a folder wherever we want. Create a quick file in that directory so we can verify the share is working after we run it.

Now when running our Kali image with these parameters:

sudo docker run -v /home/th4ntis/Docker/Share:/home/share -it kalilinux/kali-rolling

When in our container, if we go to the /home/share directory, we can see the file we created on our host in the Share directory we made.

Getting a Graphical User Interface(GUI)

Most the tools we run in Kali will be CLI based but sometimes we may need/want a GUI. To get a gui running we need to run

sudo docker run -it -p 13389:13389 kalilinux/kali-rolling

Then we install the XFCE desktop environment with

apt install -y kali-desktop-xfce xrdp

Since we chose port 13389 for our port to forward, we need to edit the xrdp config

nano /etc/xrdp/xrdp.ini

Change the line that says

port=3389

to

port=13389

Then start the xrdp service

service xrdp start

Verify the XRDP service is running

service xrdp status

Before we start the RDP session, we need to change the root password with

passwd

Adding a new non-root user

Some tools don't play wel when running as root, so we should make a new user. To do this, we run

adduser [user]

Type in the password, then you can press ENTER when asked for full name, room number, etc.

OPTIONAL: To add the new user to the sudoers file. This will make sure the new user can permissions with as a super user.

usermod -aG sudo [user]

We can change to the newly created user with

su [user]

Making a custom image

While in your container, install all your tools, setup configs, etc. It is important to keep the container running with all your settings, tools and configs! Exit the container and keep it running with

CTRL+P CTRL+Q

Then run

sudo docker commit [container_id] [image_name]

Save the container in an image you can transfer to other machines with

sudo docker save [image_name] > [image_name].tar

Now load the image on the new machine with

sudo docker image load < [container_name].tar

Now run the new container with all of our settings

sudo docker run -it -p 13389:13389 -v /home/[user]/Docker/Share:/home/share [container_name]

I've added that as an alias in my terminal

alias kali-docker='sudo docker run -it -p 13389:13389 -v /home/th4ntis/Docker/Share:/home/share [container_name]'

Conclusion

That’s it! Now you have a nice, custom Kali docker image setup with our tools, users, settings, and configs that don’t require any setup or even an internet connection!

image
image
image
image
image
image
image

Now we can use whatever RDP service we want to access our Kali Docker via GUI using localhost:13389. I'm using Remmina, but you can use any software you choose that supports RDP. NOTE: Depending on your RDP software, you will need to choose the screen resolution you want. Otherise it will default as a 600x800 resolution.

image
image
image
image
image
image
image
πŸ“”
Docker
here
here
Kali Linux
Official Docker Images
Kali Rolling Docker Image