Land #417, Prescription for Windows

This commit is contained in:
Jeffrey Martin 2019-10-21 16:36:34 -05:00
commit 4e6327b4f3
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
2 changed files with 22 additions and 5 deletions

View File

@ -7,11 +7,21 @@ Metasploitable3 is released under a BSD-style license. See COPYING for more deta
## Quick-start ## Quick-start
To use the prebuilt images provided at https://app.vagrantup.com/rapid7/ create a new local metasploitable workspace: To use the prebuilt images provided at https://app.vagrantup.com/rapid7/ create a new local metasploitable workspace:
Linux users:
``` ```
mkdir metasploitable3-workspace mkdir metasploitable3-workspace
cd metasploitable3-workspace cd metasploitable3-workspace
curl -O https://raw.githubusercontent.com/rapid7/metasploitable3/master/Vagrantfile && vagrant up curl -O https://raw.githubusercontent.com/rapid7/metasploitable3/master/Vagrantfile && vagrant up
``` ```
Windows users:
```
mkdir metasploitable3-workspace
cd metasploitable3-workspace
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/rapid7/metasploitable3/master/Vagrantfile" -OutFile "Vagrantfile"
vagrant up
```
Or clone this repository and build your own box. Or clone this repository and build your own box.
## Building Metasploitable 3 ## Building Metasploitable 3

View File

@ -4,7 +4,10 @@ $virtualBoxMinVersion = "5.1.10"
$packerMinVersion = "0.10.0" $packerMinVersion = "0.10.0"
$vagrantMinVersion = "1.9.0" $vagrantMinVersion = "1.9.0"
$vagrantreloadMinVersion = "0.0.1" $vagrantreloadMinVersion = "0.0.1"
$packer = "packer" $packer = "packer.exe"
$expectedVBoxLocation = "C:\Program Files\Oracle\VirtualBox"
$expectedVagrantLocation="C:\HashiCorp\Vagrant\bin"
function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False) { function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False) {
@ -32,7 +35,6 @@ function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False
} }
Write-Host ""; Write-Host "";
$expectedVBoxLocation = "C:\Program Files\Oracle\VirtualBox"
If ($(Test-Path "$expectedVBoxLocation\VBoxManage.exe") -eq $True) { If ($(Test-Path "$expectedVBoxLocation\VBoxManage.exe") -eq $True) {
@ -75,13 +77,18 @@ If (CompareVersions -actualVersion $packerVersion -expectedVersion $packerMinVer
} }
If ($(Test-Path "C:\HashiCorp\Vagrant\bin\vagrant.exe") -eq $True) { If ($(Test-Path "$expectedVagrantLocation\vagrant.exe") -eq $True) {
$vagrantVersion = cmd.exe /c "vagrant" -v $vagrantVersion = cmd.exe /c "vagrant" -v
$vagrantVersion = $vagrantVersion.split(" ")[1] $vagrantVersion = $vagrantVersion.split(" ")[1]
} } else {
Write-Host "Vagrant is not installed (or not in the expected location of $expectedVagrantLocation\)"
Write-Host "Please download and install it from https://www.vagrantup.com/downloads.html/"
exit
}
If (CompareVersions -actualVersion $vagrantVersion -expectedVersion $vagrantMinVersion) { If (CompareVersions -actualVersion $vagrantVersion -expectedVersion $vagrantMinVersion) {
@ -151,7 +158,7 @@ function InstallBox($os_full, $os_short)
} }
} }
echo "Attempting to add metasploitable3-$os_short box to Vagrant..." Write-Host "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 "rapid7/metasploitable3-$os_short") { If ($vagrant_box_list -match "rapid7/metasploitable3-$os_short") {