mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-06-30 08:45:50 +02:00
Use optparse
This commit is contained in:
parent
de48f797a6
commit
b67f807f25
19
Vagrantfile
vendored
19
Vagrantfile
vendored
|
@ -1,24 +1,23 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require 'getoptlong'
|
||||
|
||||
opts = GetoptLong.new(
|
||||
[ '--difficulty', GetoptLong::OPTIONAL_ARGUMENT ]
|
||||
)
|
||||
require 'optparse'
|
||||
|
||||
difficulty = :normal
|
||||
|
||||
opts.each do |opt, arg|
|
||||
case opt
|
||||
when '--difficulty'
|
||||
case arg
|
||||
when /^easy$/i
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = 'Metasploitable3 options:'
|
||||
|
||||
opts.on('-d', '--difficulty <String>', 'Level of difficulty') do |v|
|
||||
if v =~ /^easy$/i
|
||||
difficulty = :easy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
opts.parse!(ARGV)
|
||||
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
# Base configuration for the VM and provisioner
|
||||
config.vm.box = "metasploitable3"
|
||||
|
|
Loading…
Reference in New Issue
Block a user