Installing Linux on a Live Windows System

As you may know, I run the Red Team for the Collegiate Cyber Defense Competition (CCDC) in the southwest region. One of the more interesting things I put together for the regional competitions this year was a way to install Linux remotely over a command-line interface (such as meterpreter). I actually originally wrote it for a hypervisor rootkit, but it can be used for a simple Linux install as well.

It works by using windows diskpart commands to create a new primary partition, (shrinking an existing partition as necessary) setting it to be bootable, then writing out a compressed linux install into that partition, and installing the syslinux bootloader into the MBR. It can keep a backup of the original MBR in the new partition as well. For SWCCDC, I used a small image from a TinyCore install I modified with a little red team branding:

It leaves the original partitions intact, so if you wanted to use a Linux partition image with GRUB installed, it's entirely possible to make a multiboot Linux install via this method, or recover easily if you accidentally do it to yourself.

You can download the code here: installlinux.tgz The code is released under the GPL, which can be found here:

  1. #1 by geexter on February 5, 2014 - 5:28 am

    One of ‘THE’ best script i ever seen, Thanks for this (:

  2. #2 by guset on September 15, 2014 - 9:28 pm

    looks great but the tar seems to be corrupt

    tar zxvf ~/installlinux.tgz
    x zlib-1.2.7/
    x zlib-1.2.7/gzread.c
    tar: Damaged tar archive
    tar: Retrying…
    tar: Damaged tar archive
    tar: Retrying…
    tar: Damaged tar archive
    tar: Retrying…

    • #3 by scriptjunkie on September 17, 2014 - 7:10 pm

      Not sure what happened. Try again and let me know.

(will not be published)