forked from Sliim/pentest-env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
68 lines (56 loc) · 2.37 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This source file is part of pentest-env.
#
# pentest-env is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pentest-env is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with pentest-env. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
require 'rbconfig'
require 'yaml'
require File.expand_path('lib/pentestenv/customization')
rc = "#{ENV['HOME']}/.pentestrc"
customization = Pentestenv::Customization.new(
File.exist?(rc) ? YAML.load(File.read(rc)) : {})
chef_base_url = 'https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64'
chef_deb_file = 'chef_12.2.1-1_amd64.deb'
Vagrant::configure('2') do |config|
config.ssh.forward_agent = true
config.vm.define :kali do |kali|
kali.ssh.private_key_path = 'ssh-keys/pentest-env'
kali.ssh.username = 'root'
kali.vm.box = 'kali-2016.1'
kali.vm.box_url = 'http://box.hackbbs.org/kali-2016.1.box'
kali.vm.guest = :debian
# kali.vm.network :public_network, adapter: 2, type: "dhcp", bridge: 'eth0'
# kali.vm.network :private_network, adapter: 3, type: "dhcp"
kali.vm.provider "virtualbox" do |v|
v.gui = true
v.customize ['modifyvm', :id, '--name', 'pentest-env-kali-2.0']
v.customize ['modifyvm', :id, '--memory', 2048]
end
customization.apply :kali, kali
if File.directory? "#{ENV['PWD']}/chef-repo/roles"
kali.vm.provision :shell,
inline: 'test -d /opt/chef ||'\
"(wget #{chef_base_url}/#{chef_deb_file} -O #{chef_deb_file} && "\
"dpkg -i #{chef_deb_file} && rm #{chef_deb_file})"
kali.vm.provision :chef_solo do |chef|
chef.install = false
chef.cookbooks_path = 'cookbooks/'
chef.roles_path = 'chef-repo/roles'
chef.add_recipe('apt')
chef.add_role('kali-base')
customization.apply_chef :kali, chef
end
end
end
#Running targets customizations
customization.targets config
end