[Android Software/Hacking General [Developers Only]] chiragkrishna:
****i am not responsible for your phone or anything you do with aircrack-ng

this guide will help you do, what a $1,295.00 PWN PHONE can!!

*this guide is based on nexus 5 you can substitute it with any phone/tablet(with otg support) with this guide

------------------------------------------------------------------------------------------------

Things You Need

------------------------------------------------------------------------------------------------

1) Nexus 5 (rooted)

2) OTG Cable

3) list of USB supported

.TP-LINK TL-WN722N(confirmed by me & DragonHunt3r)

.Linksys WUSB600N V2 (confirmed by DragonHunt3r)

.TP-LINK TL-WN725N V1 & V2

.ALFA Network AWUS036H

(if you have other wifi usb then just ask ill try to add it into the guide)

4) Ubuntu (to compile kernel)

------------------------------------------------------------------------------------------------

PART A

(Compiling Kernel)

------------------------------------------------------------------------------------------------

Setting up your ubuntu machine

$ sudo apt-get update

$ sudo apt-get install oracle-java6-installer

$ sudo apt-get install git gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z1-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev libncurses5-dev bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev squashfs-tools pngcrush schedtool dpkg-dev

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/

create a file /etc/udev/rules.d/51-android.rules (as the root user)

copy paste the below code and save

# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
# adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
# fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
# adb protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
# fastboot protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"

<username> must be replaced by the actual username of the user who is authorized to access the phones over USB.

Setting correct paths

gedit android-path.sh

cope paste the code and save it

export CC=$(pwd)/arm-eabi-4.6/bin/arm-eabi-
export CROSS_COMPILE=$(pwd)/arm-eabi-4.6/bin/arm-eabi-

export ARCH=arm
export SUBARCH=arm

export PATH=$PATH:$(pwd)/andorid_boot_tools_bin

Make it executable and source to current terminal window.

(you need to source it to your current terminal window before you compile)

$ chmod +x android-path.sh
$ source android-path.sh

Download Source (any kernel source can be used)

1. HTC

2. Samsung

3. LG

4. Sony

5. Nexus devices

using nexus 5 andoid kernel source

$ git clone https://android.googlesource.com/kernel/msm.git

$ cd msm/
$ git branch -a
$ git checkout origin/android-msm-hammerhead-3.4-kitkat-mr2

$ make hammerhead_defconfig
$ make menuconfig

Adding required drivers

For TP-LINK_TL-WN722N

quick look in [URL="https://wikidevi.com/wiki/TP-LINK_TL-WN722N"]wikidev[/URL] will tell you that TP-LINK TL-WN722N uses [URL="http://wireless.kernel.org/en/users/Drivers/ath9k_htc"]ath9k_htc[/URL] drivers

Enabling [URL="http://wireless.kernel.org/en/users/Drivers/ath9k"]ath9k[/URL] drivers in kernel
To enable ath9k, you must first enable mac80211 through make menuconfig when compiling your kernel. If you do not know what this means then please learn to compile kernels or rely on your Linux distribution's kernel. Below are the options you need to enable ath9k through make menuconfig.

[CODE]Networking support --->
Wireless --->
< * > cfg80211 - wireless configuration API
< * > Generic IEEE 802.11 Networking Stack (mac80211)

You can then enable ath9k in the kernel configuration under

Device Drivers --->
[*] Network device support --->
Wireless LAN --->
Atheros Wireless Cards ---->
< * > Atheros 802.11n wireless cards support
< * > Atheros HTC based wireless card support

save and exit menuconfig

check in your .config file if you have them enable(its a hidden file)

CONFIG_ATH_COMMON=y
CONFIG_ATH9K_HW=y
CONFIG_ATH9K_COMMON=y
CONFIG_ATH9K_HTC=y

[/CODE]

For TP-LINK TL-WN725N V1 & V2

quick look in [URL="https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v1"]V1[/URL] & [URL="https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v2"]V2[/URL] wikidev will tell you that TP-LINK_TL-WN725N uses [URL="http://wireless.kernel.org/en/users/Drivers/rtl819x"]rtl8192cu[/URL] & [URL="https://github.com/lwfinger/rtl8188eu"]8188eu[/URL] drivers

To enable rtl8192cu & 8188eu, you must first enable rtl8192cu & 8188eu through make menuconfig when compiling your kernel. If you do not know what this means then please learn to compile kernels or rely on your Linux distribution's kernel. Below are the options you need to enable rtl8192cu & 8188eu through make menuconfig.

[CODE]Device Drivers --->
[*] Network device support --->
Wireless LAN --->

[*] Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter

For Linksys WUSB600N V2

quick look in [URL="https://wikidevi.com/wiki/Linksys_WUSB600N_v2"]wikidev[/URL] will tell you that WUSB600N V2 uses [URL="http://wireless.kernel.org/en/users/Drivers/rt2800usb"]rt2800usb[/URL] drivers

To enable rt2800usb, you must first enable rt2800usb through make menuconfig when compiling your kernel. If you do not know what this means then please learn to compile kernels or rely on your Linux distribution's kernel. Below are the options you need to enable rt2800usb through make menuconfig.

[CODE]Device Drivers --->
[*] Network device support --->
Wireless LAN --->
Ralink driver support ---->
< * > Ralink rt27xx/rt28xx/rt30xx (USB) support -->
< * > rt2800usb - Include support for rt35xx devices (EXPERIMENTAL) (NEW)
< * > rt2800usb - Include support for unknown (USB) devices

For ALFA Network AWUS036H

quick look in [URL="https://wikidevi.com/wiki/ALFA_Network_AWUS036H"]wikidev[/URL] will tell you that AWUS036H uses [URL="http://wireless.kernel.org/en/users/Drivers/rtl8187"]rtl8187[/URL] drivers

Enabling [URL="http://wireless.kernel.org/en/users/Drivers/ath9k"]rtl8187[/URL] drivers in kernel
To enable rtl8187, you must first enable rtl8187 through make menuconfig when compiling your kernel. If you do not know what this means then please learn to compile kernels or rely on your Linux distribution's kernel. Below are the options you need to enable rtl8187 through make menuconfig.

[CODE]Networking support --->
Wireless --->
< * > Common routines for IEEE802.11 drivers
< * > Generic IEEE 802.11 Networking Stack (mac80211)

You can then enable rtl8187 in the kernel configuration under

[CODE]
Device Drivers --->
[*] Network device support --->
Wireless LAN --->

[*] Realtek 8187 and 8187B USB support

save and exit menuconfig[/CODE]

save and exit menuconfig if you dint do it

save and exit menuconfig[/CODE]

now your ready to compile

make -j4

this will take some time to compile

you should get something like this in the end

Kernel: arch/arm/boot/zImage-dtb is ready

now you need to get a boot.img from any {your device} rom and place it in boot_img (create this folder where you earlier downloaded the toolchain and the kernel)

$ cd .. # if you was in msm directory
$ git clone https://github.com/pbatard/bootimg-tools.git
$ cd bootimg-tools/
$ make
$ cd cpio/
$ gcc mkbootfs.c -o mkbootfs -I../include
$ cd ../..
$ mkdir andorid_boot_tools_bin
$ cd andorid_boot_tools_bin/
$ cp ../bootimg-tools/mkbootimg/mkbootimg .
$ cp ../bootimg-tools/mkbootimg/unmkbootimg .
$ cp ../bootimg-tools/cpio/mkbootfs .
$ cd ..

time to create your own boot

$ unmkbootimg -i boot_img/boot.img
$ cp msm/arch/arm/boot/zImage-dtb kernel
$ mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x02900000 --second_offset 0x00f00000 --tags_offset 0x02700000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=2 msm_watchdog_v2.enable=1' --kernel kernel --ramdisk ramdisk.cpio.gz -o boot.img

install the boot.img to your phone (this wont flash the kernel, it will temporarily boot with this kernel, after you restart you will go back to what ever kernel you had before

(this is for nexus 5 it might work for others also)

$ adb reboot bootloader
$ sudo fastboot boot boot.img

------------------------------------------------------------------------------------------------

PART B

(setting up your phone)

------------------------------------------------------------------------------------------------

For TP-LINK_TL-WN722N

download the firmware files [URL="http://wireless.kernel.org/download/htc_fw/1.3/"]here[/URL]
1. htc_7010.fw
2. htc_9271.fw

For TP-LINK TL-WN725N V1 & V2

Download the firmware files [URL="https://drive.google.com/folderview?id=0Bxm4XqSOJU3YWlVaZ1NFRDF4RTA&usp=sharing"]here[/URL]

For Linksys WUSB600N V2

Download the firmware files [URL="https://drive.google.com/folderview?id=0Bxm4XqSOJU3YMGZTcjJ2ei10V1k&usp=sharing"]here[/URL]
1. rt2870.bin

For ALFA Network AWUS036H

hopefully nothing to do here,... if it doesnt work let me know

copy them to your phone

use a file manager with root to copy both of them to /system/etc/firmware/

install Linux deploy on your phone

fire up linux deploy and go to properties-->Distribution and select kali linux

installation path set to /sdcard/linux.img

hit the install button

after installation click start button

start your favorite ssh program and happy aircrack-ng

(SH credentials are “android” for the username (configured via Linux Deploy) and “changeme” as the password.)

​