Kali Linux 2 Sana – Raspberry Pi 2 Wireless Tools Custom Build

Ok, it’s been a while since I last built a Custom Kali image for the raspberry Pi 2. It’s become much easier to build an image now and it takes very few steps which is excellent!

First start by creating a new directory called arm-stuff
mkdir ~/arm-stuff
Change into the arm-stuff directory
cd ~/arm-stuff
Clone the cross compiler for the armhf image from github
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
Set export PATH to set your cross compiler directory
export PATH=${PATH}:/root/arm-stuff/gcc-arm-linux-gnueabihf-4.7/bin
Clone the kali-arm-build-scripts from git
git clone https://github.com/offensive-security/kali-arm-build-scripts
Change into the newly created kali-arm-build-scripts directory
cd ~/arm-stuff/kali-arm-build-scripts

1_Kali_2_Rasberry_Pi_2_prep_work

1_Kali_2_Rasberry_Pi_2_prep_work

Running “ls” will show you everything in the kali-arm-build-scripts directory, use your editor of choice and open the Raspberry Pi 2 script “rpi2.sh” and modify it if you want to follow along and install only the wireless tools or you can leave the next two steps and just run “build-deps.sh” to install any dependacies you may require to build your image.

2_Kali_2_Rasberry_Pi_2_read_rpi2

2_Kali_2_Rasberry_Pi_2_read_rpi2

Modify everything after the “tools=” variable and replace the current string with “kali-linux-wireless” to install only the wireless tools. You can get a full list of meta packages to configure different builds.

3_Kali_2_Rasberry_Pi_2_rpi2_modify

3_Kali_2_Rasberry_Pi_2_rpi2_modify

I also like to keep the image file created during the build creation process so that I don’t have to run unxz against the newly created img.xz file when finished, once again completely optional and a personal preference.

4_Kali_2_Rasberry_Pi_2_rpi2_modify2

4_Kali_2_Rasberry_Pi_2_rpi2_modify2

Next before starting off the build process you should also check for any dependencies you may require by running build-deps.sh which should finish without any error.

5_Kali_2_Rasberry_Pi_2_rpi2_build-deps

5_Kali_2_Rasberry_Pi_2_rpi2_build-deps

Run the rpi2.sh script followed by whatever you want to name your finished build. My name below is “Kali_Pi2_Custom_Wireless_Tools” but feel free to change the name to anything else.

6_Kali_2_Rasberry_Pi_2_rpi2_start_build

6_Kali_2_Rasberry_Pi_2_rpi2_start_build

Let this run for some time depending on your system and Internet speed and when finished you should see a similar result like I have below:

7_Kali_2_Rasberry_Pi_2_rpi2_finish_build

7_Kali_2_Rasberry_Pi_2_rpi2_finish_build

Checking the contents of the directory with “ls” you will now see a newly created directory with your custom image inside.

8_Kali_2_Rasberry_Pi_2_rpi2_custom_image_location

8_Kali_2_Rasberry_Pi_2_rpi2_custom_image_location

Use dd to transfer the image to your microsd card:

dd if=name_of_image.img of=/your/microsd bs=1M

As always be very careful with dd so as not to image your running disk as it will destroy any drive or partition if you copy it to the wrong location, use “fdisk -l” and plug your card in and out and see what changes to get the correct device to copy to. You may see something like “/dev/sdb1” and “/dev/sdb2” in this case you want to use the whole disk so choose “/dev/sdb” to get the root of the drive.

When finished the transfer run “sync” to synchronize any cached writes to persistent storage, the persistent storage being your microsd card because if you remove it to early the copy may not have fully completed yet even though the dd process has finished. Just run it and see how long it takes, if it finishes quickly that just means it’s fully finished. Otherwise it may take a minute or two, when that happens be glad you ran it or you would have had to run the dd transfer again as the image would be corrupted!

9_Kali_2_Rasberry_Pi_2_rpi2_custom_image_dd_to_microsd_card

9_Kali_2_Rasberry_Pi_2_rpi2_custom_image_dd_to_microsd_card

Next remove your microsd and plug it into your Raspberry Pi 2 and boot it up!

Kali_Pi_2_Hacker_Cat

Kali_Pi_2_Hacker_Cat

It might be wise to remove any pets from the process…

 

RPi2, Kali & a Motorola Atrix Lapdock for Fun & Pentesting

Since starting the Kali section of this blog and putting in a crazy amount of effort to get Kali installed and working correctly on the Raspberry Pi 2 I really could have been doing things a lot faster if I had a nice visual display to plug into rather than having to use the TV every time I wanted a visual on the box whether it was to see if a new error had been displayed while testing or just to see if X was failing again upon boot.

I have a friend who for the longest time wanted to work with me and do some soldering to get the Motorola Atrix Lapdock and the Raspberry Pi working (Yes the raspberry Pi “1” as this is nothing new), I figured there had to be an easier way as I did not really fancy soldering, don’t get me wrong I had enough practice recently over Christmas but surely some non soldering setup existed out there to simplify this process.

What follows is just a few pictures of my setup now since removing the back panel on the Atrix itself which is easier than you think at first as you honestly will feel like you are going to smash it to pieces!

What you will need:

1) Motorola Atrix Lapdock
2) Raspberry Pi 2
3) Screwdriver
4) Raspberry Pi to Lapdock Cable
5) Micro HDMI Female Adapter Type A to Type D
6) USB Male to Female Cable
7) Gadgets of your choosing for me this was wireless and bluetooth cards.

So after you have taken the back off you will be able to disassemble the casing around the cables for connecting the Motorola phone and you then have two naked cables which I am not sure what I am going to do with them yet as they are quite vulnerable to wear and tear, I may put the casing back on but for now everything is working nicely with my current setup.

20150325_192254_sizeWireless Gadget’s

20150325_192922_sizeBluetooth

20150329_114106As you can see I now have a portable laptop that does not look suspicious in the slightest!

20150325_191405_sizeLogging in20150325_191811Graphical menu with tools installed

20150325_191928

I have been having some fun with wireless in my home lab recently, I recently brought the bluetooth dongle outside to see what I could detect and bluetooth is everywhere these days and you find plenty of random devices including TV’s and some that I will not mention due to the nature of the devices but I don’t think this is a good thing and with the price of sticking a Low Energy bluetooth (BLE) chip in devices these days I can see this becoming a problem down the road. As things become popular they become targets, best not include bluetooth in our critical infrastructure, oh wait, too late…

 

4 – Kali PI 2 – Configure SSH with Custom Banner

If you have gone down the route of creating your own custom image of Kali for the Pi you will need to enable SSH for yourself to make life a bit easier for experimenting with ideas.

Remove the SSH run levels first

update-rc.d -f ssh remove

Load the default SSH run levels

update-rc.d -f ssh defaults

0 - Kali runlevels
Backup and move the default SSH keys and generate some fresh ones to prevent a MITM attack against your Pi.
1 - Kali SSH Configuration
Want a Message of the Day banner? Why the hell not! Install figlet.
apt-get install figlet
2 - Figlet for custom kali banner
Usage is simply
figlet followed by words you wish to have modified
3 - Figlet custom words use
Just copy the text from the teminal and then open up /etc/motd and paste in your new message
4 - modify banner
Add in whatever you want here and save
5 - Changed Banner
SSH into your box to see your new message
ssh root@your_pi_ip_address
6 - Kali SSH configured
 

Kali Linux 1.1.0 Git install Kernel Cross Compilation with Wireless Injection “Working” v2

OK so after some time of playing around and trying different things I have finally managed to simplify the process of installing Kali Linux on the Raspberry Pi 2 with “armhf” architecture and compiling the kernel with wi-fi injection working! Follow the the tutorial below and I will guide you step by step through each section and hopefully very soon you will also have your own custom image compiled with patched drivers for wireless injection 🙂

To follow along with this tutorial you will need the following items:
1) Raspberry Pi 2
2) Micro SD Card 8GB’s or more
3) Kali linux either installed on a physical machine or in a Virtual Machine
4) Time & patience
Step 1:
So as before you need to first create a directory and navigate to it.
mkdir name_of_your_choice (Remember it as you will need this later)
1 - Kali make dir
cd name_of_your_choice
1.1 - Kali change dir
Step 2:
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7 to pull down for the “armhf” image creation
2 - Kali Git Clone
Output once finished it should look as follows
2.1 - Kali Git Clone Finish

Step 3:

Check your working directory with “pwd” and then “ls” to check the gcc-arm directory is there and use this information to export the path

3 - Check pwd and directory

Step 4:

Export the path with /root/Kali-Git being the working directory and gcc-arm-linux-gnueabihf-4.7/bin being the directory and bin directory contained within that you have just cloned from git

export PATH=${PATH}:/root/Kali-Git/gcc-arm-linux-gnueabihf-4.7/bin

4 - Export Kali

Step 5:

Clone the kali-arm-build-scripts from github

git clone https://github.com/offensive-security/kali-arm-build-scripts

5 - Clone Kali Arm Scripts

Output once finished it should look as follows

5.1 - Clone Kali Arm Scripts finish

Step 6:

Now as the Pi has a different architecture you need to modify the rpi.sh script in the cloned repository with the editor of your choice

6 - Change to Kali arm scripts dir

Step 7:

Don’t want to have to re-partition your Micro SD card afterwards? Don’t worry there is a place to make your life easier hidden within this script! If you have an 8GB card for example just calculate by 8 x 1000 and you get your size, my card in this case is a 16GB so unless you are using 16GB’s or higher do not copy in 16000 like below. Note however your card may not be the correct advertised size so make sure the size is what you think it is prior to setting it here. I however prefer to just re-size with gparted once finished as it takes far less time to be perfectly honest than to transfer a 16GB.img to my Micro SD card. You can also use the wiggle script afterwards to if you want an alternative method. Use whatever you are comfortable with.

4 -wiggle disk size change

Step 8:

Modifying two separate locations as outlined in the below image to say “armhf” instead of “armel”

 

7 - Change Kali architecture

Step 9:
Comment out the linux git clone like below with a # in front and instead add in the following 3.18 kernel instead
git clone -b rpi-3.18.y –depth 1 https://github.com/raspberrypi/linux ${basedir}/kernel
9 -Change kernel
Step 10:
I added in the following line as I was compiling on a 64bit machine so don’t use unless you need to and leave as is
export CROSS_COMPILE=${basedir}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
10 - kernel cross compilation
I also changed kernel.img to kernel7.img as per this thread on the raspberry pi forums
11.1 - kernel change
Step 11:
I also chose to comment out the last few lines at the end in order to be able to troubleshoot and not compress or build a sha1sum as you can see below and make sure to save it
8 - rpi script comment out

Step 12:

Copy the following pastebin script from here and create a new file in the kernel directory or alternatively run “wget http://pastebin.com/download.php?i=Rv3zpsiv -O rpi-3.18.config” from the terminal to do this for you and download it straight to the directory for you. I chose not to modify the kernel script in the end and leave as it was. If you don’t want to use the pastebin kernel version your can extract the kernel configuration yourself by simply installing Raspbian, booting up and then running “zcat /proc/config.gz > 3.18.config”  and copying this file onto your system in place of the downloaded or copy and pasted method.

12 - kernel create

Save the file contents

12 .1 - config save

Or with wget just download straight to /Kali-Git/kali-arm-build-scripts/kernel-configs

wget http://pastebin.com/download.php?i=Rv3zpsiv -O rpi-3.18.config

12 - wget raspbian kernel config

Step 13:
Install some dependencies via apt-get
sudo apt-get install linux-source -y
sudo apt-get install bc gcc gcc-4.6 libc-bin libc-dev-bin libc6 libc6-dev linux-libc-dev lib32ncurses5 -y make manpages-dev
Step 14:
I was getting an error on my previous attempt related to GLIBC_2.14 so I did some investigating and it turns out that due to debian being stable it will only use the following version 2.13 as seen below
14 GLIBC_2.14 kali linux
The GLIBC_2.14 error
complie_error_2
OK, so you shouldn’t really do this but I said screw it as I had spent quite some time at this and I wasn’t going to give up easily, I did a bad thing and I installed libc6 from the debian experimental repository something that without would not have made this possible. If you follow through you should backup or create a snapshot of your system as I take no responsibility for you borking your system up! Take this as a warning and be careful.
To install the debian experimental repository I followed the following guide
First run “nano /etc/apt/sources.list” in order to edit the file, alternatively use a different editor if you want like vi or emacs!
15.1 - nano apt sources
Modify with the following two lines and save
deb http://ftp.debian.org/debian experimental main
deb http://ftp.debian.org/debian sid main
15.2 - nano apt sources
Run apt-get update
15.3 - apt-get update kali
Then install libc6
apt-get -t experimental install libc6-dev
15.4 - libc6 install kali
Verify the install went well and a newer version of GLIBC is available to you.
/lib/x86_64-linux-gnu/libc.so.6
15.5 - libc6 installed check
Step 15:

The output should initiate as below when the rpi.sh script is run with the version number or name of your choice and be patient as depending on your internet connection this can take some time to complete

./rpi.sh name_of_custom_image

13 - run rpi script

When finished it should look something like this

13.1 - run rpi script finish

Step 16:
Now that this is done it is time to write the card with dd
dd if=your_image_here.img of=/dev/your_micro_sd bs=1M
14.2 Kali dd to disk - custom 2
Upon ejecting the Micro SD and plugging it into the Pi the kernel was not fully booting and giving me the following error, which was due to my 32GB Micro SD card as my 16GB was fine, but you may encounter similar so this is how I fixed it.
“panic: VFS: Unable to mount root fs on unknown-block”
I ejected the Micro SD card and then ran the following against it
sudo fsck.ext4 -fy /dev/sdc2
16 - fsck kali
Step 17:
I then also increased the size of the ext4 partition with gparted
Run “gparted” & from the terminal
12 - Gparted start
You want to unmount the partitions first so Right Click on the partitions and select Unmount
13 - Gparted unmount
After it should look like this with the key removed beside each partition
14 - Gparted unmounted
Now Right Click on the biggest partition that has data on it which is /dev/sdb in this case and select Resize/Move
15 - Gparted resize select
You will then be presented with the following window
16 - Gparted resize select slider
Simply move the slider along to allocate all the space and then select Resize/Move as it will be highlighted, you will also see the there is now 0 Free Space following the resize
17 - Gparted resize select slider 2
You may now think you are done as the unallocated space is gone but you need to press the green tick to start the process and the click Apply
18 - Gparted resize start and apply
Wait for a moment
19 - Gparted processing
Once finished click Close and eject your Micro SD and put it back into your Pi.
20 - Gparted Finish
Kernel in use:
0 - Kali Pi Kernel
After this the Pi was booting up without error, detecting my Alfa and Netgear card’s and working with wireless injection 🙂 Stay tuned for some follow up’s on testing your wireless injection, getting SSH configured and fully updating your new custom image!
 

3 – Kali Pi Forwarding X over SSH

Now say for example you would like to see a graphical tool over SSH this is very easy and possible and all you have to do is add the -X switch after your normal ssh login

Step 1:

Forwarding X over SSH

ssh username@kali_ipaddress -X

1 - SSH Kali Forwarding X

1 – SSH Kali Forwarding X

Step 2:

Running wireshark with a graphical user interface (GUI) over ssh

wireshark &

2 - Start wireshark X forwarding

2 – Start wireshark X forwarding

Step 3:

Select OK to continue

3 - Wireshark click OK

3 – Wireshark click OK

Step 4:

Click OK again

4 - Wireshark click OK 2

4 – Wireshark click OK 2

Step 5:

Select the network interface you wish to capture on and click on Start

5 - select interface and click start

5 – select interface and click start

Result: A GUI environment over SSH and a very fast instance of wireshark running on such a small device

6 - Wireshark running

 

2 – Kali Pi after install what next

Now that we have Kali working on the Pi it is time to make some changes to the system and run updates.

I am going to carry out this work via SSH.

Step 1:

Run ssh username@kali_ip_address

1 - ssh to kali pi

1 – ssh to kali pi

Step 2:

Change the password by typing “passwd” and pressing enter, don’t worry when you don’t see anything appearing in the password field as this is normal and all you have to do is enter the new password correct twice

2 - kali change password

2 – kali change password

Step 3:

Update first with apt-get update

3 - kali apt-get update

3 – kali apt-get update

This should end without error like below

3.1 - kali apt-get update finish

3.1 – kali apt-get update finish

Step 4:

Once “apt-get update” has completed successfully you will want to run “apt-get upgrade”, you can run “apt-get upgrade -y” if you want to continue with any upgrades found

4 - kali apt-get upgrade

4 – kali apt-get upgrade

This should also end without error

4.1 - kali apt-get upgrade finish

4.1 – kali apt-get upgrade finish

A way to do this quickly can be seen below by linking the commands together

4.2 - kali quick update and upgrade

4.2 – kali quick update and upgrade

Step 5:

My last step is to reboot even though you don’t technically need to I like to do this myself after any updates or upgrades and it is quick

5 - Reboot kali

5 – Reboot kali

 

1 – Kali from Git clone and Booting in 19 steps + some more – UPDATED 24/02/2015

This has been left here for historical purposes, please see the new fully working guide here!

Ok I had a previous attempt running the install from Linux Mint 17 and I had some issues, one of those issues being a 3GB partition with only one script in it and nothing else which was a bit strange, I did however notice during creation certain folders failed to be found like “init” for example which at the time I figured was a bit odd but I proceeded nonetheless. What follows is a full guide on how I got Kali Linux running on the Raspberry Pi 2 successfully:

Step 1:

Create a directory to work out of and navigate into it

mkdir Kali-Git

cd Kali-Git

1 - Kali make dir

 

1.1 - Kali change dir

Step 2:

git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7 to pull down for the “armhf” image creation

2 - Kali Git Clone

Output once finished it should look as follows

2.1 - Kali Git Clone Finish

Step 3:

Check your working directory with “pwd” and then ls to check the gcc-arm directory is there and use this information to export the path

3 - Check pwd and directory

Step 4:

Export the path with /root/Kali-Git being the working directory and gcc-arm-linux-gnueabihf-4.7/bin being the directory and bin directory contained within that you just cloned from git

4 - Export Kali

Step 5:

Clone the kali-arm-build-scripts from github

5 - Clone Kali Arm Scripts

Output once finished it should look as follows

5.1 - Clone Kali Arm Scripts finish

Step 6:

Now as the Pi has a different architecture you need to modify the rpi.sh script in the cloned repository with the editor of your choice

6 - Change to Kali arm scripts dir

Step 7:

Modifying two separate locations as outlined in the below image

7 - Change Kali architecture

Step 8:

I also choose to comment out the last few lines at the end in order to be able to troubleshoot and not compress or build a shasum as you can see below and make sure to save it

8 - rpi script comment out

Step 9:

Copy the following pastebin script from here and create a new file in the kernel directory or alternatively run wget http://pastebin.com/download.php?i=Rv3zpsiv -O rpi-3.1.8.config from the terminal to do this for you and download it straight to the directory ready to edit.

9 - change kernel and create file

Step 10:

Paste the above pastebin content into the new file, save it and then modify the following line so that we can copy the Raspbian boot directory over afterwards as this is also required in order to make things run smoothly and get rid of X freezing. CONFIG_LOCALVERSION=”-v7″ to CONFIG_LOCALVERSION=”-v7+” you only need to add a + to the end.

10 - Change kernel

Step 11:

Fix any local dependencies you may require by running the following script

11 - Build Kali dependencies

Output of the above script should finish like the following with no errors

11.1 - Kali dependencies finish

Step 12:

Now modify the rpi.sh script for the kernel changes to be picked up and change the kernel number to match the file that you just created

12 - Kali config change

Step 13:

The output should initiate as below when the rpi.sh script is run with the version number of your choice and be patient as depending on your internet connection this can take some time to complete

13 - run rpi script

 

When finished it should look something like this

13.1 - run rpi script finish

Step 14:

Check the directory and your image are there

14 - check the kali image is created

Step 15:

Now it’s time to burn your image to your micro sd card with dd but first you will have to find your micro sd card. Use “fdisk -l” to list available partitions /dev/sda is my main local disk and /dev/sdb is the micro sd card. If you don’t know which one is your micro sd just unplug it and run “fdisk -l” again and see what has changed, then plug it back in again and you should see it now.

14.1 Kali list disk

Now it’s time to run the dd command to burn the image to the micro sd

Usage:

dd – to run and copy the image file

if=/the directory of your image file in this case the rpi-1.0.1 file directory

of=/the micro sd card to copy the image to

bs=1M – for a blocksize of 1MB

14.2 Kali dd to disk

Output should look similar to the following

14.3 Kali dd finish

Step 16:

I booted up at this stage and I was getting the freeze that was talked about on the Kali Linux forum once Kali is installed.

Step 17:

I then copied the boot loader partition from the Raspbian image over and replaced the files that had been installed on the Kali Pi image just created. First though you need to mount the Raspbian image to extract the boot loader

Calculate the block size for mounting first by calculating the number of bytes by the starting block so in this case 512 x 122880.

17 - calculate block size

Once you have this information you can then mount Raspbian with the following command

mount -o loop,offset=$((512 * 122880)) 2015-01-31-raspbian.img /mnt/raspbian

 

17.1 - mnt raspbian

Step 18:

Insert your Micro SD card create a folder in the Kali Pi /lib/ directory on the main partition called modules

18 - create modules directory

Step 19:

Copy the directory “3.18.5-v7+” from the Raspbian image over to theKali Pi /lib/modules/ directory that was just created. I advise opening a new terminal window for this though so you can check with “pwd” and get the correct working directory

19 - copy raspbian to kali

So from this we need to copy /mnt/raspbian/lib/modules/3.18.5-v7+ to the Kali Micro SD card  which is in the following directory for me and yours will be different to this /media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules

cp -r (Copy the directory)

/mnt/raspbian/lib/modules/3.18.5-v7+ (The Raspbian directory we are copying)

/media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules (Kali on the Micro SD card)

cp -r /mnt/raspbian/lib/modules/3.18.5-v7+ /media/96ceeab2-4f55-41fb-8e55-91cd598e066e/lib/modules

19.1 - copy raspbian to kali copied

Check the directory copied over correctly

19.2 - copy raspbian to kali copied check

Now to repeat a somewhat similar process of mounting and copying with the boot loader

19.3 - mount raspbian boot loader

Calculate the block size for mounting first by calculating the number of bytes by the starting block so in this case 512 x 8192.

19.4 - mount raspbian boot loader active

Now to Copy the boot-loader contents from the Raspbian Pi image to replace the contents of the Kali boot-loader but first remove all the contents on the Kali Micro SD card in the bootloader with “rm -rf *” Be careful with this as if you don’t know what you are doing you will remove the contents of the directory you are currently in. You have been warned.

19.6 - Kali boot loader directory clear

 

Copy the full directory, all contents on the Raspbian boot loader to the Kali Micro SD boot loader

19.7 - Kali boot raspbian copy

Check the Kali boot-loader again with ls and you should now see the Raspbian contents in the Kali boot-loader

19.8 - Kali boot raspbian copied

Result: Kali Pi is booting up and X is also working and I have to say it is extremely fast! The first Pi was so slow compared to this and I only ever used it via SSH and used the terminal. I don’t think I can use the old one any longer now after this, I might re-purpose it as something but from now all focus is on the RPi 2!

BUT! We need to also get the kernel patched for Wi-Fi injection also so 

Step 20:

SSH into your Kali distro

20 - recompile kernel for wi-fi

Using the editor of your choosing create a file called “recompile_kernel” or whatever you want like below and then copy and paste into your new file. Thanks to Cyberkryption for this as I hadn’t spotted it yet but this was the reason I was wanted to boot Kali on the Pi

sudo apt-get install linux-source
sudo apt-get install bc gcc gcc-4.6 libc-bin libc-dev-bin libc6 libc6-dev linux-libc-dev make manpages-dev
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
zcat /proc/config.gz > ~/linux/arch/arm/configs/pi_defconfig
mkdir -p ../patches
wget https://raw.github.com/offensive-security/kali-arm-build-scripts/master/patches/kali-wifi-injection-3.12.patch -O ../patches/mac80211.patch
patch -p1 --no-backup-if-mismatch < ../patches/mac80211.patch
make pi_defconfig
make modules
make modules install
sudo cp /boot/kernel.img /boot/kernel-bup.img
sudo cp arch/arm/boot/Image /boot/kernel.img

20.1 - recompile kernel for wi-fi

Should look like this

20.2 - recompile kernel for wi-fi

Now chmod +x the file to make it executable

20.3 - recompile kernel for wi-fi

Should look like this

20.4 - recompile kernel for wi-fi

 

Step 20 is not working for me yet and I am getting a few errors that I need to look into a bit further, Cyberkryption on the other hand has this working.

Going back to the start of step 20 again to get wi-fi injection working on the Pi

Step 20 revisited:

I was having problems with installing “linux-source” so I had to run “apt-get update –fix-missing” first to rectify the problem, most likely due to something I was doing last night

1 - apt-get-update-fix-missing

It finished like this

1.1 - apt-get-update-fix-missing-finish

Now to run “apt-get install linux-source” again and accept with -y

2 - linux-source

It finishes like this

2 - linux-source-finish

Now run “apt-get install bc gcc gcc-4.6 libc-bin libc-dev-bin libc6 libc6-dev linux-libc-dev make manpages-dev” but as that step had ran without issue previously this step was already completed last night.

3 - more install

Now run “git clone –depth=1 https://github.com/raspberrypi/linux” and it should finish like below

4 - git linux

“cd” into linux and “ls” to check the contents

5 cd linux and ls

Output the current kernel
zcat /proc/config.gz > ~/linux/arch/arm/configs/pi_defconfig
6 - output current kernel

Make a directory called patches in the previous directory where you created the linux file

7 make dir patches

Run:
wget https://raw.github.com/offensive-security/kali-arm-build-scripts/master/patches/kali-wifi-injection-3.12.patch -O ../patches/mac80211.patch
patch -p1 –no-backup-if-mismatch < ../patches/mac80211.patch
8 - wifi injection patch
Patch:
patch -p1 –no-backup-if-mismatch < ../patches/mac80211.patch
9 - wifi injection patched

make pi_defconfig

10 - Write kernel config

make modules – currently looks like this after a few hours so be patient!

11 - make modules

TO BE CONTINUED!

Congratulations on making it this far, have fun!

References:

Kali Fourm

Cyberkryption Blog

Big thanks to:
mame82, Ram0n & Cyberkryption for fixes along the way and sharing their knowledge.