mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-02 17:55:46 +02:00
Merge pull request #140 from rapid7/feature/build_with_packer
Move Building to Packer
This commit is contained in:
commit
55d321ac6d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,7 +3,7 @@ packer_cache/
|
|||
*.exe
|
||||
*.msi
|
||||
*.msu
|
||||
|
||||
*.DS_Store
|
||||
resources/manageengine/setup.log
|
||||
windows_2008_r2_virtualbox.box
|
||||
windows_2008_r2_vmware.box
|
||||
|
|
|
@ -28,8 +28,8 @@ To build automatically:
|
|||
To build manually:
|
||||
|
||||
1. Clone this repo and navigate to the main directory.
|
||||
2. Build the base VM image by running `packer build windows_2008_r2.json`. This will take a while the first time you run it since it has to download the OS installation ISO.
|
||||
3. After the base Vagrant box is created you need to add it to your Vagrant environment. This can be done with the command `vagrant box add windows_2008_r2_virtualbox.box --name=metasploitable3`.
|
||||
2. Build the base VM image by running `packer build --only=<provider> windows_2008_r2.json` where `<provider>` is your preferred virtualization platform. Currently `virtualbox-iso` and `vmware-iso` are supported. This will take a while the first time you run it since it has to download the OS installation ISO.
|
||||
3. After the base Vagrant box is created you need to add it to your Vagrant environment. This can be done with the command `vagrant box add windows_2008_r2_<provider>.box --name=metasploitable3`.
|
||||
4. Use `vagrant plugin install vagrant-reload` to install the reload vagrant provisioner if you haven't already.
|
||||
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.
|
||||
|
|
115
Vagrantfile
vendored
115
Vagrantfile
vendored
|
@ -6,126 +6,17 @@ Vagrant.configure("2") do |config|
|
|||
config.vm.box = "metasploitable3"
|
||||
config.vm.hostname = "metasploitable3"
|
||||
config.vm.communicator = "winrm"
|
||||
config.winrm.retry_limit = 60
|
||||
config.winrm.retry_delay = 10
|
||||
|
||||
config.vm.network "private_network", type: "dhcp"
|
||||
|
||||
# Install Chocolatey
|
||||
config.vm.provision :shell, path: "scripts/installs/chocolatey.cmd"
|
||||
config.vm.provision :reload # Hack to reset environment variables
|
||||
|
||||
# Install BoxStarter
|
||||
config.vm.provision :shell, path: "scripts/installs/install_boxstarter.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Install 7zip
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/7zip.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Adjust password policy
|
||||
config.vm.provision :shell, path: "scripts/configs/apply_password_settings.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Add users and add to groups
|
||||
config.vm.provision :shell, path: "scripts/configs/create_users.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Unpatched IIS and FTP
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_iis.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_ftp_site.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Setup for Apache Struts
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/java.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/tomcat.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :reload # Hack to reset environment variables
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_apache_struts.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Setup for Glassfish
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_glassfish.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/start_glassfish_service.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Jenkins (1.8)
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_jenkins.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Wordpress and phpMyAdmin
|
||||
# This must run after the WAMP setup.
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/vcredist2008.bat" # Visual Studio 2008 redistributable is a requirement for WAMP
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_wamp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/start_wamp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_wordpress.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - JMX
|
||||
config.vm.provision :shell, path: "scripts/installs/install_openjdk6.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_jmx.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Rails Server
|
||||
config.vm.provision :shell, path: "scripts/installs/install_ruby.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_devkit.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_rails_server.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_rails_server.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_rails_service.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - WebDAV
|
||||
# This must run after the WAMP setup.
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_webdav.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - MySQL
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_mysql.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - ManageEngine Desktop Central
|
||||
config.vm.provision :shell, path: "scripts/installs/install_manageengine.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Axis2
|
||||
# This must run after the Apache Struts setup.
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_axis2.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Common backdoors
|
||||
config.vm.provision :shell, path: "scripts/installs/install_backdoors.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - SNMP
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_snmp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Configure Firewall to open up vulnerable services
|
||||
case ENV['MS3_DIFFICULTY']
|
||||
when 'easy'
|
||||
config.vm.provision :shell, path: "scripts/configs/disable_firewall.bat"
|
||||
else
|
||||
config.vm.provision :shell, path: "scripts/configs/enable_firewall.bat"
|
||||
config.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
|
||||
end
|
||||
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - ElasticSearch
|
||||
# This must run after the firewall rules, because it needs to make some HTTP requests in order to
|
||||
# set up the vulnerable state.
|
||||
config.vm.provision :shell, path: "scripts/installs/install_elasticsearch.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Configure flags
|
||||
config.vm.provision :shell, path: "scripts/installs/install_flags.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614a
|
||||
end
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<!-- Do not uncomment the Key element if you are using trial ISOs -->
|
||||
<!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
|
||||
<!--<Key>YC6KT-GKW9T-YTKYR-T4X34-R7VHC</Key>-->
|
||||
|
||||
<WillShowUI>Never</WillShowUI>
|
||||
</ProductKey>
|
||||
</UserData>
|
||||
|
@ -249,13 +250,23 @@
|
|||
<Order>25</Order>
|
||||
<Description>Disable password expiration for vagrant user</Description>
|
||||
</SynchronousCommand>
|
||||
<!-- WITHOUT WINDOWS UPDATES -->
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine>
|
||||
<Description>Install OpenSSH</Description>
|
||||
<Order>99</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<CommandLine>cmd.exe /c mkdir -p C:\vagrant\scripts</CommandLine>
|
||||
<Description>Create directory for vagrant files to avoid provisioner bug with packer.</Description>
|
||||
<Order>26</Order>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\install_netfx.ps1 -AutoStart</CommandLine>
|
||||
<Description>Install .NET 4.0</Description>
|
||||
<Order>27</Order>
|
||||
</SynchronousCommand>
|
||||
<!--WITHOUT WINDOWS UPDATES -->
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\openssh.ps1 -AutoStart</CommandLine>
|
||||
<Description>Install OpenSSH</Description>
|
||||
<Order>99</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<!-- END WITHOUT WINDOWS UPDATES -->
|
||||
<!-- WITH WINDOWS UPDATES -->
|
||||
<!--<SynchronousCommand wcm:action="add">-->
|
||||
|
|
|
@ -99,7 +99,7 @@ If ($(Test-Path "windows_2008_r2_virtualbox.box") -eq $True) {
|
|||
Write-Host "It looks like the Vagrant box already exists. Skipping the Packer build."
|
||||
} else {
|
||||
Write-Host "Building the Vagrant box..."
|
||||
cmd.exe /c packer build windows_2008_r2.json
|
||||
cmd.exe /c packer build --only=virtualbox-iso windows_2008_r2.json
|
||||
|
||||
if($?) {
|
||||
Write-Host "Box successfully built by Packer."
|
||||
|
|
|
@ -101,7 +101,7 @@ if ls | grep -q 'windows_2008_r2_virtualbox.box'; then
|
|||
echo "It looks like the vagrant box already exists. Skipping the Packer build."
|
||||
else
|
||||
echo "Building the Vagrant box..."
|
||||
if $packer_bin build windows_2008_r2.json; then
|
||||
if $packer_bin build --only=virtualbox-iso windows_2008_r2.json; then
|
||||
echo "Box successfully built by Packer."
|
||||
else
|
||||
echo "Error building the Vagrant box using Packer. Please check the output above for any error messages."
|
||||
|
|
1
scripts/configs/enable_firewall.bat
Normal file
1
scripts/configs/enable_firewall.bat
Normal file
|
@ -0,0 +1 @@
|
|||
netsh advfirewall set allprofiles state on
|
1
scripts/configs/packer_cleanup.bat
Normal file
1
scripts/configs/packer_cleanup.bat
Normal file
|
@ -0,0 +1 @@
|
|||
rmdir /S /Q C:\vagrant
|
7
scripts/installs/install_netfx.ps1
Normal file
7
scripts/installs/install_netfx.ps1
Normal file
|
@ -0,0 +1,7 @@
|
|||
# setup dotnetfx4
|
||||
$netfx_url = "https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
|
||||
|
||||
Write-Output "Downloading $netfx_url"
|
||||
(New-Object System.Net.WebClient).DownloadFile($netfx_url, "C:\Windows\Temp\dotNetFx40_Full_x86_x64.exe")
|
||||
Write-Output "Starting Install of dotNetFx40_Full_x86_x64.exe"
|
||||
Start-Process "C:\Windows\Temp\dotNetFx40_Full_x86_x64.exe" "/q /norestart" -Wait
|
|
@ -1 +1 @@
|
|||
copy /Y C:\vagrant\resources\iis\applicationHost.config "%SystemRoot%\System32\inetsrv\config\applicationHost.config"
|
||||
xcopy /I /Y C:\vagrant\resources\iis\applicationHost.config %SystemRoot%\System32\inetsrv\config\
|
|
@ -8,4 +8,4 @@ net start domain1
|
|||
powershell -Command "Start-Sleep -s 10"
|
||||
net stop domain1
|
||||
icacls "C:\glassfish" /grant "NT Authority\LOCAL SERVICE:(OI)(CI)F" /T
|
||||
sc config domain1 obj= "NT Authority\LOCAL SERVICE"
|
||||
sc config "domain1" obj= "NT Authority\LOCAL SERVICE"
|
||||
|
|
|
@ -1 +1 @@
|
|||
start /w PKGMGR.EXE /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;
|
||||
start /w PKGMGR.EXE /quiet /norestart /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;
|
|
@ -1,4 +1,4 @@
|
|||
start /w PKGMGR.EXE /iu:SNMP
|
||||
start /w PKGMGR.EXE /quiet /norestart /iu:SNMP
|
||||
reg delete HKLM\SYSTEM\ControlSet001\services\SNMP\Parameters\PermittedManagers /va /f
|
||||
reg add HKLM\SYSTEM\ControlSet001\services\SNMP\Parameters /v EnableAuthenticationTraps /t REG_DWORD /d 0 /f
|
||||
reg add HKLM\SYSTEM\ControlSet001\services\SNMP\Parameters\ValidCommunities /v public /t REG_DWORD /d 4 /f
|
||||
|
|
132
versions/pro/Vagrantfile
vendored
Normal file
132
versions/pro/Vagrantfile
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
# Base configuration for the VM and provisioner
|
||||
config.vm.box = "metasploitable3"
|
||||
config.vm.hostname = "metasploitable3"
|
||||
config.vm.communicator = "winrm"
|
||||
|
||||
config.vm.network "private_network", type: "dhcp"
|
||||
|
||||
# Install Chocolatey
|
||||
config.vm.provision :shell, path: "scripts/installs/chocolatey.cmd"
|
||||
config.vm.provision :reload # Hack to reset environment variables
|
||||
|
||||
# Install BoxStarter
|
||||
config.vm.provision :shell, path: "scripts/installs/install_boxstarter.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Install 7zip
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/7zip.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Adjust password policy
|
||||
config.vm.provision :shell, path: "scripts/configs/apply_password_settings.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Add users and add to groups
|
||||
config.vm.provision :shell, path: "scripts/configs/create_users.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Unpatched IIS and FTP
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_iis.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_ftp_site.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Setup for Apache Struts
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/java.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/tomcat.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :reload # Hack to reset environment variables
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_apache_struts.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Setup for Glassfish
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_glassfish.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/start_glassfish_service.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Jenkins (1.8)
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_jenkins.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Wordpress and phpMyAdmin
|
||||
# This must run after the WAMP setup.
|
||||
config.vm.provision :shell, path: "scripts/chocolatey_installs/vcredist2008.bat" # Visual Studio 2008 redistributable is a requirement for WAMP
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_wamp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/start_wamp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_wordpress.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - JMX
|
||||
config.vm.provision :shell, path: "scripts/installs/install_openjdk6.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_jmx.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Rails Server
|
||||
config.vm.provision :shell, path: "scripts/installs/install_ruby.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_devkit.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_rails_server.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_rails_server.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
config.vm.provision :shell, path: "scripts/installs/install_rails_service.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - WebDAV
|
||||
# This must run after the WAMP setup.
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_webdav.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - MySQL
|
||||
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_mysql.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - ManageEngine Desktop Central
|
||||
config.vm.provision :shell, path: "scripts/installs/install_manageengine.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Axis2
|
||||
# This must run after the Apache Struts setup.
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_axis2.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - Common backdoors
|
||||
config.vm.provision :shell, path: "scripts/installs/install_backdoors.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - SNMP
|
||||
config.vm.provision :shell, path: "scripts/installs/setup_snmp.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Configure Firewall to open up vulnerable services
|
||||
case ENV['MS3_DIFFICULTY']
|
||||
when 'easy'
|
||||
config.vm.provision :shell, path: "scripts/configs/disable_firewall.bat"
|
||||
else
|
||||
config.vm.provision :shell, path: "scripts/configs/configure_firewall.bat"
|
||||
end
|
||||
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Vulnerability - ElasticSearch
|
||||
# This must run after the firewall rules, because it needs to make some HTTP requests in order to
|
||||
# set up the vulnerable state.
|
||||
config.vm.provision :shell, path: "scripts/installs/install_elasticsearch.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614
|
||||
|
||||
# Configure flags
|
||||
config.vm.provision :shell, path: "scripts/installs/install_flags.bat"
|
||||
config.vm.provision :shell, inline: "rm C:\\tmp\\vagrant-shell.bat" # Hack for this bug: https://github.com/mitchellh/vagrant/issues/7614a
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"builders": [
|
||||
{
|
||||
"type": "vmware-iso",
|
||||
"type": "virtualbox-iso",
|
||||
"iso_url": "{{user `iso_url`}}",
|
||||
"iso_checksum_type": "{{user `iso_checksum_type`}}",
|
||||
"iso_checksum": "{{user `iso_checksum`}}",
|
||||
|
@ -11,7 +11,7 @@
|
|||
"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",
|
||||
"guest_os_type": "Windows2008_64",
|
||||
"disk_size": 61440,
|
||||
"floppy_files": [
|
||||
"{{user `autounattend`}}",
|
||||
|
@ -31,6 +31,20 @@
|
|||
"./resources/certs/microsoft_root_2011.cer",
|
||||
"./resources/certs/thawte_primary_root.cer",
|
||||
"./resources/certs/utn-userfirst.cer"
|
||||
],
|
||||
"vboxmanage": [
|
||||
[
|
||||
"modifyvm",
|
||||
"{{.Name}}",
|
||||
"--memory",
|
||||
"4096"
|
||||
],
|
||||
[
|
||||
"modifyvm",
|
||||
"{{.Name}}",
|
||||
"--cpus",
|
||||
"2"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -52,7 +66,7 @@
|
|||
{
|
||||
"type": "vagrant",
|
||||
"keep_input_artifact": false,
|
||||
"output": "windows_2008_r2_{{.Provider}}.box",
|
||||
"output": "windows_2008_r2_{{.Provider}}_pro.box",
|
||||
"vagrantfile_template": "vagrantfile-windows_2008_r2.template"
|
||||
}
|
||||
],
|
|
@ -1,23 +1,69 @@
|
|||
{
|
||||
"builders": [
|
||||
{
|
||||
"type": "virtualbox-iso",
|
||||
"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",
|
||||
"headless": false,
|
||||
"boot_wait": "10m",
|
||||
"communicator": "ssh",
|
||||
"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": "Windows2008_64",
|
||||
"guest_os_type": "winServer2008Standard-64",
|
||||
"tools_upload_flavor": "windows",
|
||||
"disk_size": 61440,
|
||||
"floppy_files": [
|
||||
"{{user `autounattend`}}",
|
||||
"./scripts/configs/microsoft-updates.bat",
|
||||
"./scripts/configs/win-updates.ps1",
|
||||
"./scripts/installs/openssh.ps1",
|
||||
"./scripts/installs/install_netfx.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"
|
||||
],
|
||||
"vm_name": "metasploitable3-win2k8",
|
||||
"vmx_data": {
|
||||
"cpuid.coresPerSocket": "2",
|
||||
"memsize": "4096",
|
||||
"numvcpus": "2",
|
||||
"scsi0.virtualDev": "lsisas1068"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "virtualbox-iso",
|
||||
"iso_url": "{{user `iso_url`}}",
|
||||
"iso_checksum_type": "{{user `iso_checksum_type`}}",
|
||||
"iso_checksum": "{{user `iso_checksum`}}",
|
||||
"headless": false,
|
||||
"boot_wait": "10m",
|
||||
"communicator": "ssh",
|
||||
"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": "Windows2008_64",
|
||||
"disk_size": 61440,
|
||||
"vm_name": "metasploitable3-win2k8",
|
||||
"floppy_files": [
|
||||
"{{user `autounattend`}}",
|
||||
"./scripts/configs/microsoft-updates.bat",
|
||||
"./scripts/configs/win-updates.ps1",
|
||||
"./scripts/installs/openssh.ps1",
|
||||
"./scripts/installs/install_netfx.ps1",
|
||||
"./resources/certs/oracle-cert.cer",
|
||||
"./resources/certs/gdig2.crt",
|
||||
"./resources/certs/comodorsadomainvalidationsecureserverca.crt",
|
||||
|
@ -48,17 +94,107 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "file",
|
||||
"source": "scripts",
|
||||
"destination": "C:/vagrant"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "resources",
|
||||
"destination": "C:/vagrant"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"remote_path": "/tmp/script.bat",
|
||||
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
|
||||
"scripts": [
|
||||
"./scripts/configs/update_root_certs.bat",
|
||||
"./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"
|
||||
"./scripts/configs/enable-rdp.bat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-shell",
|
||||
"remote_path": "C:/Windows/Temp/script.bat",
|
||||
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
|
||||
"scripts": [
|
||||
"./scripts/configs/disable_firewall.bat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-restart"
|
||||
},
|
||||
{
|
||||
"type":"powershell",
|
||||
"inline": [
|
||||
"iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-restart"
|
||||
},
|
||||
{
|
||||
"type": "windows-shell",
|
||||
"remote_path": "C:/Windows/Temp/script.bat",
|
||||
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
|
||||
"scripts": [
|
||||
"scripts/installs/install_boxstarter.bat",
|
||||
"scripts/chocolatey_installs/7zip.bat",
|
||||
"scripts/configs/apply_password_settings.bat",
|
||||
"scripts/configs/create_users.bat",
|
||||
"scripts/installs/setup_iis.bat",
|
||||
"scripts/installs/setup_ftp_site.bat",
|
||||
"scripts/chocolatey_installs/java.bat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-restart"
|
||||
},
|
||||
{
|
||||
"type": "windows-shell",
|
||||
"remote_path": "C:/Windows/Temp/script.bat",
|
||||
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
|
||||
"scripts": [
|
||||
"scripts/chocolatey_installs/tomcat.bat",
|
||||
"scripts/installs/setup_apache_struts.bat",
|
||||
"scripts/installs/setup_glassfish.bat",
|
||||
"scripts/installs/start_glassfish_service.bat",
|
||||
"scripts/installs/setup_jenkins.bat",
|
||||
"scripts/chocolatey_installs/vcredist2008.bat",
|
||||
"scripts/installs/install_wamp.bat",
|
||||
"scripts/installs/start_wamp.bat",
|
||||
"scripts/installs/install_wordpress.bat",
|
||||
"scripts/installs/install_openjdk6.bat",
|
||||
"scripts/installs/setup_jmx.bat",
|
||||
"scripts/installs/install_ruby.bat",
|
||||
"scripts/installs/install_devkit.bat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-restart"
|
||||
},
|
||||
{
|
||||
"type": "windows-shell",
|
||||
"remote_path": "C:/Windows/Temp/script.bat",
|
||||
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
|
||||
"scripts": [
|
||||
"scripts/installs/install_rails_server.bat",
|
||||
"scripts/installs/setup_rails_server.bat",
|
||||
"scripts/installs/install_rails_service.bat",
|
||||
"scripts/installs/setup_webdav.bat",
|
||||
"scripts/installs/setup_mysql.bat",
|
||||
"scripts/installs/install_manageengine.bat",
|
||||
"scripts/installs/setup_axis2.bat",
|
||||
"scripts/installs/install_backdoors.bat",
|
||||
"scripts/installs/setup_snmp.bat",
|
||||
"scripts/configs/configure_firewall.bat",
|
||||
"scripts/installs/install_elasticsearch.bat",
|
||||
"scripts/installs/install_flags.bat",
|
||||
"scripts/configs/packer_cleanup.bat"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user