Monday, May 12, 2014

How to triple boot a Macbook Pro with Kali Linux and Windows 7

In my quest to create a pen test lab, I discovered that I just don't have enough ram to run everything I want to in virtual machines.  I have a late 2011 Macbook Pro running OSX Mavericks.  Why do I need physical installations of Windows 7 and Kali Linux?  Emulating android within Kali, within OSX, was painfully slow.  There are are android tools that work best within native Windows installations, and password cracking things like WPA2 on Kali tends to work better when you're not limited by the constraints of VMware Fusion and their lackluster GPU support.

Triple booting my Macbook was painfully more annoying than any multi-boot set up on any device I have encountered.  This is because it became a source of ongoing psychosis in the face of utter failure.  I couldn't let my computer beat me, so this is how I won:

*This guide probably wont help you with your Macbook air
*This method is only going to work if you have 1 partition to begin with
*I'm not responsible if you lose your data, you should have backed it up
*I'm assuming you've installed operating systems before and you're familiar with the setup for Windows and Kali Linux, and some command line stuff

--First off, you're going to need 2 DVDs, one for Kali Linux, and one for Windows 7.
(DVDs, not flash drives.  I tried the flash drives, it was a nightmare)

--You're also going to need 1 flash drive > 2gb

--Download and install refit

--Download and install fdisk for mac

--Put the Windows 7 disk in your computer, insert your flash drive, start boot camp assistant

--Click continue, Check the boxes next to 'Download the latest Windows Support Software from Apple' and 'Install or remove Windows 7 or later'.  Then click continue.  (You'll want that support software when it comes time to install drivers in Windows, because your wireless internets wont work immediately after post installation)

--Select your flash drive as the destination for your Windows driver pack.

--Wait as it downloads and does it's thing.

--When the partition screen comes up, go ahead and resize it if you like.

--Let it do it's thing till it reboots into your Windows setup disc

--Click next, install, custom installation, etc.  When you reach the hard drive/ partition page, click the bootcamp partition.  Click advanced options.  Delete it, click new, click next.  Grab a snack while Windows installs.

--Once Windows is done and you're on your Windows 7 desktop, eject your installation DVD, restart your computer (install your drivers when you're done with this guide, it can wait).  Wait for the chime and hold down your 'alt' key.  Select OSX, if refit comes up, select OSX again.

--When OSX has booted, open up Disk Utility, and select your hard drive.  Click the partitions tab and click the + sign, adjust the size to fit your Kali installation.  Label it Kali or anything you like.  Set the partition type as fat or exfat.  Apply liberally.

--Put your Kali disc in your computer and restart it.

--Refit should come up, select the linux disc when it does, select restart if it doesn't sometimes the drive doesn't spin up fast enough.

--Install Kali linux, when it asks you for the missing firmware just skip it.  You can install that later too

--Go through the installation like you normally would, when you get to the partitioning setup, click manual.

--Select your disk labeled Kali, or whatever you chose to call it.  Look at the number next to it, which partition number is it?  Remember it, we'll call it partition X for the purpose of this guide.  Select this partition, set root point as /, format as ext4, and set it as bootable.

--Save the changes and continue with the setup, ignore the swap partition message, deal with it later.

--Grab another snack, possibly a scone.  Wait till the installer finishes.  It'll ask you where you want to install grub, type in /dev/sdaX (X is our place holder for that number I had you remember)

Congratulations!  Both of your installations are now broken!

--Restart your computer into OSX

--Eject your Kali Linux install disk

--Open terminal and type
sudo gdisk /dev/disk0
r
p
It'll list your partitions
h
--It'll ask you to put the partitions in that you want to be able to boot from, for me it was 2 3 4
--It'll ask you if you want to put the efi partition first, you should do that.
--It'll ask you for the MBR codes, refer to the list of your partitions and add the first 2 digits of the hexidecimal number (defaults should work)

--Don't set any flags as bootable

--Once finished hit w if you messed up hit q and try it again.

--Restart your computer, in the refit menu select the linux installation

--It should give you the option to boot all the things.

--Finish your driver installs and do your thing