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

Search This thread

argentux

Member
Jun 23, 2013
26
39
Amsterdam
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://xdaforums.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 yourname@computername) 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!
 

Attachments

  • image.jpg
    image.jpg
    201.7 KB · Views: 28,301
Last edited:

GruberEXN

Member
Jul 14, 2013
28
21
Jesus, that was awesome. Couldn't find a better tutorial on the net!

Thanks again.

Btw, could you please upload the Galaxy S4 Cyanogen rom with the kernel?

I would appreciate alot.
 
Last edited:

junior13

New member
Oct 17, 2013
2
0
Hey i have Htc desire C! I did the instal "bcmon.apk" but when I run the program turns out this message "cant run as root,'su' failed... why ??? please help me !
 

yoshihat

Member
Oct 24, 2013
12
1
plus.google.com
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://xdaforums.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 yourname@computername) 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!

Thats insane that it can actually run aircrack, especially considering i had a hard time just running linux on it.
 

androidiphonehacker

Senior Member
Oct 8, 2013
70
2
Calhoun
I did everything and got everything ready, up to
Code:
make menuconfig
And it gives me error 2. And then it says something about there not being a variable.
:/
Please help?
 

GruberEXN

Member
Jul 14, 2013
28
21
I am actually having a time trying to make it work. I did everything right, then I sucessfully build the boot.img, but when I flash it through Mobile Odin as "Kernel" and the Cyanogenmod loads, the screen is all screwed up, like the SystemUI has crashed + interference signal effect, its unusable. Then I restore it through TWRP back to normal.

Do you know what may be the problem? Im using the 10.1.3 JFLTEXX CyanogenMod Build. (For the i9505.)

Edit: Nevermind, was compiling the M build against the Stable one. Obvious error. It works 100% now, thanks!
 
Last edited:

androidiphonehacker

Senior Member
Oct 8, 2013
70
2
Calhoun
I am actually having a time trying to make it work. I did everything right, then I sucessfully build the boot.img, but when I flash it through Mobile Odin as "Kernel" and the Cyanogenmod loads, the screen is all screwed up, like the SystemUI has crashed + interference signal effect, its unusable. Then I restore it through TWRP back to normal.

Do you know what may be the problem? Im using the 10.1.3 JFLTEXX CyanogenMod Build. (For the i9505.)

Edit: Nevermind, was compiling the M build against the Stable one. Obvious error. It works 100% now, thanks!

Could you please send the edited working kernel with the modules/drivers built in that you installed? (Please, like a link or something?)
 

androidiphonehacker

Senior Member
Oct 8, 2013
70
2
Calhoun
I have a TP-Link TL-wn722n USB wireless adapter. I'm kind of a noob at kernel building, and I'm not sure what driver/module it uses. Soooo... Could you build it for me please please pleaaaase? xD

I have (that USB adapter), and the newest CyanogenMod ROM for model SGS-i9505.

Tell you what: I'll pay you if you build it.

Sent from my GT-I9505 using Tapatalk
 

GruberEXN

Member
Jul 14, 2013
28
21
I have a TP-Link TL-wn722n USB wireless adapter. I'm kind of a noob at kernel building, and I'm not sure what driver/module it uses. Soooo... Could you build it for me please please pleaaaase? xD

I have (that USB adapter), and the newest CyanogenMod ROM for model SGS-i9505.

Tell you what: I'll pay you if you build it.

Sent from my GT-I9505 using Tapatalk

Add'd your skype. :)

Building a kernel requires some troubleshooting, so prepare your device with TWRP or any recovery menu. (A nandroid backup would be nice too.)

And I don't mind a donation, although I don't want a payment. Maybe a cheap game would do the work after one day of troubleshooting your new kernel ;)
 
Last edited:

MasterX1987

New member
Jan 11, 2013
4
5
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
 
Last edited:
  • Like
Reactions: Eiwian

hepterci

Senior Member
Feb 23, 2013
83
3
I'll do the kernel for i9500, but I'm afraid to damage the phone the wrong make.
If one makes the kernel for i9500 you Could you share?
 

hepterci

Senior Member
Feb 23, 2013
83
3
yes, I did. and running rlt8187 alfa wifi on ubuntu.but wps not work. Everything other than these problems well :)
u3a9eta3.jpg


Probably, to add to another something and there are ( in kernel)

GT-I9500 cihazımdan Tapatalk kullanılarak gönderildi
 
Last edited:

m00nl33n

Member
Aug 26, 2009
20
2
I added usb adapter device support to kernel successfully but then my wifi stopped working here is the dmesg of turning wifi on

Code:
<4>[ 2273.866333] wlan: disagrees about version of symbol cfg80211_ready_on_channel
<4>[ 2273.866455] wlan: Unknown symbol cfg80211_ready_on_channel (err -22)
<4>[ 2273.866729] wlan: disagrees about version of symbol __ieee80211_get_channel
<4>[ 2273.866821] wlan: Unknown symbol __ieee80211_get_channel (err -22)
<4>[ 2273.867065] wlan: disagrees about version of symbol cfg80211_cqm_rssi_notify
<4>[ 2273.867187] wlan: Unknown symbol cfg80211_cqm_rssi_notify (err -22)
<4>[ 2273.867370] wlan: disagrees about version of symbol cfg80211_roamed
<4>[ 2273.867523] wlan: Unknown symbol cfg80211_roamed (err -22)
<4>[ 2273.867614] wlan: disagrees about version of symbol cfg80211_pmksa_candidate_notify
<4>[ 2273.867736] wlan: Unknown symbol cfg80211_pmksa_candidate_notify (err -22)
<4>[ 2273.867858] wlan: disagrees about version of symbol wiphy_register
<4>[ 2273.868011] wlan: Unknown symbol wiphy_register (err -22)
<4>[ 2273.868133] wlan: disagrees about version of symbol cfg80211_disconnected
<4>[ 2273.868286] wlan: Unknown symbol cfg80211_disconnected (err -22)
<4>[ 2273.868499] wlan: disagrees about version of symbol cfg80211_new_sta
<4>[ 2273.868591] wlan: Unknown symbol cfg80211_new_sta (err -22)
<4>[ 2273.868774] wlan: disagrees about version of symbol cfg80211_tdls_oper_request
<4>[ 2273.868865] wlan: Unknown symbol cfg80211_tdls_oper_request (err -22)
<4>[ 2273.869018] wlan: disagrees about version of symbol cfg80211_connect_result
<4>[ 2273.869171] wlan: Unknown symbol cfg80211_connect_result (err -22)
<4>[ 2273.869262] wlan: disagrees about version of symbol cfg80211_inform_bss_frame
<4>[ 2273.869415] wlan: Unknown symbol cfg80211_inform_bss_frame (err -22)
<4>[ 2273.869506] wlan: disagrees about version of symbol wiphy_new
<4>[ 2273.869659] wlan: Unknown symbol wiphy_new (err -22)
<4>[ 2273.869781] wlan: disagrees about version of symbol cfg80211_rx_mgmt
<4>[ 2273.869903] wlan: Unknown symbol cfg80211_rx_mgmt (err -22)
<4>[ 2273.870117] wlan: disagrees about version of symbol cfg80211_send_unprot_deauth
<4>[ 2273.870239] wlan: Unknown symbol cfg80211_send_unprot_deauth (err -22)
<4>[ 2273.870361] wlan: disagrees about version of symbol cfg80211_mgmt_tx_status
<4>[ 2273.870513] wlan: Unknown symbol cfg80211_mgmt_tx_status (err -22)
<4>[ 2273.870727] wlan: disagrees about version of symbol cfg80211_inform_bss
<4>[ 2273.870819] wlan: Unknown symbol cfg80211_inform_bss (err -22)
<4>[ 2273.871002] wlan: disagrees about version of symbol wireless_send_event
<4>[ 2273.871093] wlan: Unknown symbol wireless_send_event (err -22)
<4>[ 2273.871246] wlan: disagrees about version of symbol wiphy_free
<4>[ 2273.871337] wlan: Unknown symbol wiphy_free (err -22)
<4>[ 2273.871520] wlan: disagrees about version of symbol cfg80211_scan_done
<4>[ 2273.871612] wlan: Unknown symbol cfg80211_scan_done (err -22)
<4>[ 2273.871795] wlan: disagrees about version of symbol regulatory_hint
<4>[ 2273.871856] wlan: Unknown symbol regulatory_hint (err -22)
<4>[ 2273.872039] wlan: disagrees about version of symbol cfg80211_get_bss
<4>[ 2273.872100] wlan: Unknown symbol cfg80211_get_bss (err -22)
<4>[ 2273.872283] wlan: disagrees about version of symbol cfg80211_michael_mic_failure
<4>[ 2273.872436] wlan: Unknown symbol cfg80211_michael_mic_failure (err -22)
<4>[ 2273.872528] wlan: disagrees about version of symbol cfg80211_ibss_joined
<4>[ 2273.872680] wlan: Unknown symbol cfg80211_ibss_joined (err -22)
<4>[ 2273.872833] wlan: disagrees about version of symbol cfg80211_del_sta
<4>[ 2273.872985] wlan: Unknown symbol cfg80211_del_sta (err -22)
<4>[ 2273.880584] wlan: disagrees about version of symbol cfg80211_remain_on_channel_expired
<4>[ 2273.880737] wlan: Unknown symbol cfg80211_remain_on_channel_expired (err -22)
<4>[ 2273.880889] wlan: disagrees about version of symbol wiphy_unregister
<4>[ 2273.880950] wlan: Unknown symbol wiphy_unregister (err -22)
<6>[ 2277.103332] SLIM_CL: skip reconfig sequence
<6>[ 2336.262878] SLIM_CL: skip reconfig sequence
<6>[ 2341.206115] SLIM_CL: skip reconfig sequence
<3>[ 2372.867187] init: untracked pid 7791 exited
<6>[ 2375.211242] SLIM_CL: skip reconfig sequence
<6>[ 2378.713043] SLIM_CL: skip reconfig sequence
<6>[ 2385.924896] check_recover_vbus_collapse: VBUS input current still limiting to 700 mA. Retry set
<6>[ 2397.413330] SLIM_CL: skip reconfig sequence
<4>[ 2464.730682] set_usb_max_current: setting current max to 1500
<4>[ 2544.752166] set_usb_max_current: setting current max to 1500
<4>[ 2604.769744] set_usb_max_current: setting current max to 1500
<4>[ 2674.810363] set_usb_max_current: setting current max to 1500
<6>[ 2686.035491] SLIM_CL: skip reconfig sequence
<3>[ 2690.290008] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1300c8, irq:226
<3>[ 2690.290191] qup_i2c qup_i2c.0: I2C slave addr:0x28 not connected
<3>[ 2690.300445] pn544 0-0028: pn544_dev_write: i2c write err -107, but retry 1
<3>[ 2691.778778] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1343c8, irq:226
<3>[ 2691.778961] qup_i2c qup_i2c.0: I2C slave addr:0x28 not connected
<3>[ 2691.789093] pn544 0-0028: pn544_dev_write: i2c write err -107, but retry 1
<6>[ 2694.949035] SLIM_CL: skip reconfig sequence
<4>[ 2714.834625] set_usb_max_current: setting current max to 1500
<6>[ 2715.883575] SLIM_CL: skip reconfig sequence
<6>[ 2843.803405] SLIM_CL: skip reconfig sequence
<6>[ 2854.273345] SLIM_CL: skip reconfig sequence
<6>[ 2955.025512] msm_otg msm_otg: USB exited from low power mode
<6>[ 2955.026306] msm_otg msm_otg: b_idle work, inputs=0x00000001
<6>[ 2955.026580] msm_otg msm_otg: Avail curr from USB = 0
<6>[ 2955.026885] msm_otg msm_otg: phy_reset: success
<6>[ 2955.136352] msm_otg msm_otg: USB in low power mode
<6>[ 2969.677581] msm_otg msm_otg: USB exited from low power mode
<6>[ 2969.678131] msm_otg msm_otg: b_idle work, inputs=0x00000003
<6>[ 2969.853424] msm_otg msm_otg: chg_type = USB_SDP_CHARGER
<6>[ 2969.853576] msm_otg msm_otg: b_idle work, inputs=0x00000003
<6>[ 2969.859283] msm_hsusb msm_hsusb: vbus online
<6>[ 2969.859436] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_RESET_EVENT received
<6>[ 2969.859558] msm_otg msm_otg: changed to b_peripheral, from b_idle
<6>[ 2970.140228] msm_hsusb msm_hsusb: reset
<6>[ 2970.140686] android_work: android_work: did not send uevent (0 0   (null))
<6>[ 2970.178863] android_work: android_work: sent uevent USB_STATE=CONNECTED
<6>[ 2970.182403] msm_hsusb msm_hsusb: reset
<6>[ 2970.182891] android_work: android_work: sent uevent USB_STATE=DISCONNECTED
<6>[ 2970.261993] android_work: android_work: sent uevent USB_STATE=CONNECTED
<6>[ 2971.677764] android_usb gadget: high-speed config #1: android_usb
<6>[ 2971.677917] msm_otg msm_otg: Avail curr from USB = 500
<6>[ 2971.733306] android_work: android_work: sent uevent USB_STATE=CONFIGURED
<6>[ 2971.880920] mtp_open
<6>[ 2974.863128] msm_ta_detect_work: USB exit ta detection - frindex
<3>[ 3000.568115] init: untracked pid 8878 exited
<3>[ 3003.624877] init: untracked pid 8948 exited
<6>[ 3005.894012] SLIM_CL: skip reconfig sequence

I think problem occurs when I enable "cfg80211 wireless extensions compatibility" but unless enabling it i cannot see the wifi adapter in airmon-ng


if CONFIG_CFG80211_WEXT=y = inner WLAN wont work
if CONFIG_CFG80211_WEXT=n = usb wifi adapter wont work with aircrack, reaver

getprop
[wifi.interface]: [wlan0]
[wlan.driver.ath]: [0]
[wlan.driver.config]: [/data/misc/wifi/WCNSS_qcom_cfg.ini]
[wlan.driver.status]: [unloaded]

logcat:

I/WifiManager(16050): Process ndroid.settings enabled Wifi
D/WifiService( 779): setWifiEnabled: true pid=16050, uid=1000
E/WifiStateMachine( 779): Failed to load driver!
E/WifiStateMachine( 779): DriverFailedState


here are documentations about it but they are too complex for me :
https://community.freescale.com/docs/DOC-93603
http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html
as fas as I understand from what I read I should recompile wlan.ko after building new kernel but i dont know how
 
Last edited:

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://xdaforums.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 yourname@computername) 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.