Kali linux

From regional-training
Revision as of 20:35, 9 August 2022 by Ralph (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Kali linux is popular for penetration testing (PenTest) and forensics. It is a neat version based on a cut-down debian, and includes those extra utilities that you need when snooping around. It also contains a comprehensive set of non-free drivers for all those obscure devices, from legacy to current hardware - so your WiFi is likely to work out of the box. I copied the kali /lib/firmware to some legacy laptops and got them "working".

From experience I recommend the Kali Light (which has less overhead to the default gnome implementation). I also recommend using an i386 image, because it is then guaranteed to work on all machines, including those legacy machines.

downloads

Read the following

/etc/apt/sources.list

  • ensure you obtain the key:
wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add
  • then ensure you have the source.list correct
   deb http://http.kali.org/kali kali-rolling main contrib non-free
   deb-src http://http.kali.org/kali kali-rolling main contrib non-free
  • then you can update and install
   apt update
   apt install sysstat

Here is my recipe on how to make a bootable USB drive from a .iso image with a persistence partition behind it (this will work for all sorts of linux .iso images):

  • Insert a USB drive into the computer and execute
fdisk -l
Disk /dev/sdd: 7.2 GiB, 7743995904 bytes, 15124992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7cc8dfcc
  • Write the iso (note my usb drive appears at /dev/sdd
dd if=kali-linux-live.iso of=/dev/sdd bs=1M

confirm

sudo fdisk -l
Disk /dev/sdd: 7.2 GiB, 7743995904 bytes, 15124992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7cc8dfcc
Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdd1  *         64  1765375  1765312  862M 17 Hidden HPFS/NTFS
/dev/sdd2       1765376  1766783     1408  704K  1 FAT12
  • Now extend the USB drive with fdisk
sudo fdisk /dev/<usb-dev>
n  // new
p  // primary partition

3  // partition number
   // first sector
   // second sector
w
q
  • now put a FS on the 3rd partition
 sudo mkfs.ext4 /dev/persistence
 sudo e2label /dev/persistence persistence
  • establish a persistence.conf in that file system
mkdir -p /mnt/persistence
mount /dev/sdd3 /mnt/persistence
echo "/ union" > /mnt/persistence/persistence.conf
umount /mnt/persistence

You know how a bootable USB stick with a primary partition following the two kali linux partitions. You can place useful stuff in this partition instead of wasting the remainder of your USB stick. You can use this partition to transfer things between boxes, or place things there that you wish to persist between kali boots.

between boxes, or place things there that you wish to persist between kali boots.

The same technique can be employed when making a card for the raspberry pi - though people usually start with a truncate card and extend it via and simply execute the following command after the pi boots:

expand_rootfs

Of course this makes the last partition a lot bigger to backup when you use the dd or dc3dd command.