giovedì 17 gennaio 2013

Aircrack with monitor mode on android - Part 2: Setup an ARM Development environment

(This post is a work in progress, please come back later)

We need to setup a linux machine to compile our arm kernel and modules,
in order to do this I've opted to make a linux virtual machine.
There are various reasons why a virtual machine is preferred vs the linux box I'm using daily,
first of all a development box can break quite easily,
you'll be using a lot of tools which depends on libraries that can get updated and break things,
also you need to have some specific versions of some apps for compatibility reasons
and it is not a good idea to browse the web using old apps as they can be remotely exploited,
so it is a good idea to have a separate box where you have total control on what you update and what not.
Also, by having a linux virtual machine you can easily transfer the virtual hard disk image on another computer
and continue your development like nothing has happened or share the virtual machine between windows and linux,
it also allows for easy backups, you can just make a copy of the virtual hard disk, try something and if it breaks, no problem,
just restore the backup file. so win win!

Setup the virtual machine
Go to and download the latest available version for your host os, download the Extension Pack too and install both.
We'll be using lubuntu 12.10 as our linux guest machine, as it is a good starting point for what we need, also by using lxde it is lightweight to run inside a virtual machine,
so go to and download the (Intel x86) desktop CD image,
once you have the iso, create a new virtualbox machine.
I won't go into much detail here as there are a lot of resources about this, just make sure to enable PAE into system tab.
When the installation process finishes and you're asked to reboot, click ok, eventually the virtual machine may hang up at this point,
just wait a minute then turn off the virtual macchine, start again and boot your new lubuntu box,
on your first login you'll be asked to update some packages, do it right away,
we need an up-to-date installation as we'll need various tools and by having a stable, current release, any tool we need is just an apt-get install away,
once we're happy with our environment we may froze the current software so we'll be sure not to occur into compatibility issues and we'll selectively update
things from now and then.
Once you've updated everything head over to install Guest Addition and reboot the virtual machine.
we need now to setup our arm development environment!

Setup the development environment
Thanks to AMLogic effort to release kernel sources and info on how to compile the kernel,
we can setup or arm development environment for amlogic boards.
First of all we need to setup a standard development environment so open a terminal, and install a dev env using this:
$ sudo apt-get install build-essential
this will install gcc, make and some standard libs

Share files between host os, guest os and android device
We'll need to transfer a lot of files between host os, guest os and the android device,
there are many ways to do this, I've chosen to setup an ftp server on the guest os and to make it available
on the internal network so it can be accesses by both the host os and the android device.
Download and setup vsftpd, on the guest os (the arm dev machine) do:
$ sudo apt-get install vsftpd
this will install vsftpd. by default write access is disabled so if you try to upload a file
you'll get this error message:
200 PORT command successful. Consider using PASV.
550 Permission denied.
to allow write access, edit /etc/vsftpd.conf and find this line:
# Uncomment this to enable any form of FTP write command.
uncomment the line above, you may also want to further customize the ftp server by disabling anonymous logins 
and so on, when you're happy with the config, save and restart vsftpd by using
$ sudo service vsftpd restart
now you can login to your ftp server and upload/download files.

Download, configure and install some tools
create the dir tools on your home, here we'll download and compile some tools.
binwalk a firmware analysis tool
get the latest version of binwalk from ,
libwalk needs some libraries like libmagic and libcurl so
configure & sudo make install libmagic.
install libcurl by sudo apt-get install libcurl4-gnutls-dev
now for binwalk, extract the file, go to src and ./configure
it should now find everything it needs, if you miss some packages then download the dependencies
(if you've followed this from the start, you should how have everything it needs)
then sudo make install
voilà we now have binwalk and we can analyze the boot image of our device, this way we can gather
info on where the kernel is addressed inside the boot image
(This post is a work in progress, please come back later)

Nessun commento:

Posta un commento

Creative Commons License
Questo/a opera è pubblicato sotto una Licenza Creative Commons.