[GUIDE] Use aircrack-ng on android phone using Wireless USB Adapter

Search This thread

Ante241

Senior Member
Dec 9, 2012
63
10
Split
Is there any progress on this?I had sgs plus before s4 and I had backtrack on it, it did not recognized my alfa card even tough I used OTG cable with powerbank and I did not know how to instal drivers..I use backtrack on my laptop for you know what khm khm and now when I got S4 I would like to have BT on it..
I am not so good with programing and linux so if I remember I had my i9001 rooted and on CM for backtrack to work..
My question is- what do I have to do to make it work properly on s4?
That whole list on page 1 does not make sense to me a lot.. :(
I have SGS4 and alfa awus036h wifi card and dlink usb wifi stick..
 

alex_59

New member
Mar 23, 2014
1
0
OTG capacibilty

Hi,

Thanks for the guide, it's very useful.
I've been trying to make this work on an i9195 (Samsung Galaxy S4 mini LTE).

I've managed to compile a kernel (from samsung source) without much problem, it works perfectly.

However, I've been unable to make my Wifi dongle (driver is rt73usb, just like you I guess) function at all.

I tought it would be a good idea to activate USB host capabilities in kernel config, and USB mass storage device to test my device USB host capability but it didn't work at all (my USB key seems to be unpowered).

Assuming that : if the driver loads with the kernel, I should be able to see the new wlan interface, even if the .bin is at the wrong location, I think my problem relies in the OTG capability of my new kernel.

Could someone please give extra details on OTG modules I should try with menuconfig ?

Thanks
Alex
 

NIK510

Member
Apr 11, 2014
5
2
abootimg -x boot.img
boot.img: no Android Magic Value
boot.img: not a valid Android Boot Image.
this happens when i try to extract files from boot.img(CM 10.2 Samsung Galaxy Player 4.0). i need to to put zImage, can smb help me?
 

userdsp

Senior Member
Jul 5, 2013
51
7
I'ts here anyone with succsessiful builded kernel fon N9005?

Sent from my SM-N9005 using Tapatalk 2
 

miromeir

Member
Apr 4, 2011
16
8
For those who get "Package not available" or 404 [Not Found when apt-get install

Relevant for 2015 -
The image in complete linux installer is a relatively old version,
I struggled with getting "sudo apt-get install ............." to work.
All i got was "Package Not Available" or "404 - Not Found".

The reason: packages were moved to the old-release Ubuntu archive,
and do not exist in the location specified in image.

Solution:
Update your sources.list file: go to /etc/apt
Edit the file sources.list - Remove everything and instead put the following:

(** i am forbidden from posting links due to spam prevention with new users, REPLACE ******* WITH "Http" TO MAKE LINKS WORK)

Code:
deb *******old-releases.ubuntu.com/ubuntu/ saucy universe
deb-src *******old-releases.ubuntu.com/ubuntu/ saucy universe
deb *******old-releases.ubuntu.com/ubuntu saucy-updates universe
deb-src *******old-releases.ubuntu.com/ubuntu/ saucy-updates universe
deb *******old-releases.ubuntu.com/ubuntu saucy-backports universe
deb *******old-releases.ubuntu.com/ubuntu/ saucy main
deb-src *******old-releases.ubuntu.com/ubuntu/ saucy main
deb *******old-releases.ubuntu.com/ubuntu saucy-updates main
deb-src *******old-releases.ubuntu.com/ubuntu/ saucy-updates main
deb *******old-releases.ubuntu.com/ubuntu saucy-backports main
deb-src *******old-releases.ubuntu.com/ubuntu saucy-backports main
deb *******old-releases.ubuntu.com/ubuntu saucy-proposed main
deb-src *******old-releases.ubuntu.com/ubuntu saucy-proposed main
deb *******old-releases.ubuntu.com/ubuntu saucy-proposed universe

Hope it helps. good luck
 
Last edited:

dfsfdshetr

New member
Jun 23, 2015
1
0
can someone please compile a kernel for SAMSUNG GALAXY S4 GT-I9505
any rom
i just need the kernel please :confused:
 

notcre4tive

New member
Jul 27, 2015
3
0
error

i wanted to compile a kernel to use aircrack and followed the instructions. But on the step B8 i get this error when typing "make":
Code:
make: /opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc: command not found
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
/bin/sh: 1: /opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc: not found
/home/user/Downloads/ArchiKernel-smdk4412/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 127
Makefile:1218: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
i cant find a solution for this and hope you can help me.
thanks in advance
notcre4tive
 
Mar 26, 2014
8
0
I have xiaomi redmi note 4g and i want to enable monitor mode. Any advice for which wireless adaptor to use and how to make that work.????
 

umangs544

Member
Mar 29, 2016
7
1
Can you please develop the kernel for Micromax Canvas HD (A116) running Mystic OS.

I have a Wayona WiFi Adapter.
 

Knightofrepublic

Senior Member
May 11, 2014
95
10
Hey @argentux ,that was some insane work man,i cant thank you enough ,btw if you have some further tips on optimizing kernel/adding more features , please bestow the light on uneducated ones like us
 

REtails

Member
Aug 9, 2016
47
28
Boston
@op thank you so incredibly much for this guide!! This information is surprisingly scarce on the internet and you have saved me hours of work so truly, thank you!

Can i do this on windows 7 pc instead of linux or ubuntu or just using android

You can, using virtual machine software. I would try either Oracle VM VirtualBox or VMWare Workstation. Most people seem to prefer the latter, although both have their merits. You can then install linux (or multitudes of other operating systems) in virtual machine within your Windows installation, like so. I for example complete most linux tasks on my Windows PC with a VMWare installation of Kali Linux, which I have expanded with android development software. As long as what you are doing doesn't require maximum hardware efficiency (the VM is always sharing with/linked to the Windows environment) then there is often little reason to go through the hassle of installing a second-boot installation of linux on your machine.
 
Last edited:
  • Like
Reactions: hasanfares
Y

yudhajitn

Guest
Hi, so far I have a rom with common routines for ieee 802.11 drivers, generic networking stack (mac802.11) and drivers for ralink and realtek chipsets, now my question is what do I do inside the chrooted debian? I tried coyping rt3070.bin to system/vendor/firmware but my rt3070 adapter doesn't work. If I do ifconfig - its there and I can see it in the dmesg, but I can't bring it up. Or use it for that matter. I have also tried copying additional driver files such as rt2800usb.ko to system/lib/modules but that didn't do anything either. Can someone please help? I have a galaxy tab 2 7.0 gtp3110, and I'm using a self compiled 6.0 rom.
 

t.vanhuong

New member
Aug 26, 2017
2
0
Anyone build kernel for me, please

I have tp-link wn722n wireless usb and galaxy s7 sm-g930u. I am noob. So i need everyone help me build kernel for my phone. Thanks
 

mshroomz

New member
Mar 24, 2013
2
0
I have just one question I'm on a non rooted Verizon note 5. Do you absolutely have to have a rooted phone to get aircrack to work? Can you change kernels without root? Already have everything I need my adapter and my compatible usb wireless adapter thanks.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 23
    Hey everyone,

    It is possible to use an external Wi-Fi adapter with an android phone to run aircrack-ng, however I've had a lot of difficulties doing so. Here is a tutorial to make it easier for you.

    The theory

    Running the aircrack-ng suite itself is not much of a problem, as android is pretty much like ubuntu. The most difficult part of running aircrack is that the wifi chipsets of most phones do not support "monitor mode". This mode is required to capture any information from the air, not just the ones for your computer, and is therefore necessary for aircrack (airmon-ng). First of all, you should Google if your phone's wifi chipset supports this mode. If it does, find out how. If it doesn't, you can follow this guide and use a usb wifi stick.

    Android is linux, and uses a linux kernel. The easiest way to get the driver for our WiFi adapter to work is to rebuild the android kernel with the driver built-in. We can then flash the new kernel to the phone, and copy the firmware binary. This tutorial uses CyanogenMod, because it is a well documented, open-source ROM. With some adjustments you can use the same method on other ROMs. If you do not have experience building a linux kernel, it is best to stick to this guide and use CyanogenMod.

    What you'll need:
    - Android phone
    - Computer with Ubuntu (or other linux distribution)
    - USB OTG Adapter (micro usb to usb female)
    - Wireless USB Adapter
    - Time and patience

    I am using my Samsung Galaxy S4 GT-i9505 and an Eminent EM4454 Wireless USB adapter using the rt73 driver, but I am sure this will work with other devices.

    A. Install your ROM and aircrack-ng, on your phone...
    1) ...install Cyanogenmod. Don't delete the .zip download after installation.
    2) ...install "Complete Linux Installer" from Google Play and download and unpack Ubuntu in /sdcard/ubuntu/ubuntu.img as stated in the app.
    3) ...install the aircrack-ng suite in the chrooted ubuntu. On ubuntu 12.04, this cannot be done using apt-get:
    sudo apt-get install build-essential libssl-dev nano
    wget http://download.aircrack-ng.org/aircrack-ng-1.1.tar.gz
    tar -xzvf aircrack-ng-1.1.tar.gz
    cd aircrack-ng-1.1
    nano common.mak

    Then find CFLAGS ?= -g -W -Wall -Werror -O3 and remove -Werror.
    make
    sudo make install


    B. Rebuild the kernel, in a terminal on linux on your computer...
    1) ...install adb and fastboot
    sudo apt-get install adb fastboot
    2) Enable USB-debugging on your phone, connect to your computer and test the connection on linux on your computer:
    adb get-state
    3) Find the GitHub page for the cyanogenmod kernel for your device. You can find this page on cyanogenmod.org. Now download the kernel source and extract it into a folder.
    4) Change working directory into the kernel
    cd pathtothekernel
    5) See if there is a .config file. In a CyanogenMod kernel, there probably isn't. Type:
    nano .config
    If you see an empty screen, we need to get your devices current configuration:
    adb pull /proc/config.gz config.gz
    zcat config.gz > .config
    rm config.gz

    4) Make the necessary changes in the configuration file to have your USB wireless driver built in. To do so:
    make menuconfig
    Use the enter key to expand an item in the menu, and the space bar to mark a module. Make sure you mark the necessary modules with a *, not an 'M', so they will be built-in. Most wireless drivers have the mac80211 driver as a dependency. Make sure you select that one with an asterix (*), too.
    For example, for my rt73 based adapter, I did:
    Networking Support > Wireless > [*] ... (mac80211)
    Device Drivers > Network > Wireless LAB > [*] Ralink Drivers > [*] rt73usb

    5) Make some changes to fight errors:
    Still in menuconfig, make the following changes:
    Kernel Hacking > (1024) Block? size > 1032
    Now to tell gcc to build ignoring warnings edit the Makefile
    nano Makefile
    Now go down a few pages and add the line:
    KCONFIG_CFLAGS += -w
    6) The normal gcc C compiler cannot be used as it will build for your computers processor. We need to build for ARM-processors, called cross-compiling. To make the cross-compiling work you need the arm-eabi- toolchain.
    cd ~/Downloads
    git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6

    The will download the ~120Mb toolchain.
    7) Tell the Makefile where the toolchain is
    cd pathtothekernel
    export PATH=$PATH:~/Downloads/arm-eabi-4.6/bin
    export CROSS_COMPILE=arm-eabi-
    export ARCH=arm

    8) Then build the kernel. It you get errors, don't be scared and Google them. One cause of weird errors is not having enough memory; add a swapfile and try again. The building of the kernel will take quite some time:
    make

    C. Flash the new kernel to the phone
    1) When the build is finished, it has saved "zImage". This image is our kernel. For the sake of simplicity, let's copy it to the desktop but rename it so that later commands won't override it:
    cp arch/arm/boot/zImage ~/Desktop/new-zImage
    2) For flashing, we need to pack this zImage into a boot.img. Get the boot.img out of the ROM you now run on your phone. For example, the CyangonMod.zip you had to flash to your phone to install it, contains a boot.img. Most flashable .zip files have a boot.img in them. Copy this boot.img to your desktop, too.
    3) Extract the boot.img
    sudo apt-get install abootimg
    abootimg -x boot.img

    this will place 3 new files on your desktop.
    4) Delete the extracted zImage and boot.img, as we want our self-compiled kernel.
    rm zImage
    rm boot.img

    5) Edit the configuration file and remove the line with kernel-size, as our new kernel's size will be slightly larger.
    nano bootimg.cfg
    Remove the line beginning with bootsize:, which is probably the first line
    5) Use abootimg to repack new-zImage and the 2 extracted files.
    abootimg --create boot.img -f bootimg.cfg -k new-zImage -r initrd.img
    6) Backup your phone in case anything goes wrong, and flash the boot.img. For many phones, this can be done using fastboot on linux. On my Galaxy, I had to use Mobile Odin: http://forum.xda-developers.com/showthread.php?t=1347899

    D. Copy the firmware and run, on your phone...
    1) ... start the chrooted ubuntu
    2) ... insert your USB OTG and in that the Wireless USB Adapter
    3) ... run airmon-ng and make sure your device is listed.
    airmon-ng
    If not, check that your kernel is flashed (under Settings > About Device > kernel it should say [email protected]) and that the correct drivers were selected with an asterix * (built-in, y) in make menuconfig. If it is listed, continue.
    4) We now have the correct driver, but the firmware is likely missing. Download the .bin firmware that belongs to your driver. In my case, I had to download the rt73 driver from aircrack-ng website, and copy the .bin firmware file. Install ES File Manager or another root explorer, choose Root Explorer and then mount /system as Read/Write so that you can edit the contents. Now copy the firmware file to /system/etc/firmware/.
    5) Run airmon-ng and check which interface your Wireless USB Adapter is.
    airmon-ng
    6) Start the monitor mode
    airmon-ng start wlan1
    Replace wlan1 with the interface name of the Wireless USB Adapter
    7) If everything went right, it should say that monitor mode is enabled. You can now use
    airodump-ng mon0
    replacing mon0 with the monitor interface. If you get the error SIOCFLAGS: No such file or directory, the firmware file (e.g. *.bin) is not placed in the right directory (/system/etc/firmware and maybe a path extension, check the firmware README) or has the wrong name.

    Congratulations, you have now got a phone running aircrack-ng!

    I got this to work on my stock Samsung TouchWiz ROM by making a few adjustments:
    - Get the kernel from Samsung: http://opensource.samsung.com/
    - Change the lines in the .config file of the kernel below ## Samsung Rooting ... from =y to =n using nano
    - To get boot.img, download the ...tar.md5 firmware matching your current firmware from http://www.sammobile.com/firmware/, rename .tar.md5 to .tar, and extract the boot.img. You cannot use mkbootimg here, only abootimg, as this boot.img has a special ramdisk address!
    1
    Hello everyone....
    i have a few little update form my side...
    But first, my englisch is not the best, i'm sorry for it ^^

    1. The is Important for every one how work at the end with aircrack... Then you need to get to patch the mac80211 data (channel-negative-one-maxim.patch and mac80211.compat08082009.wl_frag+ack_v1.patch from aircrack), otherwise you get at the end a fixed channel -1 problem in aircrack.... ;) of which more later

    Here now My litte Upgrade to build a another Kernel because CM10... For this session I use the Kernel form Yank555.lu on JB 4.1.2!
    First you need to get the Kernel von GitHub. "github /yank555-lu/SGS3-JB/archive/Update11.zip"
    After you extracte the kernel into your Kernel-Folder go in it.
    cd ../path/to/kernel

    ########## 1. You need to edit the Makefile to beware for compile errors. ##########
    nano Makefile
    Search at the line 571:
    -- KBUILD_CFLAGS += -fdiagnostics-show-option -Werror \
    ++ KBUILD_CFLAGS += -fdiagnostics-show-option \
    Search at line 373:
    -- -mcpu=cortex-a9 -mfpu=neon -mtune=cortex-a9 -fno-pic \
    -- -munaligned-access
    ++ -mtune=cortex-a9
    Now go to line 693:
    ++ #
    ++ # Edit by Mastaaa
    ++ #
    ++ KCONFIG_CFLAGS += -w

    Save the file and Close it....

    ################ 2. Download and Patch the Wireless Patches. ################
    For the negative-channel fix you need to get the Patches.
    wget patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch &&
    wget patches.aircrack-ng.org/channel-negative-one-maxim.patch
    Now patch it...
    patch ./net/mac80211/tx.c mac80211.compat08082009.wl_frag+ack_v1.patch &&
    patch ./net/wireless/chan.c channel-negative-one-maxim.patch

    ################### 3. make .config and edit menuconfig. ####################
    Ceate a Basic .config File with:
    make Yank555.lu_v3.x_series_defconfig
    Now Edit the Menuconfig:
    make menuconfig

    Here the Basic edit's (i think) you get to need:
    1. Edit the Kernel Info (to what you want...):
    General setup --->
    (...) Local version - append to kernel release (Hit Enter to edit this...)#
    2. Turn On the mac80211 driver:
    [*] Networking support ---->
    -*- Wireless ---->
    < > Generic IEEE 802.11 Networking Stack (Mark to <*>)
    [ ] Enable mac80211 mesh networking (pre-802.11s) support (Mark to [ * ]
    3, Mark the additional usb drivers:
    Device Drivers ---->
    .....[*] Network device support ---->
    ..........[*] Wireless LAN ---->
    ...............(Mark <m> or <*> waht you need.... Here a few examples:)
    ...............<*> Atmel at76c503/at76c505/at76c505a USB cards
    ...............<*> Realtek 8187 and 8187B USB support
    ...............<*> Atheros Wireless Cards ----->
    ...............<*> Ralink driver support ----->
    ....................<*> Ralink rt2500 (USB) support
    ....................<*> Ralink rt2501/rt73 (USB) support
    ....................<*> Ralink rt27xx/rt28xx/rt30xx (USB) support
    ....................[ * ] rt2800usb - Include support for rt33xx devices
    ....................[ * ] rt2800usb - Include support for rt35xx devices (EXPERIMENTAL)
    ....................[ * ] rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)
    ....................[ * ] rt2800usb - Include support for unknown (USB) devices
    4. Mark the OTG support on !:
    Device Drivers ---->
    .....[*] USB support ---->
    ..........[ ] OTG support ............................................................(Mark it to [*])
    ..........< > Enable Wireless USB extensions (EXPERIMENTAL) ..(Makr it to <*>)
    5. Make Kernel hacking:
    Kernel hacking ---->
    .....(1024) Warn for stack frames larger than (needs gcc 4.4) (Edit this to 1032)

    ######################### 4. compile the Kernel. ###########################
    make ARCH=arm CROSS_COMPILE=$CCOMPILER -j6
    (with make -i ... you can ignor errors, but i think thats not good ^^)

    ########################## 5. make ramdisk.gz. ###########################
    mkdir ramdisk-new
    cp -ax ramdisk ./ramdisk-new
    #clear git repositories in ramfs
    find ramdisk-new -name .git -exec rm -rf {} \;
    #remove empty directory placeholders
    find ramdisk-new -name EMPTY_DIRECTORY -exec rm -rf {} \;
    rm -rf ramdisk-new/tmp/*
    #remove mercurial repository
    rm -rf ramdisk-new/.hg
    #copy modules into ramfs
    mkdir -p ramdisk-new/lib/modules
    find -name '*.ko' -exec cp -av {} ramdisk-new/lib/modules/
    #make ramdisk.gz
    mkbootfs ./ramdisk-new | gzip > ramdisk.gz

    ########################### 6. make boot.img. ############################
    ./mkbootimg --kernel arch/arm/boot/zImage --ramdisk ramdisk.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o boot.img

    ################ 7. make modules.tgz for your chroot Linux. ###################
    tar -czf modules.tgz `find . | grep ko$`
    (... This modules.tgz you have to copy to sdcard0,
    then go into chrootet (after you have flashed the new Kernel!) Linux and make: )
    cd /lib/modules
    mkdir `uname -r`
    cd *
    tar -zxf /sdcard0/modules.tgz
    depmod -a

    now turn the usb-wlan on S3 and make:
    modprobe <your-driver>
    example:
    modprobe rt73usb


    Now your Wifi-USB must be Online...

    Soooo that was it from my self... :)
    (For any Questions, you have. I'm on my Position... :)

    Bye bye,
    Master X
    1
    Hey everyone,

    It is possible to use an external Wi-Fi adapter with an android phone to run aircrack-ng, however I've had a lot of difficulties doing so. Here is a tutorial to make it easier for you.

    Thanks alot it works :good:

    1
    @op thank you so incredibly much for this guide!! This information is surprisingly scarce on the internet and you have saved me hours of work so truly, thank you!

    Can i do this on windows 7 pc instead of linux or ubuntu or just using android

    You can, using virtual machine software. I would try either Oracle VM VirtualBox or VMWare Workstation. Most people seem to prefer the latter, although both have their merits. You can then install linux (or multitudes of other operating systems) in virtual machine within your Windows installation, like so. I for example complete most linux tasks on my Windows PC with a VMWare installation of Kali Linux, which I have expanded with android development software. As long as what you are doing doesn't require maximum hardware efficiency (the VM is always sharing with/linked to the Windows environment) then there is often little reason to go through the hassle of installing a second-boot installation of linux on your machine.