In an earlier post, we covered Package Management in Kali Linux. With the ease of installation that APT provides, we have the choice amongst tens of thousands of packages but the downside is, we have tens of thousands of packages. Finding out what packages are available and finding the one(s) we want can be a daunting task, particularly for newcomers to Linux. In this post, we will cover three utilities that can be used to search through the haystack and help you take advantage of the vast Open-source ecosystem.
Of the various interfaces available to search for packages, apt-cache is the most basic and rudimentary of them all. However, it is also the interface we tend to use most often because it is fast, easy, and efficient. By default, apt-cache searches for a given term in package names as well as their descriptions. For example, knowing that all Kali Linux metapackages include ‘kali-linux’ in their names, we can easily search for all of them.
root@kali:~# apt-cache search kali-linux kali-linux - Kali Linux base system kali-linux-all - Kali Linux - all packages kali-linux-forensic - Kali Linux forensic tools kali-linux-full - Kali Linux complete system kali-linux-gpu - Kali Linux GPU tools kali-linux-nethunter - Kali NetHunter tools kali-linux-pwtools - Kali Linux password cracking tools kali-linux-rfid - Kali Linux RFID tools kali-linux-sdr - Kali Linux SDR tools kali-linux-top10 - Kali Linux Top 10 tools kali-linux-voip - Kali Linux VoIP tools kali-linux-web - Kali Linux webapp assessment tools kali-linux-wireless - Kali Linux wireless tools
In many cases, apt-cache returns far too many results because it searches in package descriptions. The searches can be limited to the package names themselves by using the –names-only option.
root@kali:~# apt-cache search nmap | wc -l 37 root@kali:~# apt-cache search nmap --names-only dnmap - Distributed nmap framework fruitywifi-module-nmap - nmap module for fruitywifi nmap-dbgsym - debug symbols for nmap python-libnmap - Python 2 NMAP library python-libnmap-doc - Python NMAP Library (common documentation) python3-libnmap - Python 3 NMAP library libnmap-parser-perl - parse nmap scan results with perl nmap - The Network Mapper nmap-common - Architecture independent files for nmap zenmap - The Network Mapper Front End nmapsi4 - graphical interface to nmap, the network scanner python-nmap - Python interface to the Nmap port scanner python3-nmap - Python3 interface to the Nmap port scanner
Since apt-cache has such wonderfully greppable output, we can keep filtering results until they’re at a manageable number.
root@kali:~# apt-cache search nmap --names-only | egrep -v '(python|perl)' dnmap - Distributed nmap framework fruitywifi-module-nmap - nmap module for fruitywifi nmap - The Network Mapper nmap-common - Architecture independent files for nmap nmap-dbgsym - debug symbols for nmap nmapsi4 - graphical interface to nmap, the network scanner zenmap - The Network Mapper Front End
You can further filter down the search results but once you start chaining together a few commands, that’s generally a good indication that it’s time to reach for a different tool.
The aptitude application is a very close cousin of apt and apt-get except it also includes a very useful ncurses interface. It is not included in Kali by default but it can quickly be installed as follows.
root@kali:~# apt update && apt -y install aptitude
After installation, running aptitude without any options will launch the ncurses interface. One of the first things you will notice is that you can quickly and easily browse through packages by category, which greatly helps with sorting through the thousands of available packages.
To search for a package, either press the / character or select ‘Find’ under the ‘Search’ menu. As you enter your query, the package results will be updated dynamically.
Once you’ve located a package of interest, you can mark it for installation with the + character or to remove/deselect it, the – character.
At this point, you can keep searching for other packages to mark for installation or removal. When you’re ready to install, press the g key to view the summary of the actions to be taken.
If you’re satisfied with the proposed changes, press g again and aptitude will complete the package installations as usual.
If you want to restrict your searches to tools that are packaged by the Kali team, the easiest way to do so is probably by using the Google site search operator.
Hopefully, this post will help you answer whether or not a certain tool is available in Kali (or Debian). For a much more detailed treatment of package management, we encourage you to check out the Kali Training site.