OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

9.5.1. Summary Tips for Modifying Kali Packages‌


Modifying Kali packages is usually a task for Kali contributors and developers, but you might have specific needs not fulfilled by the official packages and knowing how to build a modified package can be very valuable, especially if you want to share your changes, deploy them internally, or cleanly roll the software back to a previous state.

When you need to modify a piece of software, it might be tempting to download the source, make the changes, and use the modified software. However, if your application requires a system-wide setup (e.g. with a make install step), then it will pollute your file system with files unknown to dpkg and will soon create problems that cannot be caught by package dependencies. In addition, this type of software modification is more tedious to share.

When creating a modified package, the general process is always the same: grab the source pack- age, extract it, make your changes, and then build the package. For each step, there are often multiple tools that can handle each task.

To start rebuilding a Kali package, first download the source package, which is composed of a

*.dsc (Debian Source Control) file and of additional files referenced from that control file.

Source packages are stored on HTTP-accessible mirrors. The most efficient way to obtain them is with apt source source-package-name, which requires that you add a deb-src line to the /etc/ apt/sources.list file and update the index files with apt update.

Additionally, you can use dget (from the devscripts package) to download a .dsc file directly together with its accompanying files. For Kali-specific packages whose sources are hosted in a Git repository on gitlab.com/kalilinux/packages10, you can retrieve the sources with git clone https://gitlab.com/kalilinux/packages/source-package.git.

After downloading sources, install the packages listed in the source package’s build dependencies with sudo apt build-dep ./. This command must be run from the package’s source directory.

Updates to a source package consist of a combination of some of the following steps:


• The required first step is changing the version number to distinguish your package from the original with dch --local version-identifier, or modify other package details with dch.

• Applying a patch with patch -p1 < patch-file or modifying quilt’s patch series.

• Tweaking build options, usually found in the package’s debian/rules file, or other files in the debian/ directory.

After modifying a source package, you can build the binary package with dpkg-buildpackage

-us -uc -b from the source directory, which will generate an unsigned binary package. The pack- age can then be installed with dpkg -i package-name_version_arch.deb.


Top OS Cloud Computing at OnWorks: