When I set up a new Kali VM I'll create some lists of all the packages and tools that were installed on the previous VM just in case there is something I forgot about that I might want to use again or I want to know what version of a tool I was using because I may want to keep using the same version. It can be hard to remember how a tool was installed, like with dpkg, apt, pip3 or even pip so I'll create a list for each of them.
First I usually make a directory to hold the files.
mkdir installed_packages
cd installed_packages
dpkg
piped into a couple other commands will give you a clean list.
dpkg --get-selections | grep -v deinstall | cut -f 1 > dpkg.txt
apt
list will give you the same list of packages as dpkg
. This will also have all the versions.
apt list --installed > apt_list.txt
pip3
freeze will give you all the python 3 packages.
pip3 freeze > pip3_freeze.txt
pip
freeze will give you all the python 2 packages, which probably are not that many these days and possibly none that I installed.
pip freeze > pip_freeze.txt
Then there is the /opt
directory where a lot of packages can be installed. This command will give you a list of all the directories inside /opt
. Usually all the directories in this directory are packages, cloned git repositories or something. This command won't work in fish so if you use fish shell you'll either have to modify it or switch over to zsh. I usually just switch to zsh to run this command which is what comes with Kali.
for d in ./*; do [[ -d "$d" ]] && echo "${d##./}" >> opt.txt; done
Then I can copy the lists over to the new Kali VM and refer to them whenever I need to.