Introduction to build BackBox package
Before starting package building, a quick reading of “Modifying BackBox packages” is needed.
Here the steps needed to prepare BackBox.
Enable the repository and install the dependencies:
backbox@backbox:~$ sudo -s root@backbox:~# echo "deb-src http://ppa.launchpad.net/backbox/two/ubuntu natty main" >> /etc/apt/sources.list.d/backbox-two-natty.list root@backbox:~# apt-get update && apt-get install devscripts debhelper root@backbox:~# exit
We will take NetCommander as example to work on, a useful python tool for arp spoofing attacks.
The first step is to download the tar.gz archive from the official site and unpack it on local drive:
backbox@backbox:~$ tar xfz backbox-NetCommander-b690fb3.tar.gz
Rename the folder as follow: <packetname>-<version>
backbox@backbox:~$ mv backbox-NetCommander-b690fb3 netcmd-1.2
Remove the unnecessary files:
backbox@backbox:~$ rm netcmd-1.2/.gitignore
Regenerate the archive by paying attention to the standard name structure:<packetname>_<version>.orig.tar.gz
backbox@backbox:~$ tar cfz netcmd_1.2.orig.tar.gz netcmd-1.2
Now an example package is needed, from this package it’s possible to copy the “debian” directory to be inserted in our folder. To make it easier, we will download the source code of netcmd and will analyze every single file.
backbox@backbox:/tmp$ apt-get source netcmd backbox@backbox:/tmp$ cp -r netcmd-1.2/debian/ ~/netcmd-1.2/ backbox@backbox:/tmp$ cd ~/netcmd-1.2/ backbox@backbox:~/netcmd-1.2$ cd debian
total 40 drwxr-xr-x 2 backbox backbox 4096 2011-05-13 14:53 . drwxr-xr-x 3 backbox backbox 4096 2011-05-13 14:53 .. -rw-r--r-- 1 backbox backbox 166 2011-05-13 14:53 backbox-netcmd.desktop -rw-r--r-- 1 backbox backbox 146 2011-05-13 14:53 changelog -rw-r--r-- 1 backbox backbox 2 2011-05-13 14:53 compat -rw-r--r-- 1 backbox backbox 410 2011-05-13 14:53 control -rw-r--r-- 1 backbox backbox 1029 2011-05-13 14:53 copyright -rw-r--r-- 1 backbox backbox 80 2011-05-13 14:53 install -rw-r--r-- 1 backbox backbox 114 2011-05-13 14:53 links -rwxr-xr-x 1 backbox backbox 442 2011-05-13 14:53 rules
The backbox-netcmd.desktop file is the menu file, to modify the content of this file it needs to be renamed.
backbox@backbox:~/netcmd-1.2/debian/$ mv backbox-netcmd.desktop backbox-name-of-packet.desktop backbox@backbox:~/netcmd-1.2/debian/$ cat backbox-name-of-packet.desktop [Desktop Entry] Type=Application Name=netcmd Exec=sh -c "sudo netcmd -h; bash" Icon=utilities-terminal Terminal=true Categories=BackBox-PrivilegeEscalation-Spoofing;
The changelog file contains information used by Launchpad to create the package, more in details it contains the version number and your name.
Pay close attention to the first row:
netcmd (1.2-0backbox1) natty; urgency=high
The text in brackets must keep the structure <version>-<revision>, the following part is useful for updating packet without modifying the version number.
The control file, on the other hand, contains other useful informations like: package name, description, dependencies, etc. Be careful in modifying this file:
Source: netcmd Section: net Priority: optional Maintainer: Simone Margaritelli <evilsocket@gmail.com> Build-Depends: debhelper (>= 7) Standards-Version: 3.8.4 Homepage: https://github.com/evilsocket/NetCommander
Package: netcmd Architecture: all Depends: ${misc:Depends}, python, python-scapy Description: NetCommander - An easy to use arp spoofing tool. NetCommander - An easy to use arp spoofing tool.
The install and links files contain, respectively, info on correct program installation system directory and symbolic links:
backbox@backbox:/tmp$ cat netcmd-1.2/debian/install netcmd.py usr/share/netcmd debian/backbox-netcmd.desktop usr/share/applications backbox@backbox:/tmp$ cat netcmd-1.2/debian/links
usr/share/netcmd/netcmd.py usr/bin/netcmd usr/share/netcmd/netcmd.py backbox/privilege_escalation/spoofing/netcmd
The remaining files are compat and rules, this files can be left as they are.
The author name who built the package can be inserted in copyright file.
Before creating the new debian package, check again if all files have been modified with the correct information.
Once we are ready we can build the package as follow:
backbox@backbox:~$ cd netcmd-1.2 backbox@backbox:~/netcmd-1.2$ debuild binary
Alternatively, one can create the debian source and upload to Launchpad repository:
backbox@backbox:~/netcmd-1.2$ debuild clean backbox@backbox:~/netcmd-1.2$ debuild -S backbox@backbox:~/netcmd-1.2$ cd .. backbox@backbox:~$ dput ppa:user/ppa-name netcmd-1.2-0backbox1_source.changes