Friday, 28 April 2017

Kali Linux Live With Persistence

First, you'll need a program to install Kali on your USB drive and make it bootable. My program of choice is Universal USB Installer, as it's painfully easy to use and it has a direct link to many Linux distros download page within the program.

Search for this button, and get the program. Once you run it, you'll see a disclaimer page. Accept it (or read it first, if you feel like it), and you'll be presented with the configuration section (after a few seconds). Choose Kali from the dropdown menu:

Once you have downloaded your Kali image, select it:

And then choose the drive letter for your USB drive (you probably won't need to use that checkbox on the right side). Be careful when doing this.

I'd recommend to check the box that formats your USB drive. That'll wipe your whole USB drive, make sure you back up everything you had there before proceeding. It'll make a quick format, so there's no reason to avoid this.

Click on Create, then Yes, and it'll do the whole process by itself. The longest part will be extracting the ISO to your USB, but it'll be over in a matter of minutes.

If everything went as expected, you'll see this, and you have a USB you can Live boot you Kali from.

Setting Up Perisitence
You liked to Live boot from USB, but you want to save changes made into your OS, or just files (such as .pcap files) into your USB drive? You'll need to set up Persistence. Your USB drive must have 8 GB+ of storage space.
Download Mini Tool Partition Wizard Free, install it, run it and then choose Launch Application.
Right click on your USB drive, and click on Move/Resize

Use the small black arrow keys to shrink the partition size. It will leave a bit of storage space free, but if you manually assign the Partition Size, the program may fail. Click OK.

A new big grey chunk of unallocated space as appeared! Right click on it and click on Create. It'll warn us that Windows won't be able to see that partition, but we don't care about that ;)

Pick this options:
· Create as: Primary
· File System: Ext4
· Partition Label: persistence
Then click OK.

Now click on Apply (upper left corner), and just wait for it to complete the tasks.

Setting Up The Persistence

Once the partition manager finished, reboot your computer and boot up from your USB drive. Choose the option "Live USB Persistence", and when it's booted up, open a Terminal and use these commands:
Determine which partition of your drive you'll use

fdisk -l

Remember your drive had a FAT32 partition and a Ext4 (Linux) one?

Make a directory on the filesystem to mount your USB

mkdir -p /mnt/my_usb

Mount the partition on the directory you made (don't click the desktop icon labeled persistence!)

mount /dev/sdc2 /mnt/my_usb

Add a configuration file to enable persistence

echo "/ union" > /mnt/my_usb/persistence.conf

Unmount the partition and reboot

umount /dev/sdc2 && reboot

Now, if you boot up to Live USB Persistence, you'll be able to save stuff everywhere on your Linux filesystem, and every configuration you make locally will be available everywhere you plug it in :)