Blog: How Tos

Copycat Kali, with mykali for Kali Linux

Robert Bone 07 Aug 2018

If you’re anything like me, you like to customise your environment quite a bit. I do most of my work from a Kali Linux VM which has had a plethora of changes made to it. I like to use i3 instead of gnome, I’ve a ton of git repositories cloned, packages installed, custom configuration files and more. I used to find I’d be terrified of my VM dying, and setting things up on a new PC would be a real pain unless I copied things over.

To solve this problem, we wrote mykali. mykali is primarily a tool that will allow you to create a configuration, either from scratch of based off an existing installation, and apply that to a fresh install of Kali Linux.

As an added bonus, it can also be used to update Kali Linux and anything else in the configuration file, including pulling and building git repositories.

The idea behind mykali is simple. You have a config.json file which contains everything that needs to be done on the new system. This includes install apt packages, pip installs, cloning and setting up git repositories, copying over config files such as .vimrc and .zshrc and custom commands for full flexibility.

An example

An example config.json file is below:


Running mykali.py −−run with the above config will perform the following actions:

  1. Update the /etc/apt/sources.list file with the Kali Linux repository. This is because this repository is not present if installed straight from installation media such as a CD.
  2. Do a full update and upgrade of Kali using apt.
  3. Install VMware tools on the guest.
  4. Install the user defined apt packages.
  5. Install the user defined pip packages.
  6. Run the user defined custom commands.
  7. Clone the defined git repositories under /opt, and run any install commands for those repositories.
  8. Copy the config files from the cloned /opt/configfiles repository to the specified locations.

This will take you from a fresh-off-the-press install of Kali to a customised build with all the tools and configurations that you’re used to with minimal effort.

Doing the hard work for you

If you’re thinking “damn, that looks cool but I really can’t be bothered creating a file like that” then fear not! We’re way ahead of you. You can create a config.json file using mykali on an existing installation using mykali.py −−make. This option will prompt the user with a few questions (such as where you like to store your git repositories), and then generate a config.json with those repositories, plus any manually installed apt and pip packages.

You’ll still have to add any custom commands and config files, but the hard work should be done!

Updating Kali

mykali can also be used to update the current install of Kali Linux. Running mykali.py −−update will do a full update and upgrade using apt, plus update pip and then iterate over the configured git repositories and do a git pull. If there have been changes, it will then run any defined install commands for that repository, making it super easy to stay up to date.

Feedback

That’s it for mykali, but if you encounter any issues or have any feedback or suggestions, don’t hesitate to contact me on Twitter @m0rv4i or create an issue on the Github page! Finally, and as always, pull requests are welcome!