From charlesreid1

 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page is a guide on installing Kali Linux on the Raspberry Pi: [[Kali Raspberry Pi]]
[[Image:KaliPi.jpg|400px]]


For generic installation instructions with Raspbian on a Raspberry Pi, see this page: [[RaspberryPi/Installing]]  
This is a guide to installing Kali Linux on an SD card for a Raspberry Pi. General info about running Kali on the Pi here: [[Kali Raspberry Pi]]


For general information/pages about Kali Linux, see this page: [[Kali]]
More info about all-things Kali Linux: [[Kali]]


=Installing Kali 2017.1 on Raspberry Pi=


=Installing Kali on Raspberry Pi=
As with prior versions of Kali Linux, there are several ARM images provided at the Offensive Security website: https://www.offensive-security.com/kali-linux-arm-images/


To install Kali Linux on a Raspberry Pi, you'll need to go through the usual process of putting a disk image on an SD card, then booting the Pi from the image. This follows the usual steps.
For old Raspberry Pis (2 usb ports, regular SD card slot), get the image labeled "RaspberryPi".
 
For newer Raspberry Pis (4 usb ports, mini SD card slot), get the image labeled "RaspberryPi 2/3".
 
=Installing Kali 2.0.1 on Raspberry Pi=
 
Download and verify the "Raspberry Pi" image (if you have a Raspberry Pi model B) or the "Raspberry Pi 2" image (if you have a Raspberry Pi model B+) from Offensive Security's web page: https://www.offensive-security.com/kali-linux-arm-images/
 
To install Kali Linux on the Pi, you'll download the image, decompress it, and flash an SD card with that image. You will need an 8 GB or larger SD card to run Kali 2.0.


==Step 0: Download image from Kali==
==Step 0: Download image from Kali==


Kali provides custom images for Raspberry Pis, so download the compressed img file for your Pi. Download it, and unzip it.  
Kali provides custom images for Raspberry Pis, so download the compressed img file for your Pi: https://www.offensive-security.com/kali-linux-arm-images/
 
Download the image, which is an xz file.
 
Decompress the xz file with <code>tar xz kali-2.0.1-rpi.img.xz</code>.
 
You will flash the SD card with the resulting <code>.img</code> file.


==Step 1: Find SD Card==
==Step 1: Find SD Card==
Line 35: Line 50:


<pre>
<pre>
$ dd bs=1m if=kali-1.1.1-rpi.img of=/dev/disk1
$ dd bs=1m if=kali-2.0.1-rpi.img of=/dev/disk1
3000+0 records in
3000+0 records in
3000+0 records out
3000+0 records out
Line 43: Line 58:
This should take about 20 minutes.
This should take about 20 minutes.


==Modify Startup Command==
==Step 4: Modify Startup Command==
 
Before you eject the SD card, you'll want to modify the startup command. Edit the file <code>/Volumes/NO NAME/cmdline.txt</code> and add a static IP address <code>ip=169.254.113.200</code> to the end:
 
<pre>
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ip=169.254.113.200
</pre>
 
(see [[Kali Raspberry Pi/Headless]] or [[RaspberryPi/Headless]] for details on this procedure)
 
 
 
 
=How the Startup Disk Works=
 
What happens when you actually flash the image onto the SD card?
 
Well, it creates two different partitions on the SD card. The first partition is about 64 MB, that contains everything the Pi needs to boot. The second partition is about 3 GB, and contains the operating system files itself.
 
However, if you're on a Mac, the Mac won't mount the second, larger partition, because it's managed with the ext4 file system, so you will only see one 64 MB partition.
 
Do you need to be able to edit the large partition? Only if you want to modify the contents of the Linux installation, such as adding startup services, modifying run levels, or changing configuration files for software. Otherwise, you'll only need to modify the boot partition.
 
If you do need to modify the larger Linux ext4 partition, you can install the whole MacFUSE bundle, which will allow you to mount ext4 filesystems as though they're native filesystems. Or you can use a Linux computer for those edits.
 
==The SD Card from Mac==
 
Here's the SD card on the Mac:
 
[[Image:KaliSDMac.png|300px]]


and the output of <code>diskutil list</code>:
Before you eject the SD card, you'll want to modify the startup command. Edit the file <code>/Volumes/NO NAME/cmdline.txt</code> and add a static IP address <code>ip=169.254.111.111</code> to the end:


<pre>
<pre>
$ diskutil list
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ip=169.254.111.111
[...]
/dev/disk1
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:    FDisk_partition_scheme                        *15.9 GB    disk1
  1:            Windows_FAT_32 NO NAME                64.0 MB    disk1s1
  2:                      Linux                        3.1 GB    disk1s2
</pre>
</pre>


I could only see the 64 MB FAT partition from the Mac, but I needed to edit the 3.1 GB Linux partition to modify what services start on boot.
For more details on this procedure, see [[Kali Raspberry Pi/Headless]] or [[RaspberryPi/Headless]]


===The SD Card from Linux===
For more details on how the SD card works, see below.


I rebooted my Mac laptop into Kali to take a look at the SD card again.


When I plugged the SD card into the SD slot of my MacBook, I didn't see the device anywhere. No command would show it anywhere.


Finally, I just plugged the SD card into an external USB card reader and plugged the reader into my laptop. The SD card opened immediately in the file browser.
==(Outdated) Instructions for Kali Version 1 on Pi==


Now take a look using parted:
For instructions installing the older version of Kali, version 1.0, on the Pi, see [[Kali Raspberry Pi/Installing Version 1]]


<pre>
=Kali Linux SD Card=
$ parted -l


Model: USB Mass  Storage Device (scsi)
see [[Kali Raspberry Pi/SD Card]]
Disk /dev/sdb: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
 
Number  Start  End    Size    Type    File system  Flags
1      512B    64.0MB  64.0MB  primary  fat16        lba
2      64.0MB  3146MB  3082MB  primary  ext4
</pre>
 
Now we can see both partitions of the SD card, which means we can edit the startup procedure of the Kali Pi and initiate sshd. But before we do anything to the SD card, we have to mount it:
 
<pre>
$ mkdir usb1
$ mount /dev/sdb1 usb1
$ mkdir usb2
$ mount /dev/sdb2 usb2
</pre>
 
But then I saw that the SSH service was already set to be started. Following the link above on Raspberry Pi Stack Exchange, the thread states that there should be a <code>etc/rc2.d/S02ssh</code> to automatically start on runlevel 2. But that is already there.
 
Ugh. Okay, let's plug the Pi into our wireless router, force it to take a static IP address in the router's range, and go from there.
 
Edit <code>cmdline.txt</code> in the boot partition of the SD card, and change the IP address assignment by adding this to the end:
 
<pre>
ip=10.0.0.114
</pre>
 
Unmount the SD card:
 
<pre>
$ umount usb1
$ umount usb2
</pre>


Now plug the SD card back into the Pi, and plug the Pi into your laptop.




{{PiFlag}}


[[Category:Kali]]
{{KaliFlag}}
[[Category:Raspberry Pi]]

Latest revision as of 21:53, 8 May 2017

KaliPi.jpg

This is a guide to installing Kali Linux on an SD card for a Raspberry Pi. General info about running Kali on the Pi here: Kali Raspberry Pi

More info about all-things Kali Linux: Kali

Installing Kali 2017.1 on Raspberry Pi

As with prior versions of Kali Linux, there are several ARM images provided at the Offensive Security website: https://www.offensive-security.com/kali-linux-arm-images/

For old Raspberry Pis (2 usb ports, regular SD card slot), get the image labeled "RaspberryPi".

For newer Raspberry Pis (4 usb ports, mini SD card slot), get the image labeled "RaspberryPi 2/3".

Installing Kali 2.0.1 on Raspberry Pi

Download and verify the "Raspberry Pi" image (if you have a Raspberry Pi model B) or the "Raspberry Pi 2" image (if you have a Raspberry Pi model B+) from Offensive Security's web page: https://www.offensive-security.com/kali-linux-arm-images/

To install Kali Linux on the Pi, you'll download the image, decompress it, and flash an SD card with that image. You will need an 8 GB or larger SD card to run Kali 2.0.

Step 0: Download image from Kali

Kali provides custom images for Raspberry Pis, so download the compressed img file for your Pi: https://www.offensive-security.com/kali-linux-arm-images/

Download the image, which is an xz file.

Decompress the xz file with tar xz kali-2.0.1-rpi.img.xz.

You will flash the SD card with the resulting .img file.

Step 1: Find SD Card

When you run this command, you should be able to spot the SD card from its size. If you can't figure out which one it is, run it before and after you plug in the SD card.

$ diskutil list

Mine's at /dev/disk1.

Step 2: Unmount Disk

$ diskutil unmountDisk /dev/disk1

Step 3: Format Disk

WARNING: You can screw up your disks with the dd command. Be careful.

$ dd bs=1m if=kali-2.0.1-rpi.img of=/dev/disk1
3000+0 records in
3000+0 records out
3145728000 bytes transferred in 1535.984002 secs (2048021 bytes/sec)

This should take about 20 minutes.

Step 4: Modify Startup Command

Before you eject the SD card, you'll want to modify the startup command. Edit the file /Volumes/NO NAME/cmdline.txt and add a static IP address ip=169.254.111.111 to the end:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ip=169.254.111.111

For more details on this procedure, see Kali Raspberry Pi/Headless or RaspberryPi/Headless

For more details on how the SD card works, see below.


(Outdated) Instructions for Kali Version 1 on Pi

For instructions installing the older version of Kali, version 1.0, on the Pi, see Kali Raspberry Pi/Installing Version 1

Kali Linux SD Card

see Kali Raspberry Pi/SD Card