-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathVagrantfile
117 lines (83 loc) · 3.38 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# -*- mode: ruby -*-
# vi: set ft=ruby :
# setting provisioning folder path
vagrant_provisioning_folder="repo_scripts/vagrant_prov"
# setting ip addresses
private_ip_net="192.168.33"
starting_ip=10
victim_linux_ip=starting_ip.next
redir_ip=victim_linux_ip.next
attacker_ip=redir_ip.next
# hostname vars
## doesn't work on windows for some reason...
win_vic_hostname='victim-windows'
lin_vic_hostname='victim-linux'
redir_hostname='redir'
attack_hostname='attacker'
# vagrant boxes
generic_win_box='rapid7/metasploitable3-win2k8'
generic_linux_box='bento/ubuntu-18.04'
# setting boxes
victim_win_box="#{generic_win_box}"
victim_linux_box="#{generic_linux_box}"
redir_box="#{generic_linux_box}"
# setting to my kali vagrant image, because it recieves weekly update
# so you don't have to wait forever to get all kali updates
attacker_box='elrey741/kali-linux_amd64'
Vagrant.configure("2") do |config|
# victim_win: windows machine getting attacked
config.vm.define "#{win_vic_hostname}" do |victim_win|
# defining box value
victim_win.vm.box = "#{victim_win_box}"
# setting internal ip address
victim_win.vm.network "private_network", ip: "#{private_ip_net}.#{starting_ip}"
# setting hostname so more clear where I am in network
# victim_win.vm.hostname = "#{win_vic_hostname}"
victim_win.vm.hostname = "victim-windows"
end
# victim_linux: linux machine getting attacked
config.vm.define "#{lin_vic_hostname}" do |victim_linux|
# defining box value
victim_linux.vm.box = "#{victim_linux_box}"
# setting internal ip address
victim_linux.vm.network "private_network", ip: "#{private_ip_net}.#{victim_linux_ip}"
# setting hostname so more clear where I am in network
victim_linux.vm.hostname = "#{lin_vic_hostname}"
# provisioning box to update setup items
victim_linux.vm.provision "shell", path: "#{vagrant_provisioning_folder}/prov.sh"
end
# redir: machine used as redirector/bastion host
config.vm.define "#{redir_hostname}" do |redir|
# defining box value
redir.vm.box = "#{redir_box}"
# setting internal ip address
redir.vm.network "private_network", ip: "#{private_ip_net}.#{redir_ip}"
# setting hostname so more clear where I am in network
redir.vm.hostname = "#{redir_hostname}"
# provisioning box to update setup items
redir.vm.provision "shell", path: "#{vagrant_provisioning_folder}/prov.sh"
end
# attacker: machine used to attack other hosts
config.vm.define "#{attack_hostname}" do |attacker|
# defining box value
attacker.vm.box = "#{attacker_box}"
# setting internal ip address
attacker.vm.network "private_network", ip: "#{private_ip_net}.#{attacker_ip}"
# setting hostname so more clear where I am in network
attacker.vm.hostname = "#{attack_hostname}"
# provisioning box to update setup items
attacker.vm.provision "shell", path: "#{vagrant_provisioning_folder}/prov.sh"
# currently should work for all linux machine (will provide link later for OSX and Windows)
# allowing me to x11 forward applications
attacker.ssh.forward_agent = true
attacker.ssh.forward_x11 = true
# setting vbox specific values
attacker.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.cpus = "2"
vb.memory = "2048"
end
end
end