Make difficulty configurable

This commit is contained in:
wchen-r7 2016-10-28 16:04:22 -05:00
parent 3acf75869c
commit 8c46a65605
1 changed files with 25 additions and 1 deletions

26
Vagrantfile vendored
View File

@ -1,6 +1,24 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'getoptlong'
opts = GetoptLong.new(
[ '--difficulty', GetoptLong::OPTIONAL_ARGUMENT ]
)
difficulty = :normal
opts.each do |opt, arg|
case opt
when '--difficulty'
case arg
when /^easy$/i
difficulty = :easy
end
end
end
Vagrant.configure("2") do |config|
# Base configuration for the VM and provisioner
config.vm.box = "metasploitable3"
@ -108,7 +126,13 @@ 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
config.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
case difficulty
when :easy
config.vm.provision :shell, path: "scripts/configs/disable_firewall.bat"
when :normal
config.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
end
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
# Vulnerability - ElasticSearch