forked from mandiant/commando-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
1757 lines (1480 loc) · 85.7 KB
/
install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
.SYNOPSIS
Installation script for CommandoVM.
.DESCRIPTION
Placeholder
.PARAMETER cli
Switch parameter to skip customization GUI.
.PARAMETER victim
Switch parameter to to install the victim profile.
.PARAMETER skipChecks
Switch parameter to skip validation checks (not recommended).
.PARAMETER password
[CLI INSTALL] Current user password to allow reboot resiliency via Boxstarter
.PARAMETER noPassword
[CLI INSTALL] Used when the user password is not set or is blank
.PARAMETER customProfile
[CLI INSTALL] Path to a configuration XML file. May be a file path or URL.
.EXAMPLE
.\install.ps1
.LINK
https://github.com/mandiant/commando-vm
https://github.com/mandiant/VM-Packages
#>
param (
[switch]$cli,
[switch]$victim,
[switch]$skipChecks,
[switch]$noPassword,
[string]$password,
[string]$customProfile
)
$asciiArt = @'
▄████▄ ▒█████ ███▄ ▄███▓ ███▄ ▄███▓ ▄▄▄ ███▄ █ ▓█████▄ ▒█████
▒██▀ ▀█ ▒██▒ ██▒▓██▒▀█▀ ██▒▓██▒▀█▀ ██▒▒████▄ ██ ▀█ █ ▒██▀ ██▌▒██▒ ██▒
▒▓█ ▄ ▒██░ ██▒▓██ ▓██░▓██ ▓██░▒██ ▀█▄ ▓██ ▀█ ██▒░██ █▌▒██░ ██▒
▒▓▓▄ ▄██▒▒██ ██░▒██ ▒██ ▒██ ▒██ ░██▄▄▄▄██ ▓██▒ ▐▌██▒░▓█▄ ▌▒██ ██░
▒ ▓███▀ ░░ ████▓▒░▒██▒ ░██▒▒██▒ ░██▒ ▓█ ▓██▒▒██░ ▓██░░▒████▓ ░ ████▓▒░
░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ░ ░░ ▒░ ░ ░ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒▒▓ ▒ ░ ▒░▒░▒░
░ ▒ ░ ▒ ▒░ ░ ░ ░░ ░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░ ░ ▒ ▒ ░ ▒ ▒░
░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░
'@
Add-Type -AssemblyName System.Drawing
$errorColor = [System.Drawing.ColorTranslator]::FromHtml("#c80505")
$successColor = [System.Drawing.ColorTranslator]::FromHtml("#417505")
$grayedColor = [System.Drawing.ColorTranslator]::FromHtml("#959393")
$skippedColor = [System.Drawing.ColorTranslator]::FromHtml("#f59f00")
$skippedColor = [System.Drawing.ColorTranslator]::FromHtml("#f59f00")
# Load the GUI controls
if (-not $cli.IsPresent) {
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$iconPath = Join-Path $PSScriptRoot "Images/mandiant.png"
$icon = [System.Drawing.Icon]::FromHandle((New-Object System.Drawing.Bitmap -ArgumentList $iconPath).GetHicon())
#################################################################################################
################################ Installer Checks Form Controls #################################
#################################################################################################
$CommandoChecksManager = New-Object system.Windows.Forms.Form
$CommandoChecksManager.ClientSize = New-Object System.Drawing.Point(510,376)
$CommandoChecksManager.text = "CommandoVM Pre-Install Checks"
$CommandoChecksManager.TopMost = $true
$CommandoChecksManager.Icon = $icon
$CommandoChecksManager.StartPosition = 'CenterScreen'
$ChecksPanel = New-Object system.Windows.Forms.Panel
$ChecksPanel.height = 274
$ChecksPanel.width = 89
$ChecksPanel.location = New-Object System.Drawing.Point(365,8)
$InstallChecksGroup = New-Object system.Windows.Forms.Groupbox
$InstallChecksGroup.height = 289
$InstallChecksGroup.width = 462
$InstallChecksGroup.text = "Installation Checks"
$InstallChecksGroup.location = New-Object System.Drawing.Point(23,14)
################################# Check Labels #################################
$RunningAsAdminLabel = New-Object system.Windows.Forms.Label
$RunningAsAdminLabel.text = "Running as Administrator"
$RunningAsAdminLabel.AutoSize = $true
$RunningAsAdminLabel.width = 25
$RunningAsAdminLabel.height = 10
$RunningAsAdminLabel.location = New-Object System.Drawing.Point(15,18)
$RunningAsAdminLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ExecutionPolicyLabel = New-Object system.Windows.Forms.Label
$ExecutionPolicyLabel.text = "Execution Policy Unrestricted"
$ExecutionPolicyLabel.AutoSize = $true
$ExecutionPolicyLabel.width = 25
$ExecutionPolicyLabel.height = 10
$ExecutionPolicyLabel.location = New-Object System.Drawing.Point(15,59)
$ExecutionPolicyLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$WindowsDefenderLabel = New-Object system.Windows.Forms.Label
$WindowsDefenderLabel.text = "Windows Defender Disabled"
$WindowsDefenderLabel.AutoSize = $true
$WindowsDefenderLabel.width = 25
$WindowsDefenderLabel.height = 10
$WindowsDefenderLabel.location = New-Object System.Drawing.Point(15,104)
$WindowsDefenderLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$WindowsReleaseLabel = New-Object system.Windows.Forms.Label
$WindowsReleaseLabel.text = "Compatible Windows Release"
$WindowsReleaseLabel.AutoSize = $true
$WindowsReleaseLabel.width = 25
$WindowsReleaseLabel.height = 10
$WindowsReleaseLabel.location = New-Object System.Drawing.Point(15,149)
$WindowsReleaseLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$RunningVMLabel = New-Object system.Windows.Forms.Label
$RunningVMLabel.text = "Running in a Virtual Machine"
$RunningVMLabel.AutoSize = $true
$RunningVMLabel.width = 25
$RunningVMLabel.height = 10
$RunningVMLabel.location = New-Object System.Drawing.Point(15,193)
$RunningVMLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$EnoughHardStorageLabel = New-Object system.Windows.Forms.Label
$EnoughHardStorageLabel.text = "Enough Hard Drive Space"
$EnoughHardStorageLabel.AutoSize = $true
$EnoughHardStorageLabel.width = 25
$EnoughHardStorageLabel.height = 10
$EnoughHardStorageLabel.location = New-Object System.Drawing.Point(15,239)
$EnoughHardStorageLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
################################# Check Boolean Controls #################################
$RunningAsAdmin = New-Object system.Windows.Forms.Label
$RunningAsAdmin.text = "False"
$RunningAsAdmin.AutoSize = $true
$RunningAsAdmin.width = 25
$RunningAsAdmin.height = 10
$RunningAsAdmin.location = New-Object System.Drawing.Point(24,18)
$RunningAsAdmin.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$RunningAsAdmin.ForeColor = $errorColor
$ExecutionPolicy = New-Object system.Windows.Forms.Label
$ExecutionPolicy.text = "False"
$ExecutionPolicy.AutoSize = $true
$ExecutionPolicy.width = 25
$ExecutionPolicy.height = 10
$ExecutionPolicy.location = New-Object System.Drawing.Point(24,63)
$ExecutionPolicy.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ExecutionPolicy.ForeColor = $errorColor
$WindowsDefender = New-Object system.Windows.Forms.Label
$WindowsDefender.text = "False"
$WindowsDefender.AutoSize = $true
$WindowsDefender.width = 25
$WindowsDefender.height = 10
$WindowsDefender.location = New-Object System.Drawing.Point(24,108)
$WindowsDefender.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$WindowsDefender.ForeColor = $errorColor
$WindowsRelease = New-Object system.Windows.Forms.Label
$WindowsRelease.text = "False"
$WindowsRelease.AutoSize = $true
$WindowsRelease.width = 25
$WindowsRelease.height = 10
$WindowsRelease.location = New-Object System.Drawing.Point(24,150)
$WindowsRelease.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$WindowsRelease.ForeColor = $errorColor
$RunningVM = New-Object system.Windows.Forms.Label
$RunningVM.text = "False"
$RunningVM.AutoSize = $true
$RunningVM.width = 25
$RunningVM.height = 10
$RunningVM.location = New-Object System.Drawing.Point(24,195)
$RunningVM.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$RunningVM.ForeColor = $errorColor
$EnoughHardStorage = New-Object system.Windows.Forms.Label
$EnoughHardStorage.text = "False"
$EnoughHardStorage.AutoSize = $true
$EnoughHardStorage.width = 25
$EnoughHardStorage.height = 10
$EnoughHardStorage.location = New-Object System.Drawing.Point(24,241)
$EnoughHardStorage.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$EnoughHardStorage.ForeColor = $errorColor
################################# Check Tooltip Controls #################################
$RunningVMTooltip = New-Object system.Windows.Forms.Label
$RunningVMTooltip.text = "Only run this script inside a Virtual Machine"
$RunningVMTooltip.AutoSize = $true
$RunningVMTooltip.width = 25
$RunningVMTooltip.height = 10
$RunningVMTooltip.location = New-Object System.Drawing.Point(15,219)
$RunningVMTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RunningVMTooltip.ForeColor = $grayedColor
$WindowsReleaseTooltip = New-Object system.Windows.Forms.Label
$WindowsReleaseTooltip.text = "Ensure your Windows version is supported"
$WindowsReleaseTooltip.AutoSize = $true
$WindowsReleaseTooltip.width = 25
$WindowsReleaseTooltip.height = 10
$WindowsReleaseTooltip.location = New-Object System.Drawing.Point(15,175)
$WindowsReleaseTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$WindowsReleaseTooltip.ForeColor = $grayedColor
$WindowsDefenderTooltip = New-Object system.Windows.Forms.Label
$WindowsDefenderTooltip.text = "Disable Windows Defender and Tamper Protection"
$WindowsDefenderTooltip.AutoSize = $true
$WindowsDefenderTooltip.width = 25
$WindowsDefenderTooltip.height = 10
$WindowsDefenderTooltip.location = New-Object System.Drawing.Point(15,130)
$WindowsDefenderTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$WindowsDefenderTooltip.ForeColor = $grayedColor
$ExecutionPolicyTooltip = New-Object system.Windows.Forms.Label
$ExecutionPolicyTooltip.text = "PowerShell: Set-ExecutionPolicy Unrestricted"
$ExecutionPolicyTooltip.AutoSize = $true
$ExecutionPolicyTooltip.width = 25
$ExecutionPolicyTooltip.height = 10
$ExecutionPolicyTooltip.location = New-Object System.Drawing.Point(15,85)
$ExecutionPolicyTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ExecutionPolicyTooltip.ForeColor = $grayedColor
$RunningAsAdminTooltip = New-Object system.Windows.Forms.Label
$RunningAsAdminTooltip.text = "Please run this script as Administrator"
$RunningAsAdminTooltip.AutoSize = $true
$RunningAsAdminTooltip.width = 25
$RunningAsAdminTooltip.height = 10
$RunningAsAdminTooltip.location = New-Object System.Drawing.Point(15,41)
$RunningAsAdminTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RunningAsAdminTooltip.ForeColor = $grayedColor
$EnoughHardStorageTooltip = New-Object system.Windows.Forms.Label
$EnoughHardStorageTooltip.text = "Have at least 70GB of available storage"
$EnoughHardStorageTooltip.AutoSize = $true
$EnoughHardStorageTooltip.width = 25
$EnoughHardStorageTooltip.height = 10
$EnoughHardStorageTooltip.location = New-Object System.Drawing.Point(15,266)
$EnoughHardStorageTooltip.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$EnoughHardStorageTooltip.ForeColor = $grayedColor
################################# Check Completion Controls #################################
$BreakMyInstallCheckbox = New-Object system.Windows.Forms.CheckBox
$BreakMyInstallCheckbox.text = "I understand that continuing without satisfying all"
$BreakMyInstallCheckbox.AutoSize = $false
$BreakMyInstallCheckbox.width = 324
$BreakMyInstallCheckbox.height = 21
$BreakMyInstallCheckbox.location = New-Object System.Drawing.Point(30,319)
$BreakMyInstallCheckbox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$BreakMyInstallCheckbox.Add_CheckStateChanged({
if ($BreakMyInstallCheckbox.Checked) {
$ChecksCompleteButton.enabled = $true
} else {
$ChecksCompleteButton.enabled = $false
}
})
$BreakMyInstallLabel = New-Object system.Windows.Forms.Label
$BreakMyInstallLabel.text = "pre-install checks might cause install issues"
$BreakMyInstallLabel.AutoSize = $true
$BreakMyInstallLabel.width = 25
$BreakMyInstallLabel.height = 10
$BreakMyInstallLabel.location = New-Object System.Drawing.Point(30,338)
$BreakMyInstallLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChecksCompleteButton = New-Object system.Windows.Forms.Button
$ChecksCompleteButton.text = "Continue"
$ChecksCompleteButton.width = 97
$ChecksCompleteButton.height = 37
$ChecksCompleteButton.enabled = $false
$ChecksCompleteButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$ChecksCompleteButton.location = New-Object System.Drawing.Point(387,315)
$ChecksCompleteButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
$ChecksCompleteButton.Add_Click({
$global:checksPassed = $true
[void]$CommandoChecksManager.Close()
})
$InstallChecksGroup.controls.AddRange(@($ChecksPanel,$RunningAsAdminLabel,$ExecutionPolicyLabel,$WindowsDefenderLabel,$WindowsReleaseLabel,$RunningVMLabel,$RunningAsAdminTooltip,$ExecutionPolicyTooltip,$WindowsDefenderTooltip,$WindowsReleaseTooltip,$RunningVMTooltip,$EnoughHardStorageLabel, $EnoughHardStorageTooltip,$RunningAsAdmin,$EnoughHardStorage))
$CommandoChecksManager.controls.AddRange(@($InstallChecksGroup,$ChecksCompleteButton,$BreakMyInstallCheckbox,$BreakMyInstallLabel))
$ChecksPanel.controls.AddRange(@($RunningAsAdmin, $ExecutionPolicy,$WindowsDefender,$WindowsRelease,$RunningVM, $EnoughHardStorage))
#################################################################################################
################################# Main Installer Form Controls ##################################
#################################################################################################
$CommandoInstaller = New-Object system.Windows.Forms.Form
$CommandoInstaller.ClientSize = New-Object System.Drawing.Point(693,574)
$CommandoInstaller.text = "CommandoVM Installer"
$CommandoInstaller.TopMost = $true
$CommandoInstaller.StartPosition = 'CenterScreen'
$CommandoInstaller.Icon = $icon
$CommandoLogo = New-Object system.Windows.Forms.PictureBox
$CommandoLogo.width = 338
$CommandoLogo.height = 246
$CommandoLogo.location = New-Object System.Drawing.Point(179,37)
$CommandoLogo.imageLocation = Join-Path $PSScriptRoot "Images/commando.png"
$CommandoLogo.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::zoom
################################# Main Installer Profile Selection Controls #################################
$ProfileSelector = New-Object system.Windows.Forms.ComboBox
$ProfileSelector.text = "Select Profile"
$ProfileSelector.width = 141
$ProfileSelector.height = 108
$ProfileSelector.location = New-Object System.Drawing.Point(380,449)
$ProfileSelector.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ProfileSelector.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList
$ProfileSelector.Add_SelectedIndexChanged({
$global:selectedProfile = $ProfileSelector.SelectedItem
if ($ProfileSelector.SelectedItem -eq "Custom") {
$RecommendedDiskSpaceLabel.Visible = $false
$RecommendedDiskSpace.Visible = $false
} else {
# Find the DiskSize from $global:profileData where ProfileName equals $global:selectedProfile
$diskSize = ($global:profileData | Where-Object { $_.ProfileName -eq $global:selectedProfile }).DiskSize
# Set $RecommendedDiskSpace.Text to the found DiskSize
$RecommendedDiskSpace.Text = "$($diskSize)GB"
$RecommendedDiskSpaceLabel.Visible = $true
$RecommendedDiskSpace.Visible = $true
}
})
$ConfigureProfileButton = New-Object system.Windows.Forms.Button
$ConfigureProfileButton.text = "Configure Profile"
$ConfigureProfileButton.width = 142
$ConfigureProfileButton.height = 29
$ConfigureProfileButton.location = New-Object System.Drawing.Point(380,478)
$ConfigureProfileButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ConfigureProfileButton.Add_Click({Open-ProfileManager})
$RecommendedDiskSpace = New-Object system.Windows.Forms.Label
$RecommendedDiskSpace.text = "50GB+"
$RecommendedDiskSpace.AutoSize = $true
$RecommendedDiskSpace.width = 25
$RecommendedDiskSpace.height = 10
$RecommendedDiskSpace.location = New-Object System.Drawing.Point(590,523)
$RecommendedDiskSpace.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$RecommendedDiskSpaceLabel = New-Object system.Windows.Forms.Label
$RecommendedDiskSpaceLabel.text = "Recommended Disk Space - "
$RecommendedDiskSpaceLabel.AutoSize = $true
$RecommendedDiskSpaceLabel.width = 25
$RecommendedDiskSpaceLabel.height = 10
$RecommendedDiskSpaceLabel.location = New-Object System.Drawing.Point(390,523)
$RecommendedDiskSpaceLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$RecommendedDiskSpaceLabel.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#c10000")
################################# Main Installer Profile Labels #################################
$ProfileLabels = New-Object system.Windows.Forms.Groupbox
$ProfileLabels.height = 166
$ProfileLabels.width = 304
$ProfileLabels.text = "Available Profiles"
$ProfileLabels.location = New-Object System.Drawing.Point(38,342)
$ProfileLabelDefault = New-Object system.Windows.Forms.Label
$ProfileLabelDefault.text = "Default"
$ProfileLabelDefault.AutoSize = $true
$ProfileLabelDefault.width = 25
$ProfileLabelDefault.height = 10
$ProfileLabelDefault.location = New-Object System.Drawing.Point(20,25)
$ProfileLabelDefault.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ProfileLabelFull = New-Object system.Windows.Forms.Label
$ProfileLabelFull.text = "Full"
$ProfileLabelFull.AutoSize = $true
$ProfileLabelFull.width = 25
$ProfileLabelFull.height = 10
$ProfileLabelFull.location = New-Object System.Drawing.Point(20,50)
$ProfileLabelFull.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ProfileLabelLite = New-Object system.Windows.Forms.Label
$ProfileLabelLite.text = "Lite"
$ProfileLabelLite.AutoSize = $true
$ProfileLabelLite.width = 25
$ProfileLabelLite.height = 10
$ProfileLabelLite.location = New-Object System.Drawing.Point(20,75)
$ProfileLabelLite.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ProfileLabelDeveloper = New-Object system.Windows.Forms.Label
$ProfileLabelDeveloper.text = "Developer"
$ProfileLabelDeveloper.AutoSize = $true
$ProfileLabelDeveloper.width = 25
$ProfileLabelDeveloper.height = 10
$ProfileLabelDeveloper.location = New-Object System.Drawing.Point(20,100)
$ProfileLabelDeveloper.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ProfileLabelVictim = New-Object system.Windows.Forms.Label
$ProfileLabelVictim.text = "Victim"
$ProfileLabelVictim.AutoSize = $true
$ProfileLabelVictim.width = 25
$ProfileLabelVictim.height = 10
$ProfileLabelVictim.location = New-Object System.Drawing.Point(20,125)
$ProfileLabelVictim.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
################################# Main Installer Profile Description Labels #################################
$ProfileLabelDescriptionDefault = New-Object system.Windows.Forms.Label
$ProfileLabelDescriptionDefault.text = "- numerous packages for pentesting"
$ProfileLabelDescriptionDefault.AutoSize = $true
$ProfileLabelDescriptionDefault.width = 25
$ProfileLabelDescriptionDefault.height = 10
$ProfileLabelDescriptionDefault.location = New-Object System.Drawing.Point(70,25)
$ProfileLabelDescriptionDefault.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ProfileLabelDescriptionFull = New-Object system.Windows.Forms.Label
$ProfileLabelDescriptionFull.text = "- all tools suitable for CommandoVM"
$ProfileLabelDescriptionFull.AutoSize = $true
$ProfileLabelDescriptionFull.width = 25
$ProfileLabelDescriptionFull.height = 10
$ProfileLabelDescriptionFull.location = New-Object System.Drawing.Point(50,50)
$ProfileLabelDescriptionFull.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ProfileLabelDescriptionLite = New-Object system.Windows.Forms.Label
$ProfileLabelDescriptionLite.text = "- only the bare minimum essential tools"
$ProfileLabelDescriptionLite.AutoSize = $true
$ProfileLabelDescriptionLite.width = 25
$ProfileLabelDescriptionLite.height = 10
$ProfileLabelDescriptionLite.location = New-Object System.Drawing.Point(50,75)
$ProfileLabelDescriptionLite.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ProfileLabelDescriptionDeveloper = New-Object system.Windows.Forms.Label
$ProfileLabelDescriptionDeveloper.text = "- malware development tooling"
$ProfileLabelDescriptionDeveloper.text = "- malware development tooling"
$ProfileLabelDescriptionDeveloper.text = "- malware development tooling"
$ProfileLabelDescriptionDeveloper.AutoSize = $true
$ProfileLabelDescriptionDeveloper.width = 25
$ProfileLabelDescriptionDeveloper.height = 10
$ProfileLabelDescriptionDeveloper.location = New-Object System.Drawing.Point(90,100)
$ProfileLabelDescriptionDeveloper.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ProfileLabelDescriptionVictim = New-Object system.Windows.Forms.Label
$ProfileLabelDescriptionVictim.text = "- set up with tools for payload testing"
$ProfileLabelDescriptionVictim.AutoSize = $true
$ProfileLabelDescriptionVictim.width = 25
$ProfileLabelDescriptionVictim.height = 10
$ProfileLabelDescriptionVictim.location = New-Object System.Drawing.Point(65,125)
$ProfileLabelDescriptionVictim.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
################################# Main Installer License Labels #################################
$DisclaimerLabelLine1 = New-Object system.Windows.Forms.Label
$DisclaimerLabelLine1.text = "By proceeding with the installation, you are"
$DisclaimerLabelLine1.AutoSize = $true
$DisclaimerLabelLine1.width = 262
$DisclaimerLabelLine1.height = 12
$DisclaimerLabelLine1.location = New-Object System.Drawing.Point(380,344)
$DisclaimerLabelLine1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DisclaimerLabelLine2 = New-Object system.Windows.Forms.Label
$DisclaimerLabelLine2.text = "accepting the license terms of each package,"
$DisclaimerLabelLine2.AutoSize = $true
$DisclaimerLabelLine2.width = 262
$DisclaimerLabelLine2.height = 10
$DisclaimerLabelLine2.location = New-Object System.Drawing.Point(380,368)
$DisclaimerLabelLine2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DisclaimerLabelLine3 = New-Object system.Windows.Forms.Label
$DisclaimerLabelLine3.text = "and acknowledging that your use of each package"
$DisclaimerLabelLine3.AutoSize = $true
$DisclaimerLabelLine3.width = 262
$DisclaimerLabelLine3.height = 10
$DisclaimerLabelLine3.location = New-Object System.Drawing.Point(380,392)
$DisclaimerLabelLine3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DisclaimerLabelLine4 = New-Object system.Windows.Forms.Label
$DisclaimerLabelLine4.text = " will be subject to its respective license terms."
$DisclaimerLabelLine4.AutoSize = $true
$DisclaimerLabelLine4.width = 262
$DisclaimerLabelLine4.height = 10
$DisclaimerLabelLine4.location = New-Object System.Drawing.Point(380,417)
$DisclaimerLabelLine4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
################################# Main Installer Controls #################################
$InstallButton = New-Object system.Windows.Forms.Button
$InstallButton.text = "Install"
$InstallButton.width = 104
$InstallButton.height = 60
$InstallButton.location = New-Object System.Drawing.Point(548,446)
$InstallButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
$InstallButton.Add_Click({
if (Open-PasswordEntry) {
[void]$CommandoInstaller.Close()
[void]$CommandoInstaller.Dispose()
Install-Profile -ProfileName $global:selectedProfile
}
})
$CommandoInstaller.controls.AddRange(@($CommandoLogo,$InstallButton,$ProfileSelector,$ConfigureProfileButton,$ProfileLabels,$RecommendedDiskSpaceLabel,$DisclaimerLabelLine1,$DisclaimerLabelLine2,$DisclaimerLabelLine3,$DisclaimerLabelLine4,$RecommendedDiskSpace))
$ProfileLabels.controls.AddRange(@($ProfileLabelDescriptionLite,$Label1,$ProfileLabelLite,$ProfileLabelFull,$ProfileLabelDescriptionFull,$ProfileLabelDefault,$ProfileLabelDescriptionDefault,$ProfileLabelDeveloper,$ProfileLabelDescriptionDeveloper,$ProfileLabelVictim,$ProfileLabelDescriptionVictim))
#################################################################################################
################################# Profile Manager Form Controls #################################
#################################################################################################
$CommandoProfileManager = New-Object system.Windows.Forms.Form
$CommandoProfileManager.ClientSize = New-Object System.Drawing.Point(660,651)
$CommandoProfileManager.text = "CommandoVM Profile Manager"
$CommandoProfileManager.TopMost = $true
$CommandoProfileManager.StartPosition = 'CenterScreen'
$CommandoProfileManager.Icon = $icon
################################# Profile Manager Preset Selector Controls #################################
$PresetSelector = New-Object system.Windows.Forms.ComboBox
$PresetSelector.text = "Default"
$PresetSelector.width = 122
$PresetSelector.height = 20
$PresetSelector.location = New-Object System.Drawing.Point(252,11)
$PresetSelector.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PresetSelector.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList
$PresetSelector.Add_SelectedIndexChanged({Set-ProfilePreset -ProfileName $PresetSelector.SelectedItem})
$PresetSelectorLabel = New-Object system.Windows.Forms.Label
$PresetSelectorLabel.text = "Preset"
$PresetSelectorLabel.AutoSize = $true
$PresetSelectorLabel.width = 25
$PresetSelectorLabel.height = 10
$PresetSelectorLabel.location = New-Object System.Drawing.Point(203,14)
$PresetSelectorLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
################################# Profile Manager Package Installation Controls #################################
$SelectedPackagesList = New-Object system.Windows.Forms.ListBox
$SelectedPackagesList.text = "listBox"
$SelectedPackagesList.width = 232
$SelectedPackagesList.height = 266
$SelectedPackagesList.location = New-Object System.Drawing.Point(16,69)
$SelectedPackagesList.Add_SelectedIndexChanged({
# We're only gonna reset the available package selection if we have a selection in this listbox
if ($SelectedPackagesList.SelectedIndex -ne -1) {
Set-PackageInformation -PackageName $SelectedPackagesList.SelectedItem
$AvailablePackagesList.ClearSelected()
}
})
$AvailablePackagesList = New-Object system.Windows.Forms.ListBox
$AvailablePackagesList.text = "listBox"
$AvailablePackagesList.width = 228
$AvailablePackagesList.height = 265
$AvailablePackagesList.location = New-Object System.Drawing.Point(318,69)
$AvailablePackagesList.Add_SelectedIndexChanged({
# We're only gonna reset the selected package selection if we have a selection in this listbox
if ($AvailablePackagesList.SelectedIndex -ne -1) {
Set-PackageInformation -PackageName $AvailablePackagesList.SelectedItem
$SelectedPackagesList.ClearSelected()
}
})
$SelectedPackagesLabel = New-Object system.Windows.Forms.Label
$SelectedPackagesLabel.text = "Selected Packages"
$SelectedPackagesLabel.AutoSize = $true
$SelectedPackagesLabel.width = 25
$SelectedPackagesLabel.height = 10
$SelectedPackagesLabel.location = New-Object System.Drawing.Point(64,42)
$SelectedPackagesLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
$AvailablePackagesLabel = New-Object system.Windows.Forms.Label
$AvailablePackagesLabel.text = "Available Packages"
$AvailablePackagesLabel.AutoSize = $true
$AvailablePackagesLabel.width = 25
$AvailablePackagesLabel.height = 10
$AvailablePackagesLabel.location = New-Object System.Drawing.Point(360,42)
$AvailablePackagesLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
################################# Profile Manager Package Addition Controls #################################
$PackageInstallationGroup = New-Object system.Windows.Forms.Groupbox
$PackageInstallationGroup.height = 367
$PackageInstallationGroup.width = 563
$PackageInstallationGroup.text = "Package Installation"
$PackageInstallationGroup.location = New-Object System.Drawing.Point(48,37)
$AddPackageButton = New-Object system.Windows.Forms.Button
$AddPackageButton.text = "<"
$AddPackageButton.width = 43
$AddPackageButton.height = 30
$AddPackageButton.location = New-Object System.Drawing.Point(260,103)
$AddPackageButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$AddPackageButton.Add_Click({Add-SelectedPackage})
$AddAllPackagesButton = New-Object system.Windows.Forms.Button
$AddAllPackagesButton.text = "<<"
$AddAllPackagesButton.width = 43
$AddAllPackagesButton.height = 30
$AddAllPackagesButton.location = New-Object System.Drawing.Point(260,147)
$AddAllPackagesButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$AddAllPackagesButton.Add_Click({Add-AllPackages})
$RemovePackageButton = New-Object system.Windows.Forms.Button
$RemovePackageButton.text = ">"
$RemovePackageButton.width = 43
$RemovePackageButton.height = 30
$RemovePackageButton.location = New-Object System.Drawing.Point(260,207)
$RemovePackageButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RemovePackageButton.Add_Click({Remove-SelectedPackage})
$RemoveAllPackagesButton = New-Object system.Windows.Forms.Button
$RemoveAllPackagesButton.text = ">>"
$RemoveAllPackagesButton.width = 43
$RemoveAllPackagesButton.height = 30
$RemoveAllPackagesButton.location = New-Object System.Drawing.Point(260,254)
$RemoveAllPackagesButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$RemoveAllPackagesButton.Add_Click({Remove-AllPackages})
$AddChocoPackageButton = New-Object system.Windows.Forms.Button
$AddChocoPackageButton.text = "Add Choco Package"
$AddChocoPackageButton.width = 150
$AddChocoPackageButton.height = 25
$AddChocoPackageButton.location = New-Object System.Drawing.Point(396,336)
$AddChocoPackageButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$AddChocoPackageButton.Add_Click({Open-AddChocoPackage})
################################# Profile Manager Package Count Labels #################################
$SelectedCountLabel = New-Object system.Windows.Forms.Label
$SelectedCountLabel.text = "Total:"
$SelectedCountLabel.AutoSize = $true
$SelectedCountLabel.width = 25
$SelectedCountLabel.height = 10
$SelectedCountLabel.location = New-Object System.Drawing.Point(15,342)
$SelectedCountLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',8)
$AvailableCountLabel = New-Object system.Windows.Forms.Label
$AvailableCountLabel.text = "Total:"
$AvailableCountLabel.AutoSize = $true
$AvailableCountLabel.width = 25
$AvailableCountLabel.height = 10
$AvailableCountLabel.location = New-Object System.Drawing.Point(316,340)
$AvailableCountLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',8)
################################# Profile Manager Package Information Controls #################################
$PackageInformationGroup = New-Object system.Windows.Forms.Groupbox
$PackageInformationGroup.height = 168
$PackageInformationGroup.width = 562
$PackageInformationGroup.text = "Package Information"
$PackageInformationGroup.location = New-Object System.Drawing.Point(48,424)
$Authors = New-Object system.Windows.Forms.Label
$Authors.text = "Authors"
$Authors.AutoSize = $false
$Authors.AutoEllipsis = $true
$Authors.width = 450
$Authors.height = 20
$Authors.location = New-Object System.Drawing.Point(70,25)
$Authors.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Version = New-Object system.Windows.Forms.Label
$Version.text = "Version"
$Version.AutoSize = $true
$Version.width = 25
$Version.height = 10
$Version.location = New-Object System.Drawing.Point(70,50)
$Version.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$Description = New-Object system.Windows.Forms.Label
$Description.text = "Tool Description"
$Description.AutoSize = $false
$Description.width = 529
$Description.height = 50
$Description.location = New-Object System.Drawing.Point(10,100)
$Description.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$AuthorsLabel = New-Object system.Windows.Forms.Label
$AuthorsLabel.text = "Authors:"
$AuthorsLabel.AutoSize = $true
$AuthorsLabel.width = 25
$AuthorsLabel.height = 10
$AuthorsLabel.location = New-Object System.Drawing.Point(10,25)
$AuthorsLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$VersionLabel = New-Object system.Windows.Forms.Label
$VersionLabel.text = "Version:"
$VersionLabel.AutoSize = $true
$VersionLabel.width = 25
$VersionLabel.height = 10
$VersionLabel.location = New-Object System.Drawing.Point(10,50)
$VersionLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$DescriptionLabel = New-Object system.Windows.Forms.Label
$DescriptionLabel.text = "Tool Description"
$DescriptionLabel.AutoSize = $true
$DescriptionLabel.width = 25
$DescriptionLabel.height = 10
$DescriptionLabel.location = New-Object System.Drawing.Point(10,75)
$DescriptionLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
################################# Profile Manager Buttons #################################
$DoneButton = New-Object system.Windows.Forms.Button
$DoneButton.text = "Done"
$DoneButton.width = 94
$DoneButton.height = 30
$DoneButton.location = New-Object System.Drawing.Point(424,604)
$DoneButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$DoneButton.Add_Click({
Save-Profile
# Check if "Custom" exists in $ProfileSelector.Items, and add it if it doesn't
if ("Custom" -notin $ProfileSelector.Items) {
$ProfileSelector.Items.Add("Custom")
}
# Set $ProfileSelector.Text to "Custom"
$ProfileSelector.Text = "Custom"
[void]$CommandoProfileManager.Close()
})
$SaveProfileButton = New-Object system.Windows.Forms.Button
$SaveProfileButton.text = "Save Profile As"
$SaveProfileButton.width = 124
$SaveProfileButton.height = 30
$SaveProfileButton.location = New-Object System.Drawing.Point(115,604)
$SaveProfileButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$SaveProfileButton.Add_Click({Save-ProfileAs})
$ResetProfileButton = New-Object system.Windows.Forms.Button
$ResetProfileButton.text = "Reset Profile"
$ResetProfileButton.width = 127
$ResetProfileButton.height = 30
$ResetProfileButton.location = New-Object System.Drawing.Point(269,604)
$ResetProfileButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ResetProfileButton.Add_Click({Set-ProfilePreset -ProfileName $selectedProfile})
################################# Profile Manager Form Constructor #################################
$CommandoProfileManager.controls.AddRange(@($PackageInstallationGroup,$DoneButton,$SaveProfileButton,$ResetProfileButton,$PackageInformationGroup))
$PackageInstallationGroup.controls.AddRange(@($SelectedPackagesLabel,$PresetSelectorLabel,$AddPackageButton,$AddAllPackagesButton,$RemovePackageButton,$RemoveAllPackagesButton,$PresetSelector,$AvailablePackagesLabel,$availableCountLabel,$selectedCountLabel,$SelectedPackagesList,$AvailablePackagesList,$AddChocoPackageButton))
$PackageInformationGroup.controls.AddRange(@($AuthorsLabel,$Description,$DescriptionLabel,$VersionLabel,$Authors,$Version))
#################################################################################################
################################# Password Entry Form Controls ##################################
#################################################################################################
$CommandoPasswordManager = New-Object system.Windows.Forms.Form
$CommandoPasswordManager.ClientSize = New-Object System.Drawing.Point(400,270)
$CommandoPasswordManager.text = "CommandoVM Boxstarter Password"
$CommandoPasswordManager.TopMost = $true
$CommandoPasswordManager.Icon = $icon
$CommandoPasswordManager.StartPosition = 'CenterScreen'
$PasswordOKButton = New-Object system.Windows.Forms.Button
$PasswordOKButton.text = "OK"
$PasswordOKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$PasswordOKButton.width = 95
$PasswordOKButton.height = 28
$PasswordOKButton.location = New-Object System.Drawing.Point(153,230)
$PasswordOKButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordInfoLabel = New-Object system.Windows.Forms.Label
$PasswordInfoLabel.text = "Boxstarter requires user credentials to automatically login and continue the install on a reboot. `n`nIf you do not have a password set, leave the field blank"
$PasswordInfoLabel.AutoSize = $true
$PasswordInfoLabel.Visible = $false
$PasswordInfoLabel.MaximumSize = New-Object System.Drawing.Size(350, 0)
$PasswordInfoLabel.location = New-Object System.Drawing.Point(11,46)
$PasswordInfoLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordInfoHeadingLabel = New-Object system.Windows.Forms.Label
$PasswordInfoHeadingLabel.text = "Why is my password required?"
$PasswordInfoHeadingLabel.AutoSize = $true
$PasswordInfoHeadingLabel.width = 25
$PasswordInfoHeadingLabel.height = 10
$PasswordInfoHeadingLabel.location = New-Object System.Drawing.Point(11,19)
$PasswordInfoHeadingLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$PasswordInfoBoxstarterLabel = New-Object system.Windows.Forms.Label
$PasswordInfoBoxstarterLabel.text = "Learn more at:"
$PasswordInfoBoxstarterLabel.AutoSize = $true
$PasswordInfoBoxstarterLabel.width = 25
$PasswordInfoBoxstarterLabel.height = 10
$PasswordInfoBoxstarterLabel.location = New-Object System.Drawing.Point(11,117)
$PasswordInfoBoxstarterLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordInfoBoxstarterLinkLabel = New-Object system.Windows.Forms.Label
$PasswordInfoBoxstarterLinkLabel.text = "https://boxstarter.org/installingpackages"
$PasswordInfoBoxstarterLinkLabel.AutoSize = $true
$PasswordInfoBoxstarterLinkLabel.width = 25
$PasswordInfoBoxstarterLinkLabel.height = 10
$PasswordInfoBoxstarterLinkLabel.location = New-Object System.Drawing.Point(104,117)
$PasswordInfoBoxstarterLinkLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Underline))
$PasswordTextBox = New-Object system.Windows.Forms.TextBox
$PasswordTextBox.multiline = $false
$PasswordTextBox.width = 226
$PasswordTextBox.height = 20
$PasswordTextBox.UseSystemPasswordChar = $True
$PasswordTextBox.location = New-Object System.Drawing.Point(89,195)
$PasswordTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',14)
$PasswordEntryLabel = New-Object system.Windows.Forms.Label
$PasswordEntryLabel.text = "Enter your user password:"
$PasswordEntryLabel.AutoSize = $true
$PasswordEntryLabel.width = 25
$PasswordEntryLabel.height = 10
$PasswordEntryLabel.location = New-Object System.Drawing.Point(124,171)
$PasswordEntryLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$PasswordInfoGroup = New-Object system.Windows.Forms.Groupbox
$PasswordInfoGroup.height = 145
$PasswordInfoGroup.width = 380
$PasswordInfoGroup.text = "About"
$PasswordInfoGroup.location = New-Object System.Drawing.Point(10,17)
$CommandoPasswordManager.controls.AddRange(@($PasswordOKButton,$PasswordTextBox,$PasswordEntryLabel,$PasswordInfoGroup))
$PasswordInfoGroup.controls.AddRange(@($PasswordInfoLabel,$PasswordInfoHeadingLabel,$PasswordInfoBoxstarterLabel,$PasswordInfoBoxstarterLinkLabel))
#################################################################################################
################################# Chocolatey Package Dialog Box #################################
#################################################################################################
$CommandoChocoManager = New-Object system.Windows.Forms.Form
$CommandoChocoManager.ClientSize = New-Object System.Drawing.Point(407,287)
$CommandoChocoManager.text = "CommandoVM Chocolatey Package"
$CommandoChocoManager.TopMost = $true
$CommandoChocoManager.Icon = $icon
$CommandoChocoManager.StartPosition = 'CenterScreen'
$ChocoPackageTextBox = New-Object system.Windows.Forms.TextBox
$ChocoPackageTextBox.multiline = $false
$ChocoPackageTextBox.width = 231
$ChocoPackageTextBox.height = 20
$ChocoPackageTextBox.location = New-Object System.Drawing.Point(19,185)
$ChocoPackageTextBox.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',14)
$ChocoAboutGroup = New-Object system.Windows.Forms.Groupbox
$ChocoAboutGroup.height = 118
$ChocoAboutGroup.width = 368
$ChocoAboutGroup.text = "About"
$ChocoAboutGroup.location = New-Object System.Drawing.Point(19,22)
$ChocoPackageErrorLabel = New-Object system.Windows.Forms.Label
$ChocoPackageErrorLabel.text = "Chocolatey package not found"
$ChocoPackageErrorLabel.AutoSize = $true
$ChocoPackageErrorLabel.visible = $false
$ChocoPackageErrorLabel.width = 25
$ChocoPackageErrorLabel.height = 10
$ChocoPackageErrorLabel.location = New-Object System.Drawing.Point(115,216)
$ChocoPackageErrorLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ChocoPackageLabel = New-Object system.Windows.Forms.Label
$ChocoPackageLabel.text = "Enter Chocolatey package name:"
$ChocoPackageLabel.AutoSize = $true
$ChocoPackageLabel.width = 25
$ChocoPackageLabel.height = 10
$ChocoPackageLabel.location = New-Object System.Drawing.Point(19,157)
$ChocoPackageLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChocoAboutHeadingLabel = New-Object system.Windows.Forms.Label
$ChocoAboutHeadingLabel.text = "Adding Chocolatey Packages"
$ChocoAboutHeadingLabel.AutoSize = $true
$ChocoAboutHeadingLabel.width = 25
$ChocoAboutHeadingLabel.height = 10
$ChocoAboutHeadingLabel.location = New-Object System.Drawing.Point(4,17)
$ChocoAboutHeadingLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$ChocoAboutLabel = New-Object system.Windows.Forms.Label
$ChocoAboutLabel.text = "CommandoVM uses Chocolatey to install profile packages. You can add any package available in the Chocolatey Community Package Repository to the Commando install. "
$ChocoAboutLabel.AutoSize = $true
$ChocoAboutLabel.MaximumSize = New-Object System.Drawing.Size(370, 0)
$ChocoAboutLabel.location = New-Object System.Drawing.Point(4,42)
$ChocoAboutLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChocoLearnMoreLabel = New-Object system.Windows.Forms.Label
$ChocoLearnMoreLabel.text = "Learn More at:"
$ChocoLearnMoreLabel.AutoSize = $true
$ChocoLearnMoreLabel.width = 25
$ChocoLearnMoreLabel.height = 10
$ChocoLearnMoreLabel.location = New-Object System.Drawing.Point(4,93)
$ChocoLearnMoreLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChocoLinkLabel = New-Object system.Windows.Forms.Label
$ChocoLinkLabel.text = "https://community.chocolatey.org/packages"
$ChocoLinkLabel.AutoSize = $true
$ChocoLinkLabel.width = 25
$ChocoLinkLabel.height = 10
$ChocoLinkLabel.location = New-Object System.Drawing.Point(95,93)
$ChocoLinkLabel.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Underline))
$ChocoAddPackageButton = New-Object system.Windows.Forms.Button
$ChocoAddPackageButton.text = "Add Package"
$ChocoAddPackageButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$ChocoAddPackageButton.width = 118
$ChocoAddPackageButton.height = 30
$ChocoAddPackageButton.enabled = $false
$ChocoAddPackageButton.location = New-Object System.Drawing.Point(144,238)
$ChocoAddPackageButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChocoFindPackageButton = New-Object system.Windows.Forms.Button
$ChocoFindPackageButton.text = "Find Package"
$ChocoFindPackageButton.width = 118
$ChocoFindPackageButton.height = 30
$ChocoFindPackageButton.enabled = $true
$ChocoFindPackageButton.location = New-Object System.Drawing.Point(269,185)
$ChocoFindPackageButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
$ChocoFindPackageButton.Add_Click({
if (Get-ChocoPackage -PackageName $ChocoPackageTextBox.Text) {
$ChocoPackageErrorLabel.Text = "Found Chocolatey package"
$ChocoPackageErrorLabel.ForeColor = $successColor
$ChocoPackageErrorLabel.Visible = $true
$ChocoAddPackageButton.Enabled = $true
} else {
$ChocoPackageErrorLabel.text = "Chocolatey package not found"
$ChocoPackageErrorLabel.ForeColor = $errorColor
$ChocoPackageErrorLabel.Visible = $true
$ChocoAddPackageButton.Enabled = $false
}
})
$CommandoChocoManager.controls.AddRange(@($ChocoPackageTextBox,$ChocoAddPackageButton,$ChocoAboutGroup,$ChocoPackageErrorLabel,$ChocoPackageLabel,$ChocoFindPackageButton))
$ChocoAboutGroup.controls.AddRange(@($ChocoAboutHeadingLabel,$ChocoAboutLabel,$ChocoLearnMoreLabel,$ChocoLinkLabel))
}
#################################################################################################
#################################################################################################
###################################### Installer Functions ######################################
#################################################################################################
#################################################################################################
################################# Functions that conduct Pre-Install Checks #################################
function Check-Admin {
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
return $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
function Check-ExecutionPolicy {
return (Get-ExecutionPolicy).ToString() -eq "Unrestricted"
}
function Check-DefenderAndTamperProtection {
$defender = Get-WmiObject -Namespace "root\Microsoft\Windows\Defender" -Class MSFT_MpPreference
if ($defender.DisableRealtimeMonitoring) {
if (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Defender\Features" -Name "TamperProtection" -ea 0) {
return (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Defender\Features" -Name "TamperProtection").TamperProtection -ne 5
}
}
return $false
}
function Check-SupportedOS {
$osVersion = (Get-WmiObject -class Win32_OperatingSystem).BuildNumber
$testedVersions = @(19045, 22621)
return $osVersion -in $testedVersions
}
function Check-VM {
$virtualModels = @('VirtualBox', 'VMware', 'Virtual Machine', 'Hyper-V')
$computerSystemModel = (Get-WmiObject win32_computersystem).model
$isVirtualModel = $false
foreach ($model in $virtualModels) {
if ($computerSystemModel.Contains($model)) {
$isVirtualModel = $true
break
}
}
if (!$isVirtualModel) {
return $false
} else {
return $true
}
}
function Check-Storage {
$disk = Get-PSDrive (Get-Location).Drive.Name
Start-Sleep -Seconds 1
if (($disk.used + $disk.free)/1GB -gt 68.8) {
return $true
} else {
return $false
}
}
################################# Functions that change pre-install check configs #################################
function Check-ChocoBoxstarterVersions {
$boxstarterVersionGood = $false
$chocolateyVersionGood = $false
if(${Env:ChocolateyInstall} -and (Test-Path "${Env:ChocolateyInstall}\bin\choco.exe")) {
$chocoVersion = choco --version
$chocolateyVersionGood = [System.Version]$chocoVersion -ge [System.Version]"0.10.13"
choco info -l -r "boxstarter" | ForEach-Object { $name, $chocoVersion = $_ -split '\|' }
$boxstarterVersionGood = [System.Version]$chocoVersion -ge [System.Version]"3.0.0"
if ($chocolateyVersionGood -and $boxstarterVersionGood) {
return $true
} else {
return $false