Build your Custom Kali Distro

Eswar Abisheak
9 min readJul 9, 2020

--

But we are HACKERS and hackers have black terminals with green font colors.
— J. Nunemaker

Rolling your own Kali Linux Custom Operating system is something every hacker should know how to do.

Should I really get into it?

  1. It helps if you build your custom OS from a version of kali if you are already using Kali Linux and have already customized your OS even better
  2. If you already have customizations you will simply be able to transfer them to the live build. !!( it’s best to do it this way )!!

Follow me, I will show you how to roll your own custom Kali OS.

Now let’s open up a terminal and get everything we need for the live build with these two commands

sudo apt update && apt upgrade -y && apt install curl git live-build cdebootstrapgit clone git://git.kali.org/live-build-config.git

Now we will take a look at what desktop we want, Gnome is default
(I will use KDE for this tutorial)

Now let’s make our way to /live-build-config/kali-config/

The kali-config directory contains directories for the most common desktop environments:

  • e17 for Enlightenment;
  • gnome for GNOME;
  • i3wm for the corresponding window manager;
  • kde for KDE;
  • lxde for LXDE;
  • mate for the Mate Desktop Environment;
  • xfce for XFCE.

Now open the chroot file with a text editor.

This is where you will include most of the programs/tools/software you want to be installed in your custom OS
(These must all be able to be installed v.i.a apt-get)

Here is an example of a “kde-variant.chroot” file that has been modified for a custom build.

# You always want those
kali-linux
kali-desktop-live

# Kali applications

# You can customize the set of Kali applications to install
# (-full is the default, -all is absolutely everything, the rest
# corresponds to various subsets)
kali-linux-full
android-sdk
cookie-cadger
routersploit
python-pil
iceweasel
firefox-esr
ffmpeg
clamtk
clamav
clamav-daemon
git
python-appindicator
python-xdg
python-pexpect
python-gconf
python-gtk2
python-glade2
synaptic
python-pip
python-pip-whl
python-ptyprocess
tor
tor-arm
tor-geoipdb
torsocks
ttf-mscorefonts-installer
conky-manager
gufw
mat
geany
gradle
mono-complete
mono-devel
mono-tools-devel
gimp
openshot
pitivi
clementine
deluge
filezilla
tickr
psi-plus
psi-plus-common
psi-plus-l10n
psi-plus-plugins
psi-plus-plugins-dbg
psi-plus-skins
psi-plus-sounds
vokoscreen
sweep
soundconverter
brasero
alsa-tools
alsa-tools-gui
alsa-utils
alsamixergui
libalsaplayer0
libreoffice
ark
leafpad
rar
rarcrack
zip
unrar
fcrackzip
unzip
unar
tar
pdfcrack
cmatrix
adb
fastboot
google-nexus-tools
plymouth
plymouth-themes


# kali-linux-all
# kali-linux-sdr
# kali-linux-gpu
# kali-linux-wireless
# kali-linux-web
# kali-linux-forensic
# kali-linux-voip
# kali-linux-pwtools
# kali-linux-top10
# kali-linux-rfid

# Graphical desktop
kali-desktop-kde

You will find that some tools and software may break your build.

No need to worry, these tools/software can be installed with what i am gonna call an “update” script.
we will create a bash script towards the end of the build
We will end up leaving this script in the desktop directory of our live build along with a ReadMe.txt file.
!!( If you are planning on installing anything that requires dependencies, those dependencies should be added to this file)!!

Now let’s move on to the /kali-config/common/ directory

If you have any .deb’s you want to be included you need to create a directory here and name it “packages”
Place all your .deb’s in the directory “packages” that you just created.

Meta-packages are empty packages whose sole purpose is to have many dependencies on other packages. They make it easier to install sets of packages that you often want to install together. The kali-meta source package builds all the meta-packages provided by Kali Linux:

  • kali-linux: the base system (it is pulled by all the other meta-packages)
  • kali-linux-full: the default Kali Linux installation
  • kali-linux-all: meta-package of all the meta-packages and other packages (almost everything that Kali provides so it is really huge!)
  • kali-linux-sdr: Software Defined Radio (SDR) tools
  • kali-linux-gpu: GPU-powered tools (tools making use of the computing power available in your graphical card)
  • kali-linux-wireless: wireless assessment and analysis tools
  • kali-linux-web: web applications assessment tools
  • kali-linux-forensic: forensic tools (finding evidence of what happened)
  • kali-linux-voip: Voice Over IP tools
  • kali-linux-pwtools: password cracking tools
  • kali-linux-top10: the ten most popular tools
  • kali-linux-rfid: RFID tools

You can leverage these meta-packages when you create custom package lists for live-build. The full list of available meta-packages and the tools they include can be found at http://tools.kali.org/kali-metapackages

They will now be included in your custom OS.

If any of these .deb files require you to run

apt-get -f install

after they are installed for them to properly install/run then you cannot include them in the “packages” directory.
They must be set aside for now (we will be leaving them in the “desktop” directory of the custom OS along with the update script I mentioned earlier.

Now we will change directory into the “/kali-config/common/includes.chroot/” directory.
Now we dive deeper into rolling our own custom Kali.

As you can see there are two directories “root” and “usr”

We will start by changing directories to the “root” directory

Now we will take a moment and make our current version of Kali
(The one we are rolling our custom Kali with)
Just the way we want it.

What I mean by this is we will now make sure all your settings are just the way you will want them on your custom Kali OS

Ask yourself these questions

1: Is the terminal themed and configured the way I like it?

2: Is this the desktop theme you want for your custom OS?

3: Are these the font settings I want?

4: Is this the login screen theme I want?

5: Am I going to use a Plymouth ? .. If so do I have the necessary files configured already? ( more info on Plymouth can be found here = https://wiki.debian.org/plymouth )

6: Will I want a custom grub?

7: Is this the grub wallpaper I want for the OS?

Make sure all these setings are configured on the system you are building the OS with (!! NOT IN THE LIVE BUILD DIRECTORY !!)

Ok .. back to the root directory of our custom kali OS.

Located here “/live-build-config/kali-config/common/includes.chroot/root/”

moving right along …

Ok … you have a “root” and a “usr” folder.
For the next step of this tutorial we will transfer files from your “home” folder to the “/live-build-config/common/includes.chroot/root” folder.
This will customize many config files on the custom OS.
We will also create all the usual home directories.

Let’s start by getting the file manager we are using to show hidden files (this is important)

Next in “/live-build-config/kali-config/common/includes.chroot/root/” we will create these directories.

 Desktop
Documents
Downloads
Music
Videos
Pictures

and any other directories you may include in your home directory.

Next we will copy those hidden folders from the “home” directory of the o.s we are building our custom on and paste them into the “/live-build-config/kali-config/common/includes.chroot/root/” directory.
The hidden directory list to copy is

 .cache
.config
.local
.kde (if you are using a different desktop i.e gnome … then .gnome instead of .kde … etc )
.conky (if using a conky)
.mozilla

and any others you may feel are necessary for your custom build.

Next we will focus on transfering the necessary directories from “usr” to “/live-build-config/kali-config/common/includes.chroot/usr/”

This will be broken down into a few parts.

We will be copying files from our “/usr/share/” directory to “/live-build-config/kali-config/common/includes.chroot/usr/share/”

Depending on your build your list may vary from the example i am giving for this tutorial.
Keep this in mind.

The list to copy is

applications
chromium
cli-common
color
color-schemes
conky-manager
console-setup
firefox-esr
fonts
grub
images/desktop-base/ (this is where the default wallpaper, lockscreen, and grub are located)

If you choose to customize your default wallpaper, lock screen, and grub you will need to replace the .png files in “/usr/share/images/desktop-base/” with wallpapers you want to use.
(Make sure they are all the same size and name)
The easiest way i found to do this is by using gimp to resize and replace the files while keeping the file names the same.
Next on the list of directories to be copied and pasted from “/usr/share/” to “/live-build-config/common/includes.chroot/usr/share/”

kali-defaults
kali-menu
kali-root-login
kde4
kdisplay
konsole
kstyle
menu
mozilla
plasma
plymouth (I will take a moment to further discuss this now)

If you choose to go with having a Plymouth you must create “/live-build-config/kali-config/common/includes.chroot/etc/initramfs-tools/”
You will need to copy and paste “etc/initramfs-tools/modules” into “/live-build-config/kali-config/common/includes.chroot/etc/initramfs-tools/”

You will also need to create “/live-build-config/kali-config/common/includes.chroot/etc/default/”
As you will need to copy and paste “/etc/default/grub” into “/live-build-config/kali-config/common/includes.chroot/etc/default/”

It’s also best to include setting the Plymouth and updating the grub in the update script we will discuss later in this tutorial.


Ok back to the list of directories we are copying and pasting into”/live-build-config/kali-config/common/includes.chroot/usr/share/”

sddm
themes
wallpapers (This can be customized also, just "add/delete" whatever wallpapers you want)

Next we will create “/live-build-config/kali-config/common/includes.chroot/etc/”
We will be copying and pasting directories from “/etc” to “/live-build-config/kali-config/common/includes.chroot/etc/”
The list is as follows:

chromuim.d
console-setup
default
firefox-esr
iceweasel
menu
menu-methods
plymouth
sddm
tor

Now we will create the diectory “/live-build-config/kali-config/common/includes.chroot/opt/”
This is where we put all the extra tools
If you are already doing this on the system you are building this custom OS on !great! that will makes things easy.Simply copy the tool directories in your “/opt” directory to “/live-build-config/kali-config/common/includes.chroot/opt/”
Your desktop icons and launchers will already show up in the menu of the custom OS.
If not now place the extra tools you want your custom OS to have in “/live-build-config/kali-config/common/includes.chroot/opt/” and create desktop files for the menu and place them in “/live-build-config/kali-config/common/includes.chroot/usr/share/applications/”

If any of those tools had install.sh scripts that had to be executed to install them you will have to add all those scripts to the update script we will talk about soon enough.
This helps to cut down on an already big custom Kali OS.
Some tools download dependencies the first time you run them like “android studio”
If you are planning on adding these types of tools YOU MUST DOWNLOAD A NEW COPY, UNZIP AND USE THAT so when you run it the first time on your custom OS it will download all dependencies as needed and work properly.


Ok before we go any further ask yourself this …

Do I want my custom Kali OS to have an anonymous-mode?

If your answer is yes here is the link

https://forums.kali.org/showthread.php?24110-how-to-install-backbox-anonymous-in-kali-(other-Linux-OS)

Now copy and paste all necessary files into the proper directories within “/live-build-config/kali-config/common/includes.chroot/”
so anonymous-mode works properly on the custom Kali OS.

Next, I will discuss customizing the live OS grub screen

To customize the custom Kali Live OS grub we simply replace this picture “/live-build-config/kali-config/common/bootloaders/grub-pc/splash.png”
And this picture as well “/live-build-config/kali/config/common/includes.binary/isolinux/splash.png”

Replace those two pictures with the grub picture you want to use.
Like I stated earlier gimp is a great way to do this (remember to keep the picture name the same “splash.png”)


We will now talk about “live-build-config/kali-config/common/includes.chroot/root/Desktop/” directory and what we will leave in there.
First, we should put a “README.txt” in that directory explaining a little about the system and what the install script does.
Things like this

For all post-install configurations and dependencies and tool installs you will need to write a bash script to do all this and leave in the “live-build-config/kali-config/common/includes.chroot/root/Desktop/” directory
You can also have this script add the bleeding edge repos before it runs an update and upgrades.
more on bleeding edge repos can be found here

Finally, we are just about finished

These are the different Desktop Environment build options:

./build.sh - distrubution kali-rolling - varant {gnome,kde,xfce,mate,e17,lxde,i3wm} - verbose

to build a KDE ISO

./build.sh - distribution kali rolling - varant kde - verbose

and so on ….

Well, that’s it… grab some coffee it’s going to be a while.

visit my Github for scripts which can be used to create custom distros

--

--

Eswar Abisheak
Eswar Abisheak

Written by Eswar Abisheak

DSCVIIT lead || https://eswar.dev || HTB player || Competitive Coding

Responses (1)