Merged with upstream

This commit is contained in:
Nicholas Charron 2017-01-25 09:47:09 -05:00
commit a076214362
14 changed files with 132 additions and 24 deletions

13
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,13 @@
## Issue Description
Please give a thorough description of the issue you're seeing.
Also, please be sure to include any troubleshooting steps that you've already attempted.
## Host System
* OS:
* Packer Version:
* Vagrant Version:
* VirtualBox Version:
## Command Output
Copy the relevant command output here.
If it's long, either post to a gist and add the link here, or isolate the error lines.

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ packer_cache/
*.DS_Store
resources/manageengine/setup.log
windows_2008_r2_virtualbox.box
windows_2008_r2_vmware.box

View File

@ -9,19 +9,20 @@ Metasploitable3 is released under a BSD-style license. See COPYING for more deta
use: `packer build -only=vmware-iso windows_2008_r2.json`
## Building Metasploitable 3
System Requirements:
* OS capable of running all of the required applications listed below
* VT-x/AMD-V Supported Processor recommended
* 65 GB Available space on drive
* 4.5 GB RAM
Requirements:
* [Packer](https://www.packer.io/intro/getting-started/setup.html)
* [Vagrant](https://www.vagrantup.com/docs/installation/)
* [Vagrant Reload Plugin](https://github.com/aidanns/vagrant-reload#installation)
* [VirtualBox 5.1.6](https://www.virtualbox.org/wiki/Downloads)
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
* Internet connection
NOTE: A bug was recently discovered in VirtualBox 5.1.8 that is breaking provisioning. More information [here](https://github.com/rapid7/metasploitable3/issues/41).
NOTE: A bug was recently discovered in Vagrant 1.8.7 on OSX that is breaking provisioning. More information [here](https://github.com/rapid7/metasploitable3/issues/43).
To build automatically:
1. Run the build_win2008.sh script if using bash, or build_win2008.ps1 if using Windows.
@ -37,6 +38,12 @@ To build manually:
5. To start the VM, run the command `vagrant up`. This will start up the VM and run all of the installation and configuration scripts necessary to set everything up. This takes about 10 minutes.
6. Once this process completes, you can open up the VM within VirtualBox and login. The default credentials are U: vagrant and P: vagrant.
Videos:
Thanks to [Jeremy](https://twitter.com/webpwnized), you can also follow the steps in these videos to set up Metasploitable3:
https://www.youtube.com/playlist?list=PLZOToVAK85MpnjpcVtNMwmCxMZRFaY6mT
## Vulnerabilities
* [See the wiki page](https://github.com/rapid7/metasploitable3/wiki/Vulnerabilities)

View File

@ -1,8 +1,8 @@
$ErrorActionPreference = "Stop"
$virtualBoxMinVersion = "5.1.6"
$virtualBoxMinVersion = "5.1.10"
$packerMinVersion = "0.10.0"
$vagrantMinVersion = "1.8.6"
$vagrantMinVersion = "1.9.0"
$vagrantreloadMinVersion = "0.0.1"
function CompareVersions ($actualVersion, $expectedVersion, $exactMatch = $False) {
@ -34,10 +34,10 @@ If ($(Test-Path "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe") -eq $True)
$vboxVersion = $vboxVersion.split("r")[0]
}
If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinVersion --exactMatch $True) {
If (CompareVersions -actualVersion $vboxVersion -expectedVersion $virtualBoxMinVersion -exactMatch $False) {
Write-Host "Compatible version of VirtualBox found."
} else {
Write-Host "Could not find a compatible version of VirtualBox at C:\Program Files\Oracle\VirtualBox\. Currently only 5.1.6 is supported. Please download and install it from https://www.virtualbox.org/wiki/Download_Old_Builds_5_1."
Write-Host "Could not find a compatible version of VirtualBox at C:\Program Files\Oracle\VirtualBox\. Please download and install it from https://www.virtualbox.org/"
exit
}

View File

@ -1,10 +1,10 @@
#!/bin/bash
min_vbox_ver="5.1.6"
min_vagrant_ver="1.8.6"
min_vbox_ver="5.1.10"
min_vagrant_ver="1.9.0"
min_packer_ver="0.10.0"
min_vagrantreload_ver="0.0.1"
packer_bin="packer-io"
packer_bin="packer"
function compare_versions {
actual_version=$1
@ -35,17 +35,22 @@ function compare_versions {
return 0
}
# Conditional for platform specific version checks. Some of these might seem redundant since
# there might not be anything actively broken in the dependent software. Keeping it around as
# version upgrades could break things on specific platforms.
if [ $(uname) = "Darwin" ]; then
packer_bin="packer"
vagrant_exact_match=true # Boxes fail to add in Vagrant 1.8.7 on OSX - https://github.com/mitchellh/vagrant/issues/8002
vagrant_exact_match=false
elif [ $(uname) = "Linux" ]; then
vagrant_exact_match=false
if cat /etc/*-release | grep -q 'DISTRIB_ID=Arch'; then
packer_bin="packer-io"
fi
fi
if compare_versions $(VBoxManage -v | sed -e 's/r.*//g' -e 's/_.*//g') $min_vbox_ver true; then
if compare_versions $(VBoxManage -v | sed -e 's/r.*//g' -e 's/_.*//g') $min_vbox_ver false; then
echo "Compatible version of VirtualBox found."
else
echo "A compatible version of VirtualBox was not found. Currently only $min_vbox_ver is supported. Please download and install it from https://www.virtualbox.org/wiki/Download_Old_Builds_5_1."
echo "A compatible version of VirtualBox was not found. Please download and install it from https://www.virtualbox.org/"
exit 1
fi
@ -109,5 +114,6 @@ else
fi
fi
echo "---------------------------------------------------------------------"
echo "SUCCESS: Run 'vagrant up' to provision and start metasploitable3."
echo "NOTE: The VM will need Internet access to provision properly."

BIN
resources/flags/kingofclubs.exe Executable file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -12,12 +12,16 @@ cacls "C:\Windows\three_of_spades.png" /t /e /g SYSTEM:f
cacls "C:\Windows\three_of_spades.png" /R Administrators /E
cacls "C:\Windows\three_of_spades.png" /R USERS /E
copy C:\vagrant\resources\flags\kingofclubs.exe C:\Windows\System32
copy C:\vagrant\resources\flags\four_of_clubs.wav C:\Users\Public\Music
copy C:\vagrant\resources\flags\joker.html C:\inetpub\wwwroot\index.html
copy C:\vagrant\resources\flags\hahaha.jpg C:\inetpub\wwwroot
del C:\inetpub\wwwroot\iisstart.htm
copy C:\vagrant\resources\flags\seven_of_hearts.html C:\inetpub\wwwroot
copy C:\vagrant\resources\flags\jack_of_hearts.docx C:\Users\Public\Documents
copy C:\vagrant\resources\flags\seven_of_spades.pdf C:\Users\Public\Documents

View File

@ -1,6 +1,6 @@
mkdir C:\glassfish
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip', 'C:\Windows\Temp\glassfish4.zip')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\glassfish4.zip" -oC:\glassfish"
cmd /c ""C:\Program Files\7-Zip\7z.exe" -y x "C:\Windows\Temp\glassfish4.zip" -oC:\glassfish"
copy /Y "C:\vagrant\resources\glassfish\admin-keyfile" "C:\glassfish\glassfish4\glassfish\domains\domain1\config\admin-keyfile"
copy /Y "C:\vagrant\resources\glassfish\domain.xml" "C:\glassfish\glassfish4\glassfish\domains\domain1\config\domain.xml"
cmd.exe /c "C:\glassfish\glassfish4\bin\asadmin.bat create-service domain1"

View File

@ -1 +1 @@
net start "domain1 Glassfish Server"
net start "domain1 GlassFish Server"

View File

@ -28,12 +28,13 @@ goto :done
:virtualbox
:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer
move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done

View File

@ -33,7 +33,7 @@ Vagrant.configure("2") do |config|
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsisas1068"
v.vmx["scsi0.virtualDev"] = "lsilogic"
end
config.vm.provider :vmware_workstation do |v, override|

View File

@ -80,7 +80,7 @@
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
"4096"
],
[
"modifyvm",

View File

@ -0,0 +1,65 @@
{
"builders": [
{
"type": "vmware-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": true,
"boot_wait": "2m",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "winServer2008Standard-64",
"disk_size": 61440,
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/configs/microsoft-updates.bat",
"./scripts/configs/win-updates.ps1",
"./scripts/installs/openssh.ps1",
"./resources/certs/oracle-cert.cer",
"./resources/certs/gdig2.crt",
"./resources/certs/comodorsadomainvalidationsecureserverca.crt",
"./resources/certs/comodorsacertificationauthority.crt",
"./resources/certs/addtrust_external_ca.cer",
"./resources/certs/baltimore_ca.cer",
"./resources/certs/digicert.cer",
"./resources/certs/equifax.cer",
"./resources/certs/globalsign.cer",
"./resources/certs/gte_cybertrust.cer",
"./resources/certs/microsoft_root_2011.cer",
"./resources/certs/thawte_primary_root.cer",
"./resources/certs/utn-userfirst.cer"
]
}
],
"provisioners": [
{
"type": "shell",
"remote_path": "/tmp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"./scripts/installs/vm-guest-tools.bat",
"./scripts/configs/vagrant-ssh.bat",
"./scripts/configs/disable-auto-logon.bat",
"./scripts/configs/enable-rdp.bat",
"./scripts/configs/update_root_certs.bat"
]
}
],
"post-processors": [
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_2008_r2_{{.Provider}}.box",
"vagrantfile_template": "vagrantfile-windows_2008_r2.template"
}
],
"variables": {
"iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
"iso_checksum_type": "md5",
"iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5",
"autounattend": "./answer_files/2008_r2/Autounattend.xml"
}
}