Friday, September 24, 2010

Lab 3: Building Aircrack-ng RPM from Source

Intro:
This lab focuses on grabbing a source rpm of any Linux command line application (in this case I chose to work with Aircrack-NG). The platform I will be working on is Fedora 13 x86_64.

Aircrack-ng is a set of tools to retrieve and manipulate the 802.11 WEP and WPA-PSK protocol packets in order to test your network for security (or gain unauthorized access).

Preparation:
Install rpm developer tools needed to prepare and build the final .rpm files.
$ yum install rpmdevtools

Setup the correct directory structure using rpmdev-setuptree. Running this command directly will create a folder called rpmbuild in your home directory.
$ rpm-setuptree
$ ll
total 24
drwxrwxr-x. 3 bccp32 bccp32 4096 Sep 24 08:49 BUILD
drwxr-xr-x. 2 bccp32 bccp32 4096 Sep 24 08:49 BUILDROOT
drwxrwxr-x. 3 bccp32 bccp32 4096 Sep 24 08:49 RPMS
drwxrwxr-x. 3 bccp32 bccp32 4096 Sep 24 08:46 SOURCES
drwxrwxr-x. 2 bccp32 bccp32 4096 Sep 24 04:38 SPECS
drwxrwxr-x. 2 bccp32 bccp32 4096 Sep 24 08:49 SRPMS


Download and install the source rpm of aircrack
$ yumdownloader --source aircrack-ng
$ rpm -i aircrack-ng-*.src.rpm

Unpack the source tarball located in the ~/rpmbuild/SOURCES
$ cd ~/rpmbuild/SOURCES
$ tar zxvf aircrack-ng-1.0.tar.gz
$
$ ll *       # Checks the untarred files
-rw-r--r--. 1 bccp32 bccp32 433 Sep 16 2009 aircrack-ng-1.0-define.patch
-rw-r--r--. 1 bccp32 bccp32 1147 Sep 16 2009 aircrack-ng-1.0-oui-path.patch
-rw-rw-r--. 1 bccp32 bccp32 1506412 Sep 16 2009 aircrack-ng-1.0.tar.gz
-rw-r--r--. 1 bccp32 bccp32 396 Feb 24 2009 aircrack-ng-parallel_make.patch


aircrack-ng-1.0:
total 128
-rwxrwxr-x. 1 bccp32 bccp32 44 Feb 26 2008 AUTHORS
-rwxrwxr-x. 1 bccp32 bccp32 39046 Sep 7 2009 ChangeLog
-rwxrwxr-x. 1 bccp32 bccp32 1604 Sep 1 2009 common.mak
-rwxrwxr-x. 1 bccp32 bccp32 442 Sep 21 2008 evalrev
-rwxrwxr-x. 1 bccp32 bccp32 2183 Sep 1 2009 INSTALLING
-rwxrwxr-x. 1 bccp32 bccp32 18011 Feb 26 2008 LICENSE
-rwxrwxr-x. 1 bccp32 bccp32 6279 Feb 26 2008 LICENSE.OpenSSL
-rwxrwxr-x. 1 bccp32 bccp32 1009 Jul 24 2009 Makefile
drwxrwxr-x. 2 bccp32 bccp32 4096 Sep 1 2009 manpages
drwxrwxr-x. 2 bccp32 bccp32 4096 Sep 1 2009 packages
-rwxrwxr-x. 1 bccp32 bccp32 3147 Feb 26 2008 patchchk
drwxrwxr-x. 3 bccp32 bccp32 4096 Sep 1 2009 patches
-rwxrwxr-x. 1 bccp32 bccp32 5160 Sep 1 2009 README
drwxrwxr-x. 4 bccp32 bccp32 4096 Sep 7 2009 scripts
drwxrwxr-x. 4 bccp32 bccp32 4096 Sep 1 2009 src
drwxrwxr-x. 2 bccp32 bccp32 4096 Sep 1 2009 test
-rwxrwxr-x. 1 bccp32 bccp32 3 Sep 1 2009 VERSION


$ cd ../SPECS
$ less *.spec
# To check for build dependencies. Look for the line that starts with BuildRequires. This will tell you what packages you need in order to build aircrack-ng
BuildRequires: sqlite-devel openssl-devel

Install the dependencies:

$ yum install openssl-devel sqlite-devel 


Building the rpm:

$ # Compile and build the rpm
$ rpmbuild -ba aircrack-ng.spec


At the end of the build you should see this (if everything worked without errors):
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/bash /bin/sh /usr/bin/env libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.7)(64bit) libcrypto.so.10()(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit) libsqlite3.so.0()(64bit) libssl.so.10()(64bit) libz.so.1()(64bit) rtld(GNU_HASH)
Processing files: aircrack-ng-debuginfo-1.0-1.fc13.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/bccp32/rpmbuild/BUILDROOT/aircrack-ng-1.0-1.fc13.x86_64
Wrote: /home/bccp32/rpmbuild/SRPMS/aircrack-ng-1.0-1.fc13.src.rpm
Wrote: /home/bccp32/rpmbuild/RPMS/x86_64/aircrack-ng-1.0-1.fc13.x86_64.rpm
Wrote: /home/bccp32/rpmbuild/RPMS/x86_64/aircrack-ng-debuginfo-1.0-1.fc13.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.W7eTpm
+ umask 022
+ cd /home/bccp32/rpmbuild/BUILD
+ cd aircrack-ng-1.0
+ rm -rf /home/bccp32/rpmbuild/BUILDROOT/aircrack-ng-1.0-1.fc13.x86_64
+ exit 0



The final rpm files will be located in the ~/rpmbuild/RPMS/* directory
$ ls ~/rpmbuild/RPMS/*
aircrack-ng-1.0-1.fc13.x86_64.rpm aircrack-ng-debuginfo-1.0-1.fc13.x86_64.rpm


Comments:
This was a straight forward build with only 2 dependencies. Enjoy the final product!

No comments:

Post a Comment