Monday 3 August 2009

Multiboot USB, Finally !!

So a while ago there was an episode on Hak5 which showed how to make a USB bootable with a number of different distros.
Its perfect and something I have been wanting to do with Ophcrack and BackTrack for a while.

So what needed to start off ;
> USB drive, any size, but would recommend 8 - 16 gig, why not, it is cheap enough these days.
> Your live distro's of choice
> Additional software to prepare the USB


PREPARING YOUR USB DISK
=======================

The process is fairly straightforward and only a few bits of software (free) are needed ;

1. PeToUSB v3.0.0.8
http://gocoding.com/page.php?al=petousb
http://eaz.nm.ru/download/PeToUSB_3.0.0.8.exe

This software will format the USB drive and make it bootable.

2. grubinst v1.0.1
http://sourceforge.net/projects/grub4dos/files/grubinst/grubinst%201.0.1/grubinst_1.0.1_bin_win.zip/download

This will install the MBR on the USB flash drive.

3. grub4dos v0.4.4
http://sourceforge.net/projects/grub4dos/files/GRUB4DOS/grub4dos%200.4.4/grub4dos-0.4.4.zip/download

You actually only want this for a file which is included; gldr


So proceed as follows;

1.
==
Plug in your USB key and start up PeToUSB.
It will check your disks on starting up and will list them, choose the one you want to make bootable and under format options, check ;
Enable Disk Format
Quick Format
Force Volume Dismount
(! This will format your USB drive, make sure you are choosing the right one and didnt have anything left on it !)


























Click Start and then Yes to start the formatting then close down the program when complete.






















Now it is possible that the drive is not formatted as FAT32, so do the following to ensure it is;

Right-click My Computer --> Manage --> Disk Management




Choose your USB drive, make sure you are choosing the correct one !
Right click it and choose format and then choose FAT32.





Leave this window open as you will need it in next step.


1st step complete !

Next is to start up grubinst.
2.
==
Extract the contents of the gruninst zip file to a folder (I created the folder C:\Program Files\GrubInst).
Open the grubinstGUI

































!VERY IMPORTANT!

Check, double check and then re-check again what drive your USB disk is in disk management.
In this example, you can see in disk management that it is drive 3.
In grubinst_GUI choose the correct drive from the dropdown list, leave all else unchecked and
click on install.

































When the popup comes that MBR has been successfully installed, all is good and grubinst can be closed.




Thats it for step 2!

3.
Extract the grub4dos to a folder and copy the file grldr to the root of your USB disk.

































Your USB drive is now prepped and ready to continue !

All the above just done on a 1G stick (all I had empty and handy at the time..)
but of course much better to do it on a much larger one so that you can fit more
distros on it !


Distros
=======

So now the USB drive is prepared, time to put the distro's on.

For example I only have 3 on my 16G usb drive ;

BackTrack 4 Pre Final
http://www.remote-exploit.org/backtrack_download.html
OphCrack (live cd)
http://ophcrack.sourceforge.net/
KonBoot
http://www.piotrbania.com/all/kon-boot/
(I downloaded the floppy drive image)

For Backtrack and Ophcrack you need to extract the iso to the USB and then rename the boot folder for each one.
So after extracting the backtrack.iso to the USB drive, there will be two folders; casper & boot.

Rename the boot folder to for instance "bootBT4"

Then extract the Opcrack live cd and rename the opcrack boot folder to for instance "bootOPH"

For KonBoot, you can copy the image directly to the root of the USB drive.




Boot menu
========

So now all the distros are on the USB we need to make the boot menu point to the right areas.

1.
Right-click in the root of the USB drive and create new txt file, save this as menu.lst


The exact text required will change depending on how you named your boot folders and konboot image, but mine is very simple and looks like this ;

color blue/black lime/blue
timeout 120


#BT4 Pre Final, Pentesting utilities
#Without persistant changes
#------------------------------------
title BackTrack4 Pre Final
kernel /bootBT4PF/vmlinuz BOOT=casper boot=casper nopersistent rw quiet vga=0x317
initrd=/bootBT4PF/initrd.gz
rootnoverify


#KON-BOOT, bypassing windows passwords
#-------------------------------------
title Kon-Boot FD
map --mem /FD0-konboot-v1.1-2in1.img (fd0)
map --hook
chainloader (fd0)+1
map (hd1) (hd0)
map --hook
rootnoverify (fd0)


#OPHcrack, windows password cracking
#with rainbow tables, XP Special
#------------------------------------
title Ophcrack
kernel /bootOPH/bzImage rw root=/dev/null vga=normal lang=C kmap=us screen=1024x768x16 autologin
initrd /bootOPH/rootfs.gz


#Reboot the system
#-----------------
title Reboot
reboot

My directories look like this;


So now you have a fully functioning multi boot USB drive !

The forums at hak5 have some interesting and helpful info on how to do the above and also nice examples of menu.lst
http://hak5.org/forums/index.php?showtopic=13842


Enjoy !
 
Google Analytics Alternative