Use environment variable for setting difficulty.

This commit is contained in:
James Barnett 2016-11-08 15:02:26 -06:00
parent 2211b516f5
commit 2fd6a8f9f1
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
1 changed files with 3 additions and 14 deletions

17
Vagrantfile vendored
View File

@ -1,17 +1,6 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
def get_argument(arg_name)
i = ARGV.index(arg_name)
if i && ARGV.length - 1 > i
return ARGV.fetch(i+1)
end
''
end
difficulty = get_argument('--difficulty').match(/^easy$/i) ? :easy : :normal
Vagrant.configure("2") do |config|
# Base configuration for the VM and provisioner
config.vm.box = "metasploitable3"
@ -121,10 +110,10 @@ Vagrant.configure("2") do |config|
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
# Configure Firewall to open up vulnerable services
case difficulty
when :easy
case ENV['MS3_DIFFICULTY']
when 'easy'
config.vm.provision :shell, path: "scripts/configs/disable_firewall.bat"
when :normal
else
config.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
end