From fe0a454ffb807d90238503ab5070a5425da4d731 Mon Sep 17 00:00:00 2001 From: swiru95 Date: Fri, 18 Oct 2019 18:31:06 +0200 Subject: [PATCH 1/5] Windows Installation update --- README.md | 10 ++++++++++ build.ps1 | 29 ++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f58ec9c..49f7e4e 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,21 @@ Metasploitable3 is released under a BSD-style license. See COPYING for more deta ## Quick-start To use the prebuilt images provided at https://app.vagrantup.com/rapid7/ create a new local metasploitable workspace: + +Linux users: ``` mkdir metasploitable3-workspace cd metasploitable3-workspace 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. ## Building Metasploitable 3 diff --git a/build.ps1 b/build.ps1 index 4705291..b605c89 100755 --- a/build.ps1 +++ b/build.ps1 @@ -4,7 +4,10 @@ $virtualBoxMinVersion = "5.1.10" $packerMinVersion = "0.10.0" $vagrantMinVersion = "1.9.0" $vagrantreloadMinVersion = "0.0.1" -$packer = "packer" +$packer = "packer.exe" +$expectedVBoxLocation = "C:\Program Files\Oracle\VirtualBox" +$expectedVagrantLocation="C:\HashiCorp\Vagrant\bin" +$expectedPackerLocation="C\ProgramFiles\Packer" function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False) { @@ -32,7 +35,6 @@ function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False } Write-Host ""; -$expectedVBoxLocation = "C:\Program Files\Oracle\VirtualBox" If ($(Test-Path "$expectedVBoxLocation\VBoxManage.exe") -eq $True) { @@ -61,7 +63,19 @@ If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinV } -$packerVersion = cmd.exe /c $packer -v +If ($(Test-Path "$expectedPackerLocation\$packer.exe") -eq $True) { + + $packerVersion = cmd.exe /c "$expectedPackerLocation/$packer" -v + $packerVersion = $packerVersion.split(" ")[1] + +} else { + + Write-Host "packer is not installed (or not in the expected location of $expectedPackerLocation\)" + Write-Host "Please download and install it from https://www.packer.io/downloads.html" + exit + +} + If (CompareVersions -actualVersion $packerVersion -expectedVersion $packerMinVersion) { @@ -75,13 +89,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 = $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) { From 61640f6beec63313568fbb9c5a5051a4f6f195ea Mon Sep 17 00:00:00 2001 From: swiru95 Date: Fri, 18 Oct 2019 18:32:35 +0200 Subject: [PATCH 2/5] Windows Installation Update2 --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index b605c89..ebea88f 100755 --- a/build.ps1 +++ b/build.ps1 @@ -170,7 +170,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" If ($vagrant_box_list -match "rapid7/metasploitable3-$os_short") { From 193d1510b6cfddec57a6e23613d8e42e573c5325 Mon Sep 17 00:00:00 2001 From: swiru95 Date: Fri, 18 Oct 2019 22:13:40 +0200 Subject: [PATCH 3/5] packer cmd command --- build.ps1 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/build.ps1 b/build.ps1 index ebea88f..6e11b69 100755 --- a/build.ps1 +++ b/build.ps1 @@ -7,7 +7,7 @@ $vagrantreloadMinVersion = "0.0.1" $packer = "packer.exe" $expectedVBoxLocation = "C:\Program Files\Oracle\VirtualBox" $expectedVagrantLocation="C:\HashiCorp\Vagrant\bin" -$expectedPackerLocation="C\ProgramFiles\Packer" + function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False) { @@ -63,18 +63,9 @@ If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinV } -If ($(Test-Path "$expectedPackerLocation\$packer.exe") -eq $True) { - - $packerVersion = cmd.exe /c "$expectedPackerLocation/$packer" -v + $packerVersion = cmd.exe /c "$packer" -v $packerVersion = $packerVersion.split(" ")[1] -} else { - - Write-Host "packer is not installed (or not in the expected location of $expectedPackerLocation\)" - Write-Host "Please download and install it from https://www.packer.io/downloads.html" - exit - -} If (CompareVersions -actualVersion $packerVersion -expectedVersion $packerMinVersion) { From a6e78447cf60740553784c2a2c63a355e02b37ef Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 21 Oct 2019 20:56:48 +0200 Subject: [PATCH 4/5] correct packer Sure that's true ive forgot about splitting --- build.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.ps1 b/build.ps1 index 6e11b69..9694c3f 100755 --- a/build.ps1 +++ b/build.ps1 @@ -63,10 +63,7 @@ If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinV } - $packerVersion = cmd.exe /c "$packer" -v - $packerVersion = $packerVersion.split(" ")[1] - - + $packerVersion = cmd.exe /c $packer -v If (CompareVersions -actualVersion $packerVersion -expectedVersion $packerMinVersion) { From 25bd5166d2e59118347125eedc9c133397e50ef8 Mon Sep 17 00:00:00 2001 From: Jeffrey Martin Date: Mon, 21 Oct 2019 16:36:00 -0500 Subject: [PATCH 5/5] reset whitespace --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 9694c3f..f1808b0 100755 --- a/build.ps1 +++ b/build.ps1 @@ -63,7 +63,7 @@ If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinV } - $packerVersion = cmd.exe /c $packer -v +$packerVersion = cmd.exe /c $packer -v If (CompareVersions -actualVersion $packerVersion -expectedVersion $packerMinVersion) {