mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-09-21 00:01:14 +02:00
consistency for usage of VagrantCloud
This commit is contained in:
parent
604fc136e7
commit
70151811fd
17
Vagrantfile
vendored
17
Vagrantfile
vendored
|
@ -4,7 +4,7 @@
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.synced_folder '.', '/vagrant', disabled: true
|
config.vm.synced_folder '.', '/vagrant', disabled: true
|
||||||
config.vm.define "ub1404" do |ub1404|
|
config.vm.define "ub1404" do |ub1404|
|
||||||
ub1404.vm.box = "metasploitable3-ub1404"
|
ub1404.vm.box = "rapid7/metasploitable3-ub1404"
|
||||||
ub1404.vm.hostname = "metasploitable3-ub1404"
|
ub1404.vm.hostname = "metasploitable3-ub1404"
|
||||||
config.ssh.username = 'vagrant'
|
config.ssh.username = 'vagrant'
|
||||||
config.ssh.password = 'vagrant'
|
config.ssh.password = 'vagrant'
|
||||||
|
@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
config.vm.define "win2k8" do |win2k8|
|
config.vm.define "win2k8" do |win2k8|
|
||||||
# Base configuration for the VM and provisioner
|
# Base configuration for the VM and provisioner
|
||||||
win2k8.vm.box = "metasploitable3-win2k8"
|
win2k8.vm.box = "rapid7/metasploitable3-win2k8"
|
||||||
win2k8.vm.hostname = "metasploitable3-win2k8"
|
win2k8.vm.hostname = "metasploitable3-win2k8"
|
||||||
win2k8.vm.communicator = "winrm"
|
win2k8.vm.communicator = "winrm"
|
||||||
win2k8.winrm.retry_limit = 60
|
win2k8.winrm.retry_limit = 60
|
||||||
|
@ -30,16 +30,15 @@ Vagrant.configure("2") do |config|
|
||||||
# Configure Firewall to open up vulnerable services
|
# Configure Firewall to open up vulnerable services
|
||||||
case ENV['MS3_DIFFICULTY']
|
case ENV['MS3_DIFFICULTY']
|
||||||
when 'easy'
|
when 'easy'
|
||||||
win2k8.vm.provision :shell, path: "scripts/configs/disable_firewall.bat"
|
win2k8.vm.provision :shell, inline: "C:\\vagrant\\startup\\disable_firewall.bat"
|
||||||
else
|
else
|
||||||
win2k8.vm.provision :shell, path: "scripts/configs/enable_firewall.bat"
|
win2k8.vm.provision :shell, inline: "C:\\vagrant\\startup\\enable_firewall.bat"
|
||||||
win2k8.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
|
win2k8.vm.provision :shell, inline: "C:\\vagrant\\startup\\configure_firewall.bat"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Insecure share from the Linux machine
|
# Insecure share from the Linux machine
|
||||||
win2k8.vm.provision :shell, path: "scripts/installs/install_share_autorun.bat"
|
win2k8.vm.provision :shell, inline: "C:\\vagrant\\startup\\install_share_autorun.bat"
|
||||||
win2k8.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
win2k8.vm.provision :shell, inline: "C:\\vagrant\\startup\\setup_linux_share.bat"
|
||||||
win2k8.vm.provision :shell, path: "scripts/installs/setup_linux_share.bat"
|
win2k8.vm.provision :shell, inline: "rm -rf C:\\vagrant\\startup" # Cleanup startup scripts
|
||||||
win2k8.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -154,14 +154,14 @@ function InstallBox($os_full, $os_short)
|
||||||
echo "Attempting to add metasploitable3-$os_short box to Vagrant..."
|
echo "Attempting to add metasploitable3-$os_short box to Vagrant..."
|
||||||
$vagrant_box_list = cmd.exe /c "vagrant box list"
|
$vagrant_box_list = cmd.exe /c "vagrant box list"
|
||||||
|
|
||||||
If ($vagrant_box_list -match "metasploitable3-$os_short") {
|
If ($vagrant_box_list -match "rapid7/metasploitable3-$os_short") {
|
||||||
Write-Host "metasploitable3-$os_short already found in Vagrant box repository. Skipping the addition to Vagrant."
|
Write-Host "rapid7/metasploitable3-$os_short already found in Vagrant box repository. Skipping the addition to Vagrant."
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
cmd.exe /c vagrant box add metasploitable3-$os_short packer\builds\$($os_full)_virtualbox_$boxversion.box
|
cmd.exe /c vagrant box add packer\builds\$($os_full)_virtualbox_$boxversion.box --name rapid7/metasploitable3-$os_short
|
||||||
|
|
||||||
if($?) {
|
if($?) {
|
||||||
Write-Host "metasploitable3-$os_short box successfully added to Vagrant."
|
Write-Host "rapid7/metasploitable3-$os_short box successfully added to Vagrant."
|
||||||
} else {
|
} else {
|
||||||
throw "Error adding metasploitable3-$os_short box to Vagrant. See the above output for any error messages."
|
throw "Error adding metasploitable3-$os_short box to Vagrant. See the above output for any error messages."
|
||||||
}
|
}
|
||||||
|
|
6
build.sh
6
build.sh
|
@ -156,12 +156,12 @@ done
|
||||||
echo "Attempting to add the box to Vagrant..."
|
echo "Attempting to add the box to Vagrant..."
|
||||||
|
|
||||||
for provider in $providers; do
|
for provider in $providers; do
|
||||||
if vagrant box list | grep -q metasploitable3-"$os_short"-"$provider"; then
|
if vagrant box list | grep -q rapid7/metasploitable3-"$os_short"; then
|
||||||
echo "metasploitable3-$os_short-$provider already found in Vagrant box repository. Skipping the addition to Vagrant."
|
echo "rapid7/metasploitable3-$os_short already found in Vagrant box repository. Skipping the addition to Vagrant."
|
||||||
echo "NOTE: If you are having issues, try starting over by doing 'vagrant destroy' and then 'vagrant up'."
|
echo "NOTE: If you are having issues, try starting over by doing 'vagrant destroy' and then 'vagrant up'."
|
||||||
else
|
else
|
||||||
if [ -z $box_import ]; then
|
if [ -z $box_import ]; then
|
||||||
if vagrant box add $packer_build_path/"$os_full"_"$provider"_"$box_version".box --name metasploitable3-$os_short; then
|
if vagrant box add $packer_build_path/"$os_full"_"$provider"_"$box_version".box --name rapid7/metasploitable3-$os_short; then
|
||||||
echo "Box successfully added to Vagrant."
|
echo "Box successfully added to Vagrant."
|
||||||
else
|
else
|
||||||
echo "Error adding box to Vagrant. See the above output for any error messages."
|
echo "Error adding box to Vagrant. See the above output for any error messages."
|
||||||
|
|
|
@ -243,6 +243,31 @@
|
||||||
"{{user `scripts_dir`}}/installs/install_flags.bat",
|
"{{user `scripts_dir`}}/installs/install_flags.bat",
|
||||||
"{{user `scripts_dir`}}/configs/packer_cleanup.bat"
|
"{{user `scripts_dir`}}/configs/packer_cleanup.bat"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"source": "{{user `scripts_dir`}}/configs/disable_firewall.bat",
|
||||||
|
"destination": "C:/vagrant/startup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"source": "{{user `scripts_dir`}}/configs/enable_firewall.bat",
|
||||||
|
"destination": "C:/vagrant/startup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"source": "{{user `scripts_dir`}}/configs/configure_firewall.bat",
|
||||||
|
"destination": "C:/vagrant/startup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"source": "{{user `scripts_dir`}}/installs/install_share_autorun.bat",
|
||||||
|
"destination": "C:/vagrant/startup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"source": "{{user `scripts_dir`}}/installs/setup_linux_share.bat",
|
||||||
|
"destination": "C:/vagrant/startup"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"post-processors": [
|
"post-processors": [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user