Windows

Setup the Capsulecorp-pentest on a dedicated Windows lab machine.

This guide assumes you will be using Hyper-V. During all of my testing, Hypver-V outperformed VirtualBox and VMware on the Windows system I used to create this guide. If you prefer to use an alternate hypervisor, you do so without the support of this documentation.

Documentation for additional hypervisors will be created in the future

It's best to use a dedicated lab machine as these VMs eat up a lot of resources

1. Enable Hypver-V

In order to get the best experience on a Windows machine, enable the native hypervisor Hyper-V from the Windows Features menu. You may be required to restart your computer

  1. Click on the Windows button and start typing the word "add"

  2. Click on "Add or remove programs"

  3. Click "Programs and Features"

  4. Click Turn Windows features on or off"

  5. Check the box next to "Hyper-V"

  6. Click OK

2. Install & Configure WSL

At the end of the day, Ansible and Vagrant just work better from a Linux/UNIX environment. You'll need to install WSL and configure a few environment variables for everything to work as it should.

In this guide I make use of the "Terminal Preview" app from the Microsoft app store. This makes it easier to switch back and forth between a Windows command prompt, PowerShell prompt and an Ubuntu bash prompt.

  1. Open up an administrative command prompt by Ctrl+Shift clicking on the Terminal Preview app launcher

  2. Run the command: wsl --install

  3. Restart your computer when the command finishes

  4. Enter a username and password to use within your Ubuntu subsystem

  5. Update the package manager with sudo apt update

  6. Upgrade to the latest version of Ubuntu with sudo apt dist-upgrade

3. Install Ansible

  1. Install pip with sudo apt install python3-pip

  2. Install ansible with pip: pip3 install ansible --user

This will install ansible inside your ~/.local/bin directory. You'll need to modify your ~/.bashrc file to contain set PATH=~/.local/bin:$PATH in order to use the ansible command

Alternatively you can install ansible with apt: sudo apt install ansible

4. Install Vagrant

To install Vagrant browse to https://developer.hashicorp.com/vagrant/downloads and select the appropriate Debian package (presumably Amd64). Grab the URL to the download link and use wget to download the .deb package to a folder within your WSL environment

wget https://releases.hashicorp.com/vagrant/[ver#]/vagrant_[ver#]_x86_64.deb

Install the .dep package using dpkg -i Then modify your ~/.bashrc file to contain the following:

export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"

Don't forget to run source ~/.bashrc and then you should be able to run the vagrant command within your WSL environment.

4.1. Necessary vagrant plugins

A few vagrant plugins are required to launch and provision all of the VMs. If you below vagrant plugin install commands fail, open up an administrative PowerShell prompt and run the command.

Restart-Service LxssManager

References:

Vagrant plugins:

  1. vagrant plugin install winrm

  2. vagrant plugin install winrm-fs

  3. vagrant plugin install winrm-elevated

5. Clone Github Repo

Navigate to an appropriate folder within your WSL environment and checkout the repo from Github.

cd /mnt/c/Users/royce/
git clone https://github.com/R3dy/capsulecorp-pentest.git
cd capsulecorp-pentest

Familiarise yourself with the congents of the Vagrant file. If you need to make any changes to the VMs such as CPU/Memory changes or pick a different base box then this is the file you'll want to edit.

Vagrantfile

6. Create Hypver-V Virtual Switch

  1. Open up the Hyper-V Manager and click on the Virtual Switch Manager link from the Actions menu.

  2. Create a New virtual network switch and name it Capsulecorp-pentest. Check the External network radio button and select the appropriate network adapter from the dropdown list.

You'll specify this Virtual Switch each time you bring up a VM with vagrant up

Last updated