├── LICENSE ├── Packer ├── ansible │ └── roles │ │ ├── Graphical │ │ └── tasks │ │ │ └── main.yml │ │ └── apache │ │ └── tasks │ │ └── main.yml ├── floppy │ ├── 10 │ │ ├── autounattend.xml │ │ └── enable-winrm.bat │ └── 2016 │ │ ├── autounattend.xml │ │ └── enable-winrm.bat └── http │ ├── centos.cfg │ ├── kali.cfg │ └── ubuntu-preseed.cfg ├── README.md ├── VMs └── placeholder ├── Vagrant ├── placeholder └── scripts │ ├── DeploymentConfigTemplate.xml │ ├── Domain Controller.ps1 │ ├── Enable RDP.ps1 │ └── initialize-domain.ps1 └── lab-creator.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Brandon Rossi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packer/ansible/roles/Graphical/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Desktop for Ubuntu 3 | become: yes 4 | apt: 5 | name: ubuntu-desktop 6 | state: latest 7 | when: ansible_distribution == "Ubuntu" 8 | 9 | - name: Install Desktop for Debian 10 | become: yes 11 | apt: 12 | name: task-gnome-desktop 13 | state: latest 14 | when: ansible_distribution == "Debian" 15 | 16 | - name: Install Desktop for CentOS 17 | become: yes 18 | yum: 19 | name: 20 | - "@development-tools" 21 | - "@^gnome-desktop-environment" 22 | - "@x11" 23 | state: latest 24 | when: ansible_distribution == "CentOS" 25 | 26 | - name: Set Gnome as Default 27 | become: yes 28 | shell: 29 | cmd: systemctl set-default graphical.target -------------------------------------------------------------------------------- /Packer/ansible/roles/apache/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: ensure httpd is at the latest version 3 | become: yes 4 | yum: 5 | name: httpd 6 | state: latest 7 | when: ansible_distribution == "CentOS" 8 | 9 | - name: start httpd on boot 10 | become: yes 11 | systemd: 12 | name: httpd 13 | enabled: yes 14 | state: restarted 15 | when: ansible_distribution == "CentOS" 16 | 17 | - name: ensure apache is at the latest version 18 | become: yes 19 | apt: 20 | name: apache2 21 | state: latest 22 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" 23 | 24 | - name: start apache on boot 25 | become: yes 26 | systemd: 27 | name: apache2 28 | enabled: yes 29 | state: restarted 30 | when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" -------------------------------------------------------------------------------- /Packer/floppy/10/autounattend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | en-US 7 | 8 | en-US 9 | en-US 10 | en-US 11 | en-US 12 | 13 | 14 | 15 | 16 | 17 | 18 | 1 19 | 500 20 | Primary 21 | 22 | 23 | true 24 | 2 25 | Primary 26 | 27 | 28 | 29 | 30 | true 31 | NTFS 32 | 1 33 | 1 34 | 35 | 36 | NTFS 37 | 38 | C 39 | 2 40 | 2 41 | 42 | 43 | 0 44 | true 45 | 46 | OnError 47 | 48 | 49 | 50 | 51 | 0 52 | 2 53 | 54 | 55 | 56 | 57 | 58 | NPPR9-FWDCX-D2C8J-H872K-2YT43 59 | 60 | true 61 | 62 | Lab 63 | 64 | 65 | 66 | 67 | 68 | Win10 69 | true 70 | Lab 71 | Lab 72 | Eastern Standard Time 73 | 74 | 75 | 76 | 77 | en-US 78 | en-US 79 | en-US 80 | en-US 81 | 82 | 83 | 84 | true 85 | true 86 | true 87 | true 88 | 3 89 | 90 | 91 | 92 | 93 | 94 | conda 95 | true</PlainText> 96 | </Password> 97 | <Description>conda</Description> 98 | <DisplayName>conda</DisplayName> 99 | <Group>Administrators</Group> 100 | <Name>conda</Name> 101 | </LocalAccount> 102 | </LocalAccounts> 103 | </UserAccounts> 104 | <FirstLogonCommands> 105 | <SynchronousCommand wcm:action="add"> 106 | <Order>1</Order> 107 | <CommandLine>cmd.exe /c a:\enable-winrm.bat</CommandLine> 108 | <Description>Set up winrm</Description> 109 | <RequiresUserInput>false</RequiresUserInput> 110 | </SynchronousCommand> 111 | <SynchronousCommand wcm:action="add"> 112 | <Order>2</Order> 113 | <CommandLine>powershell.exe Set-ExecutionPolicy RemoteSigned -Force</CommandLine> 114 | <Description>Allow powershell scripts to run</Description> 115 | <RequiresUserInput>false</RequiresUserInput> 116 | </SynchronousCommand> 117 | <SynchronousCommand wcm:action="add"> 118 | <Order>3</Order> 119 | <CommandLine>powershell.exe /c a:\add-users.ps1</CommandLine> 120 | <Description>Add user accounts</Description> 121 | <RequiresUserInput>false</RequiresUserInput> 122 | </SynchronousCommand> 123 | <SynchronousCommand wcm:action="add"> 124 | <CommandLine>%SystemRoot%\System32\reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f</CommandLine> 125 | <Order>4</Order> 126 | <Description>Disable AutoLogon</Description> 127 | <RequiresUserInput>false</RequiresUserInput> 128 | </SynchronousCommand> 129 | <SynchronousCommand wcm:action="add"> 130 | <CommandLine>%SystemRoot%\System32\reg.exe ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f</CommandLine> 131 | <Order>5</Order> 132 | <Description>Enable RDP</Description> 133 | <RequiresUserInput>false</RequiresUserInput> 134 | </SynchronousCommand> 135 | <SynchronousCommand wcm:action="add"> 136 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 137 | <Order>6</Order> 138 | <Description>Show file extensions in Explorer</Description> 139 | <RequiresUserInput>false</RequiresUserInput> 140 | </SynchronousCommand> 141 | <SynchronousCommand wcm:action="add"> 142 | <CommandLine>powershell.exe Disable-PSRemoting -Force</CommandLine> 143 | <Order>7</Order> 144 | <Description>Disable WinRM</Description> 145 | <RequiresUserInput>false</RequiresUserInput> 146 | </SynchronousCommand> 147 | <SynchronousCommand wcm:action="add"> 148 | <CommandLine>cmd.exe /c "netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389"</CommandLine> 149 | <Order>8</Order> 150 | <Description>Open Port 3389</Description> 151 | <RequiresUserInput>false</RequiresUserInput> 152 | </SynchronousCommand> 153 | </FirstLogonCommands> 154 | <AutoLogon> 155 | <Password> 156 | <Value>conda</Value> 157 | <PlainText>true</PlainText> 158 | </Password> 159 | <Enabled>true</Enabled> 160 | <LogonCount>1</LogonCount> 161 | <Username>conda</Username> 162 | </AutoLogon> 163 | </component> 164 | </settings> 165 | <cpi:offlineImage cpi:source="wim:c:/install.wim#Windows 10 Pro" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 166 | </unattend> -------------------------------------------------------------------------------- /Packer/floppy/10/enable-winrm.bat: -------------------------------------------------------------------------------- 1 | rem basic config for winrm 2 | powershell.exe Set-NetConnectionProfile -Name "Network" -NetworkCategory Private 3 | cmd.exe /c winrm quickconfig -q 4 | 5 | rem allow unencrypted traffic, and configure auth to use basic username/password auth 6 | cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"} 7 | cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"} 8 | cmd.exe /c winrm set winrm/config/client/auth '@{Basic="true"}' 9 | 10 | rem update firewall rules to open the right port and to allow remote administration 11 | cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes 12 | 13 | rem restart winrm 14 | cmd.exe /c net stop winrm 15 | cmd.exe /c net start winrm -------------------------------------------------------------------------------- /Packer/floppy/2016/autounattend.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <unattend 3 | xmlns="urn:schemas-microsoft-com:unattend"> 4 | <settings pass="windowsPE"> 5 | <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 6 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 7 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 8 | <SetupUILanguage> 9 | <UILanguage>en-US</UILanguage> 10 | </SetupUILanguage> 11 | <InputLocale>0c09:00000409</InputLocale> 12 | <SystemLocale>en-US</SystemLocale> 13 | <UILanguage>en-US</UILanguage> 14 | <UILanguageFallback>en-US</UILanguageFallback> 15 | <UserLocale>en-US</UserLocale> 16 | </component> 17 | <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 18 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 19 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 20 | <ImageInstall> 21 | <OSImage> 22 | <InstallTo> 23 | <DiskID>0</DiskID> 24 | <PartitionID>2</PartitionID> 25 | </InstallTo> 26 | <InstallFrom> 27 | <MetaData wcm:action="add"> 28 | <Key>/IMAGE/INDEX</Key> 29 | <Value>2</Value> 30 | </MetaData> 31 | </InstallFrom> 32 | </OSImage> 33 | </ImageInstall> 34 | <UserData> 35 | <AcceptEula>true</AcceptEula> 36 | <FullName>conda</FullName> 37 | <Organization>Lab</Organization> 38 | <ProductKey> 39 | </ProductKey> 40 | </UserData> 41 | <EnableFirewall>true</EnableFirewall> 42 | <DiskConfiguration> 43 | <Disk wcm:action="add"> 44 | <CreatePartitions> 45 | <CreatePartition wcm:action="add"> 46 | <Order>1</Order> 47 | <Size>350</Size> 48 | <Type>Primary</Type> 49 | </CreatePartition> 50 | <CreatePartition wcm:action="add"> 51 | <Extend>true</Extend> 52 | <Order>2</Order> 53 | <Type>Primary</Type> 54 | </CreatePartition> 55 | </CreatePartitions> 56 | <ModifyPartitions> 57 | <ModifyPartition wcm:action="add"> 58 | <Format>NTFS</Format> 59 | <Label>System</Label> 60 | <Order>1</Order> 61 | <PartitionID>1</PartitionID> 62 | <TypeID>0x27</TypeID> 63 | </ModifyPartition> 64 | <ModifyPartition wcm:action="add"> 65 | <Order>2</Order> 66 | <PartitionID>2</PartitionID> 67 | <Letter>C</Letter> 68 | <Label>OS</Label> 69 | <Format>NTFS</Format> 70 | </ModifyPartition> 71 | </ModifyPartitions> 72 | <DiskID>0</DiskID> 73 | <WillWipeDisk>true</WillWipeDisk> 74 | </Disk> 75 | </DiskConfiguration> 76 | </component> 77 | </settings> 78 | <settings pass="offlineServicing"> 79 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 80 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 81 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 82 | <EnableLUA>false</EnableLUA> 83 | </component> 84 | </settings> 85 | <settings pass="generalize"> 86 | <component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 87 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 88 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 89 | <SkipRearm>1</SkipRearm> 90 | </component> 91 | </settings> 92 | <settings pass="specialize"> 93 | <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 94 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 95 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 96 | <InputLocale>0409:00000409</InputLocale> 97 | <SystemLocale>en-US</SystemLocale> 98 | <UILanguage>en-US</UILanguage> 99 | <UILanguageFallback>en-US</UILanguageFallback> 100 | <UserLocale>en-US</UserLocale> 101 | </component> 102 | <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 103 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 104 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 105 | <SkipAutoActivation>true</SkipAutoActivation> 106 | </component> 107 | <component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 108 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 109 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 110 | <CEIPEnabled>0</CEIPEnabled> 111 | </component> 112 | <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 113 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 114 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 115 | <ComputerName>Win2916</ComputerName> 116 | </component> 117 | </settings> 118 | <settings pass="oobeSystem"> 119 | <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 120 | xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 121 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 122 | <AutoLogon> 123 | <Password> 124 | <Value>Conda123!</Value> 125 | <PlainText>true</PlainText> 126 | </Password> 127 | <Enabled>true</Enabled> 128 | <Username>Administrator</Username> 129 | </AutoLogon> 130 | <OOBE> 131 | <HideEULAPage>true</HideEULAPage> 132 | <HideLocalAccountScreen>true</HideLocalAccountScreen> 133 | <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> 134 | <HideOnlineAccountScreens>true</HideOnlineAccountScreens> 135 | <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> 136 | <NetworkLocation>Home</NetworkLocation> 137 | <ProtectYourPC>3</ProtectYourPC> 138 | <SkipMachineOOBE>true</SkipMachineOOBE> 139 | <SkipUserOOBE>true</SkipUserOOBE> 140 | </OOBE> 141 | <UserAccounts> 142 | <AdministratorPassword> 143 | <Value>Conda123!</Value> 144 | <PlainText>true</PlainText> 145 | </AdministratorPassword> 146 | </UserAccounts> 147 | <FirstLogonCommands> 148 | <SynchronousCommand wcm:action="add"> 149 | <Order>10</Order> 150 | <CommandLine>cmd.exe /c a:\enable-winrm.bat</CommandLine> 151 | <Description>Set up winrm</Description> 152 | <RequiresUserInput>false</RequiresUserInput> 153 | </SynchronousCommand> 154 | <SynchronousCommand wcm:action="add"> 155 | <Order>1</Order> 156 | <CommandLine>powershell.exe Set-ExecutionPolicy RemoteSigned -Force</CommandLine> 157 | <Description>Allow powershell scripts to run</Description> 158 | <RequiresUserInput>false</RequiresUserInput> 159 | </SynchronousCommand> 160 | <SynchronousCommand wcm:action="add"> 161 | <CommandLine>%SystemRoot%\System32\reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f</CommandLine> 162 | <Order>4</Order> 163 | <Description>Disable AutoLogon</Description> 164 | <RequiresUserInput>false</RequiresUserInput> 165 | </SynchronousCommand> 166 | <SynchronousCommand wcm:action="add"> 167 | <CommandLine>%SystemRoot%\System32\reg.exe ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f</CommandLine> 168 | <Order>5</Order> 169 | <Description>Enable RDP</Description> 170 | <RequiresUserInput>false</RequiresUserInput> 171 | </SynchronousCommand> 172 | <SynchronousCommand wcm:action="add"> 173 | <CommandLine>%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f</CommandLine> 174 | <Order>6</Order> 175 | <Description>Show file extensions in Explorer</Description> 176 | <RequiresUserInput>false</RequiresUserInput> 177 | </SynchronousCommand> 178 | <SynchronousCommand wcm:action="add"> 179 | <CommandLine>cmd.exe /c "netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389"</CommandLine> 180 | <Order>8</Order> 181 | <Description>Open Port 3389</Description> 182 | <RequiresUserInput>false</RequiresUserInput> 183 | </SynchronousCommand> 184 | </FirstLogonCommands> 185 | <RegisteredOrganization></RegisteredOrganization> 186 | <RegisteredOwner>Administrator</RegisteredOwner> 187 | <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet> 188 | <TimeZone>Eastern Standard Time</TimeZone> 189 | </component> 190 | </settings> 191 | </unattend> -------------------------------------------------------------------------------- /Packer/floppy/2016/enable-winrm.bat: -------------------------------------------------------------------------------- 1 | rem basic config for winrm 2 | powershell.exe Set-NetConnectionProfile -Name "Network" -NetworkCategory Private 3 | cmd.exe /c winrm quickconfig -q 4 | 5 | rem allow unencrypted traffic, and configure auth to use basic username/password auth 6 | cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"} 7 | cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"} 8 | cmd.exe /c winrm set winrm/config/client/auth '@{Basic="true"}' 9 | 10 | rem update firewall rules to open the right port and to allow remote administration 11 | cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes 12 | 13 | rem restart winrm 14 | cmd.exe /c net stop winrm 15 | cmd.exe /c net start winrm -------------------------------------------------------------------------------- /Packer/http/centos.cfg: -------------------------------------------------------------------------------- 1 | #platform=x86, AMD64, or Intel EM64T 2 | 3 | # Install OS instead of upgrade 4 | install 5 | 6 | # Keyboard layouts 7 | keyboard --vckeymap=us --xlayouts='us' 8 | 9 | # Use network installation 10 | url --url="http://mirror.centos.org/centos/7/os/x86_64/" 11 | 12 | # System language 13 | lang en_US 14 | 15 | # Users 16 | user --groups=wheel --name=conda --password=conda --gecos="conda" 17 | 18 | # License agreement 19 | eula --agreed 20 | 21 | # Firewall configuration 22 | firewall --disabled 23 | repo --name="epel" --baseurl=http://download.fedoraproject.org/pub/epel/7/x86_64/ 24 | 25 | # System authorization information 26 | auth --useshadow --passalgo=sha512 27 | 28 | # Use graphical install 29 | graphical 30 | firstboot --disable 31 | 32 | # SELinux configuration 33 | selinux --enforcing 34 | 35 | # System services 36 | services --enabled="network,sshd" 37 | 38 | # Network information 39 | network --bootproto=dhcp --hostname=centos7 40 | 41 | # Reboot after installation 42 | reboot 43 | 44 | # System timezone 45 | timezone America/New_York 46 | 47 | # System bootloader configuration 48 | autopart --type=lvm 49 | bootloader --append="crashkernel=auto" --location=mbr #--boot-drive=sda 50 | ignoredisk --only-use=sda 51 | clearpart --all --initlabel --drives=sda 52 | #%end 53 | 54 | %packages 55 | @core 56 | epel-release 57 | vim 58 | ansible 59 | %end 60 | 61 | %post 62 | # Update machine 63 | yum --nogpgcheck -y update 64 | echo "conda ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers 65 | systemctl disable initial-setup-graphical.service # This is the only one neccessary to get rid of initial setup prompt 66 | systemctl disable initial-setup.service # These are just to make sure nothing else comes up either 67 | systemctl disable initial-setup-text.service 68 | systemctl disable initial-setup-reconfiguration.service 69 | 70 | %end 71 | -------------------------------------------------------------------------------- /Packer/http/kali.cfg: -------------------------------------------------------------------------------- 1 | d-i debian-installer/locale string en_US.UTF-8 2 | d-i console-keymaps-at/keymap select us 3 | d-i mirror/country string enter information manually 4 | d-i mirror/http/hostname string http.kali.org 5 | d-i mirror/http/directory string /kali 6 | d-i keyboard-configuration/xkb-keymap select us 7 | d-i mirror/http/proxy string 8 | d-i mirror/suite string kali-rolling 9 | d-i mirror/codename string kali-rolling 10 | d-i clock-setup/utc boolean true 11 | d-i time/zone string US/Eastern 12 | 13 | # Disable security, volatile and backports 14 | d-i apt-setup/services-select multiselect 15 | 16 | # Enable contrib and non-free 17 | d-i apt-setup/non-free boolean true 18 | d-i apt-setup/contrib boolean true 19 | 20 | # Disable source repositories too 21 | d-i apt-setup/enable-source-repositories boolean false 22 | 23 | # Partitioning 24 | d-i partman-auto/method string regular 25 | d-i partman-lvm/device_remove_lvm boolean true 26 | d-i partman-md/device_remove_md boolean true 27 | d-i partman-lvm/confirm boolean true 28 | d-i partman-auto/choose_recipe select atomic 29 | d-i partman-auto/disk string /dev/sda 30 | d-i partman/confirm_write_new_label boolean true 31 | d-i partman/choose_partition select finish 32 | d-i partman/confirm boolean true 33 | d-i partman/confirm_nooverwrite boolean true 34 | d-i partman-partitioning/confirm_write_new_label boolean true 35 | 36 | # Disable CDROM entries after install 37 | d-i apt-setup/disable-cdrom-entries boolean true 38 | 39 | # Upgrade installed packages 40 | tasksel tasksel/desktop string xfce 41 | tasksel tasksel/first multiselect kali-desktop, standard 42 | d-i pkgsel/upgrade select full-upgrade 43 | d-i pkgsel/include string openssh-server kali-desktop-xfce kali-linux-large ansible 44 | 45 | # Change default hostname 46 | d-i netcfg/get_hostname string kali 47 | d-i netcfg/get_domain string unassigned-domain 48 | d-i netcfg/choose_interface select eth0 49 | d-i netcfg/dhcp_timeout string 60 50 | d-i hw-detect/load_firmware boolean false 51 | 52 | d-i passwd/root-password password toor 53 | d-i passwd/root-password-again password toor 54 | d-i passwd/root-login boolean true 55 | d-i passwd/make-user boolean false 56 | d-i user-setup/encrypt-home boolean false 57 | d-i apt-setup/use_mirror boolean true 58 | d-i grub-installer/only_debian boolean true 59 | d-i grub-installer/with_other_os boolean false 60 | d-i grub-installer/bootdev string /dev/sda 61 | d-i finish-install/reboot_in_progress note 62 | 63 | # Disable popularity-contest 64 | popularity-contest popularity-contest/participate boolean false 65 | kismet kismet/install-setuid boolean false 66 | kismet kismet/install-users string 67 | sslh sslh/inetd_or_standalone select standalone 68 | mysql-server-5.5 mysql-server/root_password_again password 69 | mysql-server-5.5 mysql-server/root_password password 70 | mysql-server-5.5 mysql-server/error_setting_password error 71 | mysql-server-5.5 mysql-server-5.5/postrm_remove_databases boolean false 72 | mysql-server-5.5 mysql-server-5.5/start_on_boot boolean true 73 | mysql-server-5.5 mysql-server-5.5/nis_warning note 74 | mysql-server-5.5 mysql-server-5.5/really_downgrade boolean false 75 | mysql-server-5.5 mysql-server/password_mismatch error 76 | mysql-server-5.5 mysql-server/no_upgrade_when_using_ndb error 77 | 78 | d-i preseed/late_command string \ 79 | in-target systemctl enable ssh; \ 80 | in-target systemctl start ssh; \ 81 | echo "PermitRootLogin yes" >> /target/etc/ssh/sshd_config -------------------------------------------------------------------------------- /Packer/http/ubuntu-preseed.cfg: -------------------------------------------------------------------------------- 1 | #### Contents of the preconfiguration file 2 | # Language 3 | d-i debian-installer/language string en 4 | d-i debian-installer/country string US 5 | d-i debian-installer/locale string en_US.UTF-8 6 | d-i console-setup/ask_detect boolean false 7 | 8 | # Keyboard 9 | d-i keyboard-configuration/variant select USA 10 | d-i keyboard-configuration/layout select USA 11 | 12 | 13 | ### Network configuration 14 | d-i netcfg/choose_interface select auto 15 | d-i netcfg/get_hostname string Home-Lab-VM 16 | d-i netcfg/get_domain string unassigned-domain 17 | # Disable that annoying WEP key dialog. 18 | d-i netcfg/wireless_wep string 19 | d-i mirror/http/proxy string 20 | 21 | ### Mirror settings 22 | d-i mirror/country string manual 23 | d-i mirror/http/hostname string archive.ubuntu.com 24 | d-i mirror/http/directory string /ubuntu 25 | 26 | ### Account setup 27 | d-i passwd/user-fullname string conda 28 | d-i passwd/username string conda 29 | d-i passwd/user-password password conda 30 | d-i passwd/user-password-again password conda 31 | d-i user-setup/allow-password-weak boolean true 32 | d-i user-setup/encrypt-home boolean false 33 | 34 | ### Time settings 35 | d-i clock-setup/utc boolean true 36 | d-i time/zone string US/Eastern 37 | d-i clock-setup/ntp boolean true 38 | 39 | ### Partitioning 40 | d-i partman-auto/disk string /dev/sda 41 | d-i partman-auto/method string regular 42 | d-i partman-lvm/device_remove_lvm boolean true 43 | d-i partman-md/device_remove_md boolean true 44 | d-i partman-lvm/confirm boolean true 45 | d-i partman-lvm/confirm_nooverwrite boolean true 46 | d-i partman-auto/choose_recipe select atomic 47 | d-i partman-partitioning/confirm_write_new_label boolean true 48 | d-i partman/choose_partition select finish 49 | d-i partman/confirm boolean true 50 | d-i partman/confirm_nooverwrite boolean true 51 | d-i partman-md/confirm boolean true 52 | d-i partman-partitioning/confirm_write_new_label boolean true 53 | d-i partman/choose_partition select finish 54 | d-i partman/confirm boolean true 55 | d-i partman/confirm_nooverwrite boolean true 56 | 57 | d-i grub-installer/only_debian boolean true 58 | d-i grub-installer/with_other_os boolean true 59 | 60 | ### Package selection 61 | d-i pkgsel/update-policy select none 62 | tasksel tasksel/first select openssh-server 63 | d-i pkgsel/include string build-essential ansible vim 64 | 65 | d-i preseed/late_command string \ 66 | echo "conda ALL=(ALL) NOPASSWD: ALL" >> /target/etc/sudoers 67 | 68 | d-i finish-install/reboot_in_progress note 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pentesting Playground 2 | This contains the contents needed to deploy a home lab of Vagrant boxes, all from a simple to use GUI. This is meant to be a community driven project. I encourage suggestions for things to set up. 3 | 4 | ## Getting Started 5 | Clone this repo by downloading the zip verision, or with `$ git clone https://github.com/C0nd4/pentesting-playground` 6 | 7 | Download Packer [here](https://www.packer.io/downloads.html). 8 | 9 | Place the Packer executable in your PATH. 10 | 11 | Download and install Vagrant [here](https://www.vagrantup.com/downloads.html). 12 | 13 | ### Using the Lab Creator Tool 14 | There is a graphical tool that will aide in creating multiple machines at the same time. This is a work in progress and an official stable version has not been released yet. You can use this tool by invoking `python3 lab-creator.py`. The tool will render a Vagrantfile and Vagrant boxes in the `Vagrant` folder after hitting the `Run` button. Be sure to press `Save` after each machine is configured before running. Building the lab machines can take a while due to the need to build each VM with Packer. To start the lab, simply change into the `Vagrant` folder and enter the command `vagrant up`. 15 | 16 | ### Requirements 17 | 18 | - Python 3 19 | - VirtualBox 20 | - Packer >= 1.6 21 | - Vagrant 22 | 23 | ## Roadmap 24 | There are several ideas for features I'd like to add. 25 | 26 | [ ] Add an Active Directory builder 27 | 28 | [ ] Add a config file 29 | 30 | [ ] Add support for VMware 31 | 32 | [ ] Allow users to add custom roles and operating systems 33 | 34 | [ ] Add more supported operating systems 35 | 36 | [ ] Add more ansible roles 37 | 38 | -------------------------------------------------------------------------------- /VMs/placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0nd4/pentesting-playground/136af3ea3110356f9d3d93a04a81ec6af47bfadb/VMs/placeholder -------------------------------------------------------------------------------- /Vagrant/placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0nd4/pentesting-playground/136af3ea3110356f9d3d93a04a81ec6af47bfadb/Vagrant/placeholder -------------------------------------------------------------------------------- /Vagrant/scripts/DeploymentConfigTemplate.xml: -------------------------------------------------------------------------------- 1 | <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> 2 | <Obj RefId="0"> 3 | <TN RefId="0"> 4 | <T>System.Collections.ObjectModel.Collection`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T> 5 | <T>System.Object</T> 6 | </TN> 7 | <LST> 8 | <Obj RefId="1"> 9 | <TN RefId="1"> 10 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_PowerShell</T> 11 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 12 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_PowerShell</T> 13 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 14 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 15 | <T>System.Object</T> 16 | </TN> 17 | <ToString>ServerComponent_RSAT_AD_PowerShell</ToString> 18 | <Props> 19 | <S N="PSComputerName">dc</S> 20 | </Props> 21 | <MS> 22 | <I32 N="NumericId">331</I32> 23 | <Obj N="__ClassMetadata" RefId="2"> 24 | <TN RefId="2"> 25 | <T>System.Collections.ArrayList</T> 26 | <T>System.Object</T> 27 | </TN> 28 | <LST> 29 | <Obj RefId="3"> 30 | <MS> 31 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 32 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 33 | <S N="ServerName">dc</S> 34 | <I32 N="Hash">-426961640</I32> 35 | <S N="MiXml">&lt;CLASS NAME="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="locale" TYPE="sint32" TOSUBCLASS="false"&gt;&lt;VALUE&gt;1033&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 36 | </MS> 37 | </Obj> 38 | <Obj RefId="4"> 39 | <MS> 40 | <S N="ClassName">ServerComponent_RSAT_AD_PowerShell</S> 41 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 42 | <S N="ServerName">dc</S> 43 | <I32 N="Hash">-426909640</I32> 44 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_AD_PowerShell" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-AD-PowerShell&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 45 | </MS> 46 | </Obj> 47 | </LST> 48 | </Obj> 49 | </MS> 50 | </Obj> 51 | <Obj RefId="5"> 52 | <TN RefId="3"> 53 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_AD_Domain_Services</T> 54 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 55 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_AD_Domain_Services</T> 56 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 57 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 58 | <T>System.Object</T> 59 | </TN> 60 | <ToString>ServerComponent_AD_Domain_Services</ToString> 61 | <Props> 62 | <S N="PSComputerName">dc</S> 63 | </Props> 64 | <MS> 65 | <I32 N="NumericId">10</I32> 66 | <Obj N="__ClassMetadata" RefId="6"> 67 | <TNRef RefId="2" /> 68 | <LST> 69 | <Obj RefId="7"> 70 | <MS> 71 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 72 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 73 | <S N="ServerName">dc</S> 74 | <I32 N="Hash">-426961640</I32> 75 | </MS> 76 | </Obj> 77 | <Obj RefId="8"> 78 | <MS> 79 | <S N="ClassName">ServerComponent_AD_Domain_Services</S> 80 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 81 | <S N="ServerName">dc</S> 82 | <I32 N="Hash">-426906520</I32> 83 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_AD_Domain_Services" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;AD-Domain-Services&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 84 | </MS> 85 | </Obj> 86 | </LST> 87 | </Obj> 88 | </MS> 89 | </Obj> 90 | <Obj RefId="9"> 91 | <TN RefId="4"> 92 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_AdminCenter</T> 93 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 94 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_AdminCenter</T> 95 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 96 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 97 | <T>System.Object</T> 98 | </TN> 99 | <ToString>ServerComponent_RSAT_AD_AdminCenter</ToString> 100 | <Props> 101 | <S N="PSComputerName">dc</S> 102 | </Props> 103 | <MS> 104 | <I32 N="NumericId">330</I32> 105 | <Obj N="__ClassMetadata" RefId="10"> 106 | <TNRef RefId="2" /> 107 | <LST> 108 | <Obj RefId="11"> 109 | <MS> 110 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 111 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 112 | <S N="ServerName">dc</S> 113 | <I32 N="Hash">-426961640</I32> 114 | </MS> 115 | </Obj> 116 | <Obj RefId="12"> 117 | <MS> 118 | <S N="ClassName">ServerComponent_RSAT_AD_AdminCenter</S> 119 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 120 | <S N="ServerName">dc</S> 121 | <I32 N="Hash">-427148840</I32> 122 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_AD_AdminCenter" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-AD-AdminCenter&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 123 | </MS> 124 | </Obj> 125 | </LST> 126 | </Obj> 127 | </MS> 128 | </Obj> 129 | <Obj RefId="13"> 130 | <TN RefId="5"> 131 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_Tools</T> 132 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 133 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_Tools</T> 134 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 135 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 136 | <T>System.Object</T> 137 | </TN> 138 | <ToString>ServerComponent_RSAT_AD_Tools</ToString> 139 | <Props> 140 | <S N="PSComputerName">dc</S> 141 | </Props> 142 | <MS> 143 | <I32 N="NumericId">329</I32> 144 | <Obj N="__ClassMetadata" RefId="14"> 145 | <TNRef RefId="2" /> 146 | <LST> 147 | <Obj RefId="15"> 148 | <MS> 149 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 150 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 151 | <S N="ServerName">dc</S> 152 | <I32 N="Hash">-426961640</I32> 153 | </MS> 154 | </Obj> 155 | <Obj RefId="16"> 156 | <MS> 157 | <S N="ClassName">ServerComponent_RSAT_AD_Tools</S> 158 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 159 | <S N="ServerName">dc</S> 160 | <I32 N="Hash">-431650312</I32> 161 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_AD_Tools" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-AD-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 162 | </MS> 163 | </Obj> 164 | </LST> 165 | </Obj> 166 | </MS> 167 | </Obj> 168 | <Obj RefId="17"> 169 | <TN RefId="6"> 170 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_ADDS</T> 171 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 172 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_ADDS</T> 173 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 174 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 175 | <T>System.Object</T> 176 | </TN> 177 | <ToString>ServerComponent_RSAT_ADDS</ToString> 178 | <Props> 179 | <S N="PSComputerName">dc</S> 180 | </Props> 181 | <MS> 182 | <I32 N="NumericId">257</I32> 183 | <Obj N="__ClassMetadata" RefId="18"> 184 | <TNRef RefId="2" /> 185 | <LST> 186 | <Obj RefId="19"> 187 | <MS> 188 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 189 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 190 | <S N="ServerName">dc</S> 191 | <I32 N="Hash">-426961640</I32> 192 | </MS> 193 | </Obj> 194 | <Obj RefId="20"> 195 | <MS> 196 | <S N="ClassName">ServerComponent_RSAT_ADDS</S> 197 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 198 | <S N="ServerName">dc</S> 199 | <I32 N="Hash">-431655512</I32> 200 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_ADDS" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-ADDS&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 201 | </MS> 202 | </Obj> 203 | </LST> 204 | </Obj> 205 | </MS> 206 | </Obj> 207 | <Obj RefId="21"> 208 | <TN RefId="7"> 209 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_ADDS_Tools</T> 210 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 211 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_ADDS_Tools</T> 212 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 213 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 214 | <T>System.Object</T> 215 | </TN> 216 | <ToString>ServerComponent_RSAT_ADDS_Tools</ToString> 217 | <Props> 218 | <S N="PSComputerName">dc</S> 219 | </Props> 220 | <MS> 221 | <I32 N="NumericId">299</I32> 222 | <Obj N="__ClassMetadata" RefId="22"> 223 | <TNRef RefId="2" /> 224 | <LST> 225 | <Obj RefId="23"> 226 | <MS> 227 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 228 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 229 | <S N="ServerName">dc</S> 230 | <I32 N="Hash">-426961640</I32> 231 | </MS> 232 | </Obj> 233 | <Obj RefId="24"> 234 | <MS> 235 | <S N="ClassName">ServerComponent_RSAT_ADDS_Tools</S> 236 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 237 | <S N="ServerName">dc</S> 238 | <I32 N="Hash">-431660712</I32> 239 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_ADDS_Tools" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-ADDS-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 240 | </MS> 241 | </Obj> 242 | </LST> 243 | </Obj> 244 | </MS> 245 | </Obj> 246 | <Obj RefId="25"> 247 | <TN RefId="8"> 248 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT</T> 249 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 250 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT</T> 251 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 252 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 253 | <T>System.Object</T> 254 | </TN> 255 | <ToString>ServerComponent_RSAT</ToString> 256 | <Props> 257 | <S N="PSComputerName">dc</S> 258 | </Props> 259 | <MS> 260 | <I32 N="NumericId">67</I32> 261 | <Obj N="__ClassMetadata" RefId="26"> 262 | <TNRef RefId="2" /> 263 | <LST> 264 | <Obj RefId="27"> 265 | <MS> 266 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 267 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 268 | <S N="ServerName">dc</S> 269 | <I32 N="Hash">-426961640</I32> 270 | </MS> 271 | </Obj> 272 | <Obj RefId="28"> 273 | <MS> 274 | <S N="ClassName">ServerComponent_RSAT</S> 275 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 276 | <S N="ServerName">dc</S> 277 | <I32 N="Hash">-431764712</I32> 278 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 279 | </MS> 280 | </Obj> 281 | </LST> 282 | </Obj> 283 | </MS> 284 | </Obj> 285 | <Obj RefId="29"> 286 | <TN RefId="9"> 287 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_Role_Tools</T> 288 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 289 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_Role_Tools</T> 290 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 291 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 292 | <T>System.Object</T> 293 | </TN> 294 | <ToString>ServerComponent_RSAT_Role_Tools</ToString> 295 | <Props> 296 | <S N="PSComputerName">dc</S> 297 | </Props> 298 | <MS> 299 | <I32 N="NumericId">256</I32> 300 | <Obj N="__ClassMetadata" RefId="30"> 301 | <TNRef RefId="2" /> 302 | <LST> 303 | <Obj RefId="31"> 304 | <MS> 305 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 306 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 307 | <S N="ServerName">dc</S> 308 | <I32 N="Hash">-426961640</I32> 309 | </MS> 310 | </Obj> 311 | <Obj RefId="32"> 312 | <MS> 313 | <S N="ClassName">ServerComponent_RSAT_Role_Tools</S> 314 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 315 | <S N="ServerName">dc</S> 316 | <I32 N="Hash">-431770952</I32> 317 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_RSAT_Role_Tools" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;RSAT-Role-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 318 | </MS> 319 | </Obj> 320 | </LST> 321 | </Obj> 322 | </MS> 323 | </Obj> 324 | <Obj RefId="33"> 325 | <TN RefId="10"> 326 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_GPMC</T> 327 | <T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> 328 | <T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_GPMC</T> 329 | <T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> 330 | <T>Microsoft.Management.Infrastructure.CimInstance</T> 331 | <T>System.Object</T> 332 | </TN> 333 | <ToString>ServerComponent_GPMC</ToString> 334 | <Props> 335 | <S N="PSComputerName">dc</S> 336 | </Props> 337 | <MS> 338 | <I32 N="NumericId">69</I32> 339 | <Obj N="__ClassMetadata" RefId="34"> 340 | <TNRef RefId="2" /> 341 | <LST> 342 | <Obj RefId="35"> 343 | <MS> 344 | <S N="ClassName">MSFT_ServerManagerServerComponentDescriptor</S> 345 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 346 | <S N="ServerName">dc</S> 347 | <I32 N="Hash">-426961640</I32> 348 | </MS> 349 | </Obj> 350 | <Obj RefId="36"> 351 | <MS> 352 | <S N="ClassName">ServerComponent_GPMC</S> 353 | <S N="Namespace">ROOT/Microsoft/Windows/ServerManager</S> 354 | <S N="ServerName">dc</S> 355 | <I32 N="Hash">-431793832</I32> 356 | <S N="MiXml">&lt;CLASS NAME="ServerComponent_GPMC" SUPERCLASS="MSFT_ServerManagerServerComponentDescriptor"&gt;&lt;QUALIFIER NAME="dynamic" TYPE="boolean"&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="provider" TYPE="string"&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="ClassVersion" TYPE="string"&gt;&lt;VALUE&gt;10.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME="DisplayName" TYPE="string" TRANSLATABLE="true"&gt;&lt;VALUE&gt;GPMC&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S> 357 | </MS> 358 | </Obj> 359 | </LST> 360 | </Obj> 361 | </MS> 362 | </Obj> 363 | </LST> 364 | </Obj> 365 | </Objs> -------------------------------------------------------------------------------- /Vagrant/scripts/Domain Controller.ps1: -------------------------------------------------------------------------------- 1 | Install-WindowsFeature AD-domain-services 2 | Import-Module ADDSDeployment 3 | Install-ADDSForest ` 4 | -CreateDnsDelegation:$false ` 5 | -DatabasePath "C:\Windows\NTDS" ` 6 | -DomainMode "WinThreshold" ` 7 | -DomainName "lab.local" ` 8 | -DomainNetbiosName "LAB" ` 9 | -ForestMode "WinThreshold" ` 10 | -InstallDns:$true ` 11 | -LogPath "C:\Windows\NTDS" ` 12 | -NoRebootOnCompletion:$true ` 13 | -SysvolPath "C:\Windows\SYSVOL" ` 14 | -Force:$true ` 15 | -SafeModeAdministratorPassword (ConvertTo-SecureString "Conda123!" -AsPlainText -Force) 16 | 17 | Install-WindowsFeature -ConfigurationFilePath C:\Temp\DeploymentConfigTemplate.xml -------------------------------------------------------------------------------- /Vagrant/scripts/Enable RDP.ps1: -------------------------------------------------------------------------------- 1 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #Use TLS 1.2, needed for Install-PackageProvider 2 | Install-PackageProvider -Name NuGet -Force 3 | Install-Module -Name Carbon -Force 4 | Import-Module Carbon 5 | 6 | net localgroup "Remote Desktop Users" "Administrator" /add 7 | Grant-Privilege -Identity Administrator -Privilege SeRemoteInteractiveLogonRight 8 | Grant-Privilege -Identity Administrator -Privilege SeInteractiveLogonRight -------------------------------------------------------------------------------- /Vagrant/scripts/initialize-domain.ps1: -------------------------------------------------------------------------------- 1 | Import-Module ADDSDeployment 2 | Install-ADDSForest ` 3 | -CreateDnsDelegation:$false ` 4 | -DatabasePath "C:\Windows\NTDS" ` 5 | -DomainMode "WinThreshold" ` 6 | -DomainName "lab.local" ` 7 | -DomainNetbiosName "LAB" ` 8 | -ForestMode "WinThreshold" ` 9 | -InstallDns:$true ` 10 | -LogPath "C:\Windows\NTDS" ` 11 | -NoRebootOnCompletion:$true ` 12 | -SysvolPath "C:\Windows\SYSVOL" ` 13 | -Force:$true ` 14 | -SafeModeAdministratorPassword (ConvertTo-SecureString "Conda123!" -AsPlainText -Force) 15 | 16 | Install-WindowsFeature -ConfigurationFilePath C:\Temp\DeploymentConfigTemplate.xml -------------------------------------------------------------------------------- /lab-creator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import subprocess 5 | import threading 6 | import queue 7 | from tkinter import * 8 | 9 | def switch_frame(self, frame_class): 10 | new_frame = frame_class(self.master) 11 | new_frame.setQueue(self.queue) 12 | if self is not None: 13 | self.destroy() 14 | self = new_frame 15 | self.pack(fill=BOTH, expand=1) 16 | 17 | class LabCreatorApp(Frame): 18 | def __init__(self, master=None): 19 | Frame.__init__(self, master) 20 | self.master = master 21 | self._frame = None 22 | self.queue = queue.Queue() 23 | switch_frame(self, MainPage) 24 | 25 | 26 | class MainPage(Frame): 27 | 28 | def __init__(self, master=None): 29 | Frame.__init__(self, master) 30 | self.master = master 31 | self.creation_window() 32 | self.currentOS = osList[0] 33 | self.currentRoles = osList[0].roleList 34 | self.currentMachine = machineList[0] 35 | 36 | def creation_window(self): 37 | 38 | self.master.title("Lab Creator") 39 | self.pack(fill=BOTH, expand=1) 40 | 41 | self.selectedOS = StringVar(self) 42 | self.selectedOS.set(osList[0]) 43 | self.selectedOS.trace('w', self.set_current_os) 44 | self.osOpt = OptionMenu(self, self.selectedOS, *osList, command=self.set_current_os) 45 | self.osOpt.config(width=12, font=('Helvetica', 12)) 46 | self.osOpt.pack() 47 | self.osOpt.place(x=235, y=15) 48 | 49 | self.selectedMachine = StringVar(self) 50 | self.selectedMachine.set(machineList[0]) 51 | self.selectedMachine.trace('w', self.set_current_machine) 52 | self.machineOpt = OptionMenu(self, self.selectedMachine, *machineList, command=self.set_current_machine) 53 | self.machineOpt.config(width=12, font=('Helvetica', 12)) 54 | self.machineOpt.pack() 55 | self.machineOpt.place(x=15, y=15) 56 | 57 | self.roleLabel = Label(self, text="Roles:", font=('Helvetica', 12)) 58 | self.roleLabel.pack() 59 | self.roleLabel.place(x=15, y=80) 60 | 61 | self.saveButton = Button(self, text="Save", font=('Helvetica', 12), command=self.save) 62 | self.saveButton.place(x=315, y=250) 63 | 64 | self.runButton = Button(self, text="Run", font=('Helvetica', 12), command=self.run_packer) 65 | self.runButton.place(x=200, y=250) 66 | 67 | self.addMachineButton = Button(self, text="Add Machine", font=('Helvetica', 12), command=self.add_machine) 68 | self.addMachineButton.place(x=15, y=250) 69 | 70 | self.roleList = Listbox(self, selectmode="multiple", width=25, exportselection=0) 71 | self.roleList.pack() 72 | self.roleList.place(x=75, y=75) 73 | 74 | self.cpuEntry = Entry(self, width=7) 75 | self.cpuEntry.pack() 76 | self.cpuEntry.place(x=350, y=75) 77 | 78 | self.cpuLabel = Label(self, text="CPU Cores:", font=('Helvetica', 12)) 79 | self.cpuLabel.pack() 80 | self.cpuLabel.place(x=230, y=72) 81 | 82 | self.ramEntry = Entry(self, width=7) 83 | self.ramEntry.pack() 84 | self.ramEntry.place(x=350, y=100) 85 | 86 | self.ramLabel = Label(self, text="RAM (MBs):", font=('Helvetica', 12)) 87 | self.ramLabel.pack() 88 | self.ramLabel.place(x=230, y=97) 89 | 90 | self.hdEntry = Entry(self, width=7) 91 | self.hdEntry.pack() 92 | self.hdEntry.place(x=350, y=125) 93 | 94 | self.hdLabel = Label(self, text="HD Size (MBs):", font=('Helvetica', 12)) 95 | self.hdLabel.pack() 96 | self.hdLabel.place(x=230, y=122) 97 | 98 | self.currentOS = self.set_current_os() 99 | self.currentRoles = self.get_roles() 100 | self.currentMachine = self.set_current_machine() 101 | 102 | def add_machine(self): 103 | global numberOfMachines 104 | numberOfMachines = numberOfMachines + 1 105 | newMachine = Machine(numberOfMachines) 106 | machineList.append(newMachine) 107 | m = self.machineOpt.children['menu'] 108 | m.delete(0, "end") 109 | for mach in machineList: 110 | m.add_command(label=mach, command=lambda value=mach: self.selectedMachine.set(value)) 111 | 112 | def set_current_machine(self, *args): 113 | for m in machineList: 114 | if str(m) == self.selectedMachine.get(): 115 | self.currentMachine = m 116 | self.roleList.selection_clear(0, END) 117 | self.populate_machine() 118 | 119 | def set_current_os(self, *args): 120 | for o in osList: 121 | if str(o) == str(self.selectedOS.get()): 122 | self.currentOS = o 123 | self.get_roles() 124 | self.show_roles() 125 | 126 | def get_roles(self): 127 | if(self.currentOS): 128 | self.currentRoles = self.currentOS.roleList 129 | 130 | def show_roles(self): 131 | self.roleList.delete(0, END) 132 | if self.currentRoles != None: 133 | for r in self.currentRoles: 134 | self.roleList.insert(END, r) 135 | for s in self.currentOS.scriptList: 136 | self.roleList.insert(END, s) 137 | 138 | def save(self): 139 | selected = self.roleList.curselection() 140 | selected = [self.roleList.get(i) for i in selected] 141 | self.currentMachine.operatingSystem = self.currentOS 142 | for s in selected: 143 | if s in self.currentMachine.operatingSystem.roleList: 144 | self.currentMachine.roles.append(s) 145 | print(s + " added to roles") 146 | else: 147 | self.currentMachine.scripts.append(s) 148 | print(s + " added to scripts") 149 | self.currentMachine.roleSet = self.currentRoles 150 | self.currentMachine.cpus = self.cpuEntry.get() 151 | self.currentMachine.hdSize = self.hdEntry.get() 152 | self.currentMachine.ram = self.ramEntry.get() 153 | 154 | def populate_machine(self): 155 | if self.currentMachine.operatingSystem != "": 156 | self.selectedOS.set(self.currentMachine.operatingSystem) 157 | else: 158 | self.selectedOS.set("Select an OS") 159 | self.currentRoles = None 160 | self.show_roles() 161 | for a in self.currentMachine.roles: 162 | self.roleList.select_set(a) 163 | self.ramEntry.delete(0, END) 164 | self.cpuEntry.delete(0, END) 165 | self.hdEntry.delete(0, END) 166 | self.ramEntry.insert(0, self.currentMachine.ram) 167 | self.cpuEntry.insert(0, self.currentMachine.cpus) 168 | self.hdEntry.insert(0, self.currentMachine.hdSize) 169 | 170 | def run_packer(self): 171 | ThreadedTask(self.queue).start() 172 | switch_frame(self, ProgressPage) 173 | 174 | def setQueue(self, queue): 175 | self.queue = queue 176 | 177 | 178 | class ProgressPage(Frame): 179 | def __init__(self, master): 180 | Frame.__init__(self, master) 181 | self.master = master 182 | self.numberOfFinished = -1 183 | self.status = self.update() 184 | self.l = Label(self, text="Progress", font=('Helvetica', 18, "bold")).pack() 185 | for i in range (len(machineList)): 186 | newLabel = Label(self, text="Machine " + str(i+1) + ":", font=('Helvetica', 12)) 187 | newLabel.pack() 188 | newLabel.place(x=60, y=22 * (i + 1) + 30) 189 | self.statusList = [] 190 | for i in range (len(machineList)): 191 | self.statusList.append(Label(self, text="In Progress", font=('Helvetica', 12))) 192 | self.statusList[i].pack() 193 | self.statusList[i].place(x=150, y=22 * (i + 1) + 30) 194 | 195 | def setQueue(self, queue): 196 | self.queue = queue 197 | 198 | def update(self): 199 | self.after(10000, self.update) 200 | try: 201 | if not self.queue.empty(): 202 | buildStatus = str(self.queue.get()) 203 | self.numberOfFinished = self.numberOfFinished + 1 204 | self.statusList[self.numberOfFinished].destroy() 205 | self.statusList[self.numberOfFinished] = Label(self, text=buildStatus, font=('Helvetica', 12)) 206 | self.statusList[self.numberOfFinished].pack() 207 | self.statusList[self.numberOfFinished].place(x=150, y=22 * (self.numberOfFinished + 1) + 30) 208 | except: 209 | pass 210 | 211 | 212 | class ThreadedTask(threading.Thread): 213 | 214 | def __init__(self, queue): 215 | threading.Thread.__init__(self) 216 | self.queue = queue 217 | 218 | def cleanup(self): 219 | for m in machineList: 220 | os.remove("Packer/machine" + str(m.number) + ".json") 221 | if len(m.roles) != 0: 222 | os.remove("Packer/ansible/machine" + str(m.number) + ".yml") 223 | 224 | def writeVagrantFiles(self): 225 | machineListTemp = machineList 226 | for m in machineListTemp: 227 | if len(m.scripts) != 0: 228 | for s in m.scripts: 229 | if s == "Domain Controller": 230 | machineList.insert(0, machineList.pop(machineList.index(m))) 231 | with open("Vagrant/Vagrantfile", "w") as vagrantFile: 232 | vagrantFile.write('# -*- mode: ruby -*-\n') 233 | vagrantFile.write('# vi: set ft=ruby :\n') 234 | vagrantFile.write('Vagrant.configure("2") do |config|\n') 235 | vagrantFile.write(' config.ssh.username = "conda"\n') 236 | vagrantFile.write(' config.ssh.password = "conda"\n') 237 | vagrantFile.write(' config.winrm.username = "Administrator"\n') 238 | vagrantFile.write(' config.winrm.password = "Conda123!"\n') 239 | vagrantFile.write(' config.winrm.transport = :plaintext\n') 240 | vagrantFile.write(' config.winrm.basic_auth_only = true\n') 241 | for m in machineList: 242 | vagrantFile.write(' config.vm.define "machine' + str(m.number) + '" do |machine' + str(m.number) + '|\n') 243 | if "Windows" in str(m.operatingSystem): 244 | vagrantFile.write(' machine' + str(m.number) + '.vm.network "forwarded_port", guest: 3389, host: ' + str(33389 + m.number) + '\n') 245 | vagrantFile.write(' machine' + str(m.number) + '.vm.communicator = "winrm"\n') 246 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "shell", inline: "New-Item -Path C:\\ -Name Temp -ItemType directory"\n') 247 | vagrantFile.write(' machine' + str(m.number) + '.vm.box = "../VMs/Machine' + str(m.number) + '.box"\n') 248 | vagrantFile.write(' machine' + str(m.number) + '.vm.network "private_network", ip: "192.168.13.' + str(100 + m.number) + '"\n') 249 | if len(m.scripts) != 0: 250 | for s in m.scripts: 251 | if s == "Domain Controller": 252 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "file", source: "scripts/DeploymentConfigTemplate.xml", destination: "C:\\\\Temp\\\\DeploymentConfigTemplate.xml"\n') 253 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "shell", path: "scripts/' + str(s) + '.ps1"\n') 254 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "reload"\n') 255 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "shell", reboot: true\n') 256 | else: 257 | vagrantFile.write(' machine' + str(m.number) + '.vm.provision "shell", path: "scripts/' + str(s) + '.ps1"\n') 258 | vagrantFile.write(' end\n') 259 | vagrantFile.write("end") 260 | 261 | 262 | def run(self): 263 | self.writeVagrantFiles() 264 | for m in machineList: 265 | with open("Packer/machine" + str(m.number) + ".json", "w") as packerFile: 266 | packerFile.write("{") 267 | if len(m.roles) != 0 and m.operatingSystem.usesAnsible: 268 | packerFile.write("\"provisioners\": [{\"type\": \"ansible-local\",\"playbook_dir\": \"Packer/ansible\",\"playbook_file\": \"Packer/ansible/machine" + str(m.number) + ".yml\"}],") 269 | with open("Packer/ansible/machine" + str(m.number) + ".yml", "w") as ansibleFile: 270 | ansibleFile.write("---\n- name: \"Provision Machine " + str(m.number) + "\"\n hosts: all\n roles:") 271 | for r in m.roles: 272 | ansibleFile.write("\n - " + r.lower()) 273 | ansibleFile.close() 274 | if "Ubuntu" in str(m.operatingSystem): 275 | packerFile.write("\"builders\":[{\"name\":\"Machine"+str(m.number)+"\",\"vm_name\":\"Machine"+str(m.number)+"\",\"output_directory\":\"VMs/machine"+str(m.number)+"\",\"guest_os_type\":\"Ubuntu_64\",\"type\":\"virtualbox-iso\",\"cpus\":\""+str(m.cpus)+"\",\"memory\":\""+str(m.ram)+"\",\"disk_size\":\""+str(m.hdSize)+"\",\"iso_checksum\":\"sha256:b4667b8f6d863271a014855d0f55b365f956bcdf8c691c8a3741b60d905e9647\",\"iso_urls\":[\"Packer/http/ubuntu18.iso\",\"http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso\"],\"ssh_username\":\"conda\",\"ssh_password\":\"conda\",\"ssh_wait_timeout\":\"60m\",\"headless\":\"false\",\"shutdown_command\":\"sudo shutdown -P now\",\"http_directory\":\"Packer/http\",\"boot_wait\":\"5s\",\"boot_command\":[\"<tab>\",\"url=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu-preseed.cfg \",\"auto=true \",\"initrd=initrd.gz \",\"hostname=ubuntu \",\"<enter>\"]}],\"post-processors\": [{\"type\": \"vagrant\",\"output\": \"VMs/" + "Machine" + str(m.number) + ".box\"}]}") 276 | elif "Kali" in str(m.operatingSystem): 277 | packerFile.write("\"builders\":[{\"name\":\"Machine"+str(m.number)+"\",\"vm_name\":\"Machine"+str(m.number)+"\",\"output_directory\":\"VMs/machine"+str(m.number)+"\",\"guest_os_type\":\"Debian_64\",\"type\":\"virtualbox-iso\",\"cpus\":\""+str(m.cpus)+"\",\"memory\":\""+str(m.ram)+"\",\"disk_size\":\""+str(m.hdSize)+"\",\"iso_checksum\":\"sha256:4143128bd9cb1fb736b0171adc503aa026ed92ad3a0a9bc6dea8f559a83c36b1\",\"iso_urls\":[\"Packer/http/kali.iso\",\"https://archive.kali.org/kali-images/kali-2020.1b/kali-linux-2020.1b-installer-amd64.iso\"],\"ssh_username\":\"root\",\"ssh_password\":\"toor\",\"ssh_wait_timeout\":\"60m\",\"headless\":\"false\",\"shutdown_command\":\"shutdown -P now\",\"http_directory\":\"Packer/http\",\"boot_wait\":\"5s\",\"boot_command\":[\"<esc><wait>\",\"install \",\"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/kali.cfg \",\"debian-installer=en_US auto locale=en_US kbd-chooser/method=us <wait>\",\"netcfg/get_hostname=kali \",\"netcfg/get_domain=unassigned-domain \",\"fb=falsedebconf/frontend=noninteractive \",\"console-setup/ask_detect=false <wait>\",\"console-keymaps-at/keymap=us \",\"keyboard-configuration/xkb-keymap=us <wait>\",\"<enter><wait10><wait10><wait10>\",\"<enter><wait>\"]}],\"post-processors\": [{\"type\": \"vagrant\",\"output\": \"VMs/" + "Machine" + str(m.number) + ".box\"}]}") 278 | elif "CentOS" in str(m.operatingSystem): 279 | packerFile.write("\"builders\":[{\"name\":\"Machine"+str(m.number)+"\",\"vm_name\":\"Machine"+str(m.number)+"\",\"output_directory\":\"VMs/machine"+str(m.number)+"\",\"guest_os_type\":\"RedHat_64\",\"type\":\"virtualbox-iso\",\"cpus\":\""+str(m.cpus)+"\",\"memory\":\""+str(m.ram)+"\",\"disk_size\":\""+str(m.hdSize)+"\",\"iso_checksum\":\"sha256:9a2c47d97b9975452f7d582264e9fc16d108ed8252ac6816239a3b58cef5c53d\",\"iso_urls\":[\"Packer/http/centos7.iso\",\"http://mirrors.usc.edu/pub/linux/distributions/centos/7.7.1908/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso\"],\"ssh_username\":\"conda\",\"ssh_password\":\"conda\",\"ssh_wait_timeout\":\"60m\",\"headless\":\"false\",\"shutdown_command\":\"sudo /usr/sbin/shutdown -P now\",\"http_directory\":\"Packer/http\",\"boot_wait\":\"5s\",\"boot_command\":[\"<tab>\",\" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos.cfg \",\"auto=true \",\"initrd=initrd.img \",\"hostname=centos \",\"<enter>\"]}],\"post-processors\": [{\"type\": \"vagrant\",\"output\": \"VMs/" + "Machine" + str(m.number) + ".box\"}]}") 280 | elif "Windows 10" in str(m.operatingSystem): 281 | packerFile.write("\"builders\":[{\"name\":\"Machine"+str(m.number)+"\",\"vm_name\":\"Machine"+str(m.number)+"\",\"output_directory\":\"VMs/machine"+str(m.number)+"\",\"guest_os_type\": \"Windows10_64\",\"type\": \"virtualbox-iso\",\"cpus\": \""+str(m.cpus)+"\",\"memory\": \""+str(m.ram)+"\",\"communicator\": \"winrm\",\"iso_checksum\": \"sha256:9ef81b6a101afd57b2dbfa44d5c8f7bc94ff45b51b82c5a1f9267ce2e63e9f53\",\"iso_urls\": [\"Packer/http/win-10.iso\",\"https://software-download.microsoft.com/download/pr/18363.418.191007-0143.19h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso\"],\"winrm_username\": \"conda\",\"winrm_password\": \"Conda123!\",\"winrm_timeout\": \"2h\",\"headless\": \"false\",\"shutdown_command\": \"shutdown /s\",\"disk_size\":\""+str(m.hdSize)+"\",\"format\": \"ova\",\"http_directory\": \"Packer/http\",\"floppy_files\": [\"Packer/floppy/10/autounattend.xml\",\"Packer/floppy/10/enable-winrm.bat\"]}],\"post-processors\": [{\"type\": \"vagrant\",\"output\": \"VMs/" + "Machine" + str(m.number) + ".box\"}]}") 282 | elif "Windows 2016" in str(m.operatingSystem): 283 | packerFile.write("\"builders\":[{\"name\":\"Machine"+str(m.number)+"\",\"vm_name\":\"Machine"+str(m.number)+"\",\"output_directory\":\"VMs/machine"+str(m.number)+"\",\"guest_os_type\": \"Windows2016_64\",\"type\": \"virtualbox-iso\",\"cpus\": \""+str(m.cpus)+"\",\"memory\": \""+str(m.ram)+"\",\"communicator\": \"winrm\",\"iso_checksum\": \"md5:70721288bbcdfe3239d8f8c0fae55f1f\",\"iso_urls\": [\"Packer/http/win-2016.iso\",\"https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO\"],\"winrm_username\": \"Administrator\",\"winrm_password\": \"Conda123!\",\"winrm_timeout\": \"2h\",\"headless\": \"false\",\"shutdown_command\": \"shutdown /s\",\"disk_size\":\""+str(m.hdSize)+"\",\"format\": \"ova\",\"http_directory\": \"Packer/http\",\"floppy_files\": [\"Packer/floppy/2016/autounattend.xml\",\"Packer/floppy/2016/enable-winrm.bat\"]}],\"post-processors\": [{\"type\": \"vagrant\",\"output\": \"VMs/" + "Machine" + str(m.number) + ".box\"}]}") 284 | packerFile.close() 285 | # os.system("packer build Packer/machine" + str(m.number) + ".json") 286 | child = subprocess.Popen("packer build Packer/machine" + str(m.number) + ".json", shell=True, stdout = subprocess.PIPE) 287 | childData = child.communicate()[0].strip() 288 | if child.returncode == 0: 289 | self.queue.put("Completed") 290 | else: 291 | self.queue.put("Failed") 292 | self.cleanup() 293 | 294 | class Machine(): 295 | 296 | def __init__(self, num): 297 | self.number = num 298 | self.name = "" 299 | self.roles = [] 300 | self.scripts = [] 301 | self.operatingSystem = "" 302 | self.ram = 0 303 | self.cpus = 0 304 | self.roleSet = None 305 | self.hdSize = 0 306 | self.status = False 307 | 308 | def __str__(self): 309 | return "Machine " + str(self.number) 310 | 311 | class OperatingSystem(): 312 | 313 | def __init__(self, name, roleList, scriptList, usesAnsible): 314 | self.name = name 315 | self.roleList = roleList 316 | self.usesAnsible = usesAnsible 317 | self.scriptList = scriptList 318 | 319 | def __str__(self): 320 | return self.name 321 | 322 | 323 | def main(): 324 | root = Tk() 325 | root.geometry("400x300") 326 | app = LabCreatorApp(root) 327 | app.mainloop() 328 | 329 | 330 | if __name__ == '__main__': 331 | osList = [] 332 | osList.append(OperatingSystem("Ubuntu 18.04", ["Graphical", "Apache"], [], True)) 333 | osList.append(OperatingSystem("Kali", ["Apache"], [], True)) 334 | osList.append(OperatingSystem("CentOS 7", ["Graphical", "Apache"], [], True)) 335 | osList.append(OperatingSystem("Windows 10", [], ["Enable RDP"], False)) 336 | osList.append(OperatingSystem("Windows 2016", [], ["Domain Controller","Enable RDP"], False)) 337 | machineList = [] 338 | machineList.append(Machine(1)) 339 | numberOfMachines = 1 340 | main() 341 | 342 | --------------------------------------------------------------------------------