|
| 1 | +# Setting Up the Environment |
| 2 | + |
| 3 | +We will be using vagrant to standardise the environment so following the lesson |
| 4 | +plan is easy. The Vagrantfile will provision the appropriate pre-requisites but |
| 5 | +please go through this document to get an understanding of the steps required to |
| 6 | +prepare the testing environment. |
| 7 | + |
| 8 | +## Mandatory Steps |
| 9 | + |
| 10 | +First, install vagrant and virtualbox. Vagrant can be downloaded from [this |
| 11 | +link](vagrantdl). Virtualbox can be downloaded from [here](virtualboxdl). |
| 12 | + |
| 13 | +Next, clone the repository onto your host machine. |
| 14 | + |
| 15 | +```shell |
| 16 | +amon@bethany:~$ git clone https://github.com/nnamon/linux-exploitation-course.git |
| 17 | +Cloning into 'linux-exploitation-course'... |
| 18 | +remote: Counting objects: 19, done. |
| 19 | +remote: Compressing objects: 100% (14/14), done. |
| 20 | +remote: Total 19 (delta 2), reused 15 (delta 1), pack-reused 0 |
| 21 | +Unpacking objects: 100% (19/19), done. |
| 22 | +Checking connectivity... done. |
| 23 | +amon@bethany:~$ |
| 24 | +``` |
| 25 | + |
| 26 | +Now, bring the vagrant box up. |
| 27 | + |
| 28 | +```shell |
| 29 | +amon@bethany:~/sproink/linux-exploitation-course$ vagrant up |
| 30 | +Bringing machine 'default' up with 'virtualbox' provider... |
| 31 | +==> default: Importing base box 'ubuntu/xenial64'... |
| 32 | +==> default: Matching MAC address for NAT networking... |
| 33 | +==> default: Checking if box 'ubuntu/xenial64' is up to date... |
| 34 | +==> default: Setting the name of the VM: linux-exploitation-course_default_1483872823092_95278 |
| 35 | +==> default: Clearing any previously set network interfaces... |
| 36 | +==> default: Preparing network interfaces based on configuration... |
| 37 | + default: Adapter 1: nat |
| 38 | +==> default: Forwarding ports... |
| 39 | + default: 22 (guest) => 2222 (host) (adapter 1) |
| 40 | +==> default: Running 'pre-boot' VM customizations... |
| 41 | +==> default: Booting VM... |
| 42 | +==> default: Waiting for machine to boot. This may take a few minutes... |
| 43 | + default: SSH address: 127.0.0.1:2222 |
| 44 | + default: SSH username: ubuntu |
| 45 | + default: SSH auth method: password |
| 46 | + default: |
| 47 | + default: Inserting generated public key within guest... |
| 48 | + default: Removing insecure key from the guest if it's present... |
| 49 | + default: Key inserted! Disconnecting and reconnecting using new SSH key... |
| 50 | +... snip ... |
| 51 | +``` |
| 52 | +
|
| 53 | +Once the provisioning finishes, you can ssh into the vagrant box. |
| 54 | +
|
| 55 | +```shell |
| 56 | +amon@bethany:~/linux-exploitation-course$ vagrant ssh |
| 57 | +Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-57-generic x86_64) |
| 58 | +
|
| 59 | + * Documentation: https://help.ubuntu.com |
| 60 | + * Management: https://landscape.canonical.com |
| 61 | + * Support: https://ubuntu.com/advantage |
| 62 | +
|
| 63 | + Get cloud support with Ubuntu Advantage Cloud Guest: |
| 64 | + http://www.ubuntu.com/business/services/cloud |
| 65 | +
|
| 66 | +0 packages can be updated. |
| 67 | +0 updates are security updates. |
| 68 | +
|
| 69 | +
|
| 70 | +ubuntu@ubuntu-xenial:~$ ls -la |
| 71 | +total 28 |
| 72 | +drwxr-xr-x 4 ubuntu ubuntu 4096 Jan 8 10:54 . |
| 73 | +drwxr-xr-x 3 root root 4096 Jan 8 10:54 .. |
| 74 | +-rw-r--r-- 1 ubuntu ubuntu 220 Aug 31 2015 .bash_logout |
| 75 | +-rw-r--r-- 1 ubuntu ubuntu 3771 Aug 31 2015 .bashrc |
| 76 | +drwx------ 2 ubuntu ubuntu 4096 Jan 8 10:54 .cache |
| 77 | +-rw-r--r-- 1 ubuntu ubuntu 655 Jun 24 2016 .profile |
| 78 | +drwx------ 2 ubuntu ubuntu 4096 Jan 8 10:54 .ssh |
| 79 | +-rw-r--r-- 1 ubuntu ubuntu 0 Jan 8 10:54 .sudo_as_admin_successful |
| 80 | +ubuntu@ubuntu-xenial:~$ |
| 81 | +``` |
| 82 | +
|
| 83 | +## What Was Installed? |
| 84 | +
|
| 85 | +This is the entire provisioning script: |
| 86 | +
|
| 87 | +```ruby |
| 88 | + config.vm.provision "shell", inline: <<-SHELL |
| 89 | + dpkg --add-architecture i386 |
| 90 | + apt-get update |
| 91 | + apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 gdb python python-pip libssl-dev gcc |
| 92 | + pip install --upgrade pip |
| 93 | + pip install pwntools |
| 94 | + pip install ipython |
| 95 | + SHELL |
| 96 | +``` |
| 97 | +
|
| 98 | +[vagrantdl]: https://www.vagrantup.com/downloads.html |
| 99 | +[virtualboxdl]: https://www.virtualbox.org/wiki/Downloads |
0 commit comments