Skip to content

Lab Installation

w4sp-book edited this page Aug 5, 2017 · 8 revisions

!!NOTE!! - There is currently a bug in lab startup!

If you run into an error where the lab setup is stuck at the "Setting Up Lab Environment...." screen and there is an error in the terminal about "Broken Pipe" - Simply refresh the browser and the lab will be fully functional, this is strictly a UI bug on initial setup.

This will be kept updated to reflect the most recent installation instructions for the w4sp-lab. Lab installation is assumed to be done from a freshly updated x64 Kali installation (x86 Kali is not supported). This can be done by running the following command:

sudo apt-get update && sudo apt-get dist-upgrade

Kali is a rolling target and is constantly updated, therefore it is advisable to create a snapshot after a successful upgrade, this way if an upgrade in the future breaks an installation you have a clean base to restart from. Additionally with the lab you should create a snapshot after successful installation in case there is a breaking change down the line.

From the root user download the zip file from here. From the terminal change directories to where the zip file was saved, by default this will be the Downloads folder. Then unzip the archive using the command as shown below:

root@w4sp:~# cd Downloads/
root@w4sp:~/Downloads# unzip w4sp-lab-master.zip 
Archive:  w4sp-lab-master.zip
8e936a42759d6d58dbd6b34b22b6f5860b2bc45d
   creating: w4sp-lab-master/
  inflating: w4sp-lab-master/.gitignore  
  inflating: w4sp-lab-master/README.md  
   creating: w4sp-lab-master/images/
   creating: w4sp-lab-master/images/base/
  inflating: w4sp-lab-master/images/base/Dockerfile  
  inflating: w4sp-lab-master/images/base/supervisor.conf  
  inflating: w4sp-lab-master/images/base/supervisor_dhclient.conf

#... output truncated for brevity

Now change to the w4sp-lab-master/ directory and run w4sp_webapp.py:

root@w4sp:~# cd Downloads/w4sp-lab-master/
root@w4sp:~/Downloads/w4sp-lab-master# python w4sp_webapp.py 
Collecting netifaces
  Downloading netifaces-0.10.5.tar.gz
Building wheels for collected packages: netifaces
  Running setup.py bdist_wheel for netifaces ... done
  Stored in directory: /root/.cache/pip/wheels/9f/40/bd/1f8e0f83e36399900d81bebfd7ece579931ced3a5d9383284b
Successfully built netifaces
Installing collected packages: netifaces
Successfully installed netifaces-0.10.5
[*] w4sp-lab user non-existant, creating
['useradd', '-m', 'w4sp-lab', '-s', '/bin/bash', '-G', 'sudo,wireshark', '-U']
[*] Please run: 'passwd w4sp-lab' to set your password, then login as w4sp-lab and rerun lab

The first thing the lab does is create the w4sp-lab user, however a password is not configured (no hardcoded credentials). The password can be configured using the passwd command, specifying the w4sp-lab username:

root@w4sp:~/Downloads/w4sp-lab-master# passwd w4sp-lab 
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Now log out of the root user and login as the newly created w4sp-lab user by clicking in the upper right arrow, selecting the root user and then Log Out. You can also just reboot the machine to be prompted with the login screen.

Now you can change to the w4sp-lab-master directory and run w4sp_webapp.py

w4sp-lab@kali:~$ cd /root/Downloads/w4sp-lab-master/
w4sp-lab@kali:/root/Downloads/w4sp-lab-master$ python w4sp_webapp.py 
[*] Script must be run as root! Exiting
w4sp-lab@kali:/root/Downloads/w4sp-lab-master$ sudo python w4sp_webapp.py

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for w4sp-lab: 
['which', 'dumpcap']
['getcap', '/usr/bin/dumpcap']
[*] Caps set correctly on dumpcap
Hit:1 http://archive-7.kali.org/kali kali-rolling InRelease
Reading package lists... Done

# ... output truncated for brevity

Note that to create the lab environment the docker images have to be initially built, this involves installing and configuring all of the software needed to power the lab, so it can take a little while, especially for the base image. So when you get to the following section please be patient and remember that the next time you run the lab you won't have to wait:

[*] Not enough w4sp/labs images found, building now
/root/Downloads/w4sp-lab-master/images
['docker', 'build', '-t', 'w4sp/labs:base', 'base']
['docker', 'build', '-t', 'w4sp/labs:vrrpd', 'vrrpd']
['docker', 'build', '-t', 'w4sp/labs:elk', 'elk']
['docker', 'build', '-t', 'w4sp/labs:wireless', 'wireless']
['docker', 'build', '-t', 'w4sp/labs:ftp_tel', 'ftp_tel']
['docker', 'build', '-t', 'w4sp/labs:samba', 'samba']
['docker', 'build', '-t', 'w4sp/labs:temp', 'temp']
['docker', 'build', '-t', 'w4sp/labs:switch', 'switch']
['docker', 'build', '-t', 'w4sp/labs:victims', 'victims']
['docker', 'build', '-t', 'w4sp/labs:inet', 'inet']

When the lab finishes installing a web browser should open (or a tab in an already opened browser) showing the lab interface. From there the terminal can be ignored and the lab should be controlled from the web UI.