From 1330befd13ba93fa0b6c9ad5bfbea5433c41e388 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 30 May 2024 01:51:58 -0700 Subject: [PATCH] Update PE setup sections --- setup/build_pe.cmd | 0 setup/pe/System32/Winpeshl.ini | 3 +-- setup/pe/build_pe.ps1 | 33 ++++++++++++++++------- setup/pe/tools/deja-vu.toml | 1 + setup/pe/tools/menu.cmd | 11 ++++++++ setup/pe/tools/npp.cmd | 3 +++ setup/pe/tools/pe-menu.toml | 2 ++ setup/pe/tools/tools/01-deja-vu.toml | 4 +++ setup/pe/tools/tools/01-z_separator_.toml | 4 +++ setup/pe/tools/tools/02-diskpart.toml | 4 +++ setup/pe/tools/tools/03-regedit.toml | 4 +++ setup/pe/tools/tools/04-ntpwedit.toml | 4 +++ 12 files changed, 62 insertions(+), 11 deletions(-) mode change 100755 => 100644 setup/build_pe.cmd create mode 100644 setup/pe/tools/deja-vu.toml create mode 100644 setup/pe/tools/menu.cmd create mode 100644 setup/pe/tools/npp.cmd create mode 100644 setup/pe/tools/pe-menu.toml create mode 100644 setup/pe/tools/tools/01-deja-vu.toml create mode 100644 setup/pe/tools/tools/01-z_separator_.toml create mode 100644 setup/pe/tools/tools/02-diskpart.toml create mode 100644 setup/pe/tools/tools/03-regedit.toml create mode 100644 setup/pe/tools/tools/04-ntpwedit.toml diff --git a/setup/build_pe.cmd b/setup/build_pe.cmd old mode 100755 new mode 100644 diff --git a/setup/pe/System32/Winpeshl.ini b/setup/pe/System32/Winpeshl.ini index 5883bef4..2006e5d5 100644 --- a/setup/pe/System32/Winpeshl.ini +++ b/setup/pe/System32/Winpeshl.ini @@ -2,5 +2,4 @@ [LaunchApps] wpeinit wpeutil updatebootinfo -cd /d "%SystemDrive%" -"%SystemDrive%\Program Files\ConEmu\ConEmu64.exe", /cmd cmd /k cd "%SystemDrive%" +"%SystemDrive%\Program Files\ConEmu\ConEmu64.exe", /cmd cmd /k "%SystemDrive%\tools\menu.cmd" diff --git a/setup/pe/build_pe.ps1 b/setup/pe/build_pe.ps1 index 8bce5112..a461151e 100644 --- a/setup/pe/build_pe.ps1 +++ b/setup/pe/build_pe.ps1 @@ -7,7 +7,7 @@ if (Test-Path Env:\DEBUG) { Set-PSDebug -Trace 1 } # TODO REMOVE v -$KitNameShort = "WK" +$KitNameShort = "1201" # TODO REMOVE ^ $Arch = "amd64" $Host.UI.RawUI.WindowTitle = "Wizard Kit: Windows PE Build Tool" @@ -16,6 +16,7 @@ $SetupDir = (Get-Item $WD -Force).Parent.FullName $Root = (Get-Item $SetupDir -Force).Parent.FullName $BuildDir = "$SetupDir\BUILD_PE" $BinDir = "$BuildDir\bin" +$ToolsDir = "$BuildDir\tools" $OutDir = "$SetupDir\OUT_PE" $LogDir = "$BuildDir\Logs" $Temp = "$BuildDir\Temp" @@ -64,9 +65,14 @@ function FindDynamicUrl ($SourcePage, $RegEx) { } function MakeClean { $Folders = @( - "$BuildDir\bin", "$BuildDir\mount", - "$BuildDir\pe_files") + "$BuildDir\pe_files", + "$BuildDir\tools") + # $Folders = @( + # "$BuildDir\bin", + # "$BuildDir\mount", + # "$BuildDir\pe_files", + # "$BuildDir\tools") foreach ($f in $Folders) { if (Test-Path $f) { Write-Host -ForegroundColor "Yellow" ("Found: {0}" -f $f) @@ -116,7 +122,7 @@ if ($MyInvocation.InvocationName -ne ".") { $DownloadErrors = 0 DownloadFile -Path $Temp -Name "7z-installer.msi" -Url $Sources.'7-Zip' DownloadFile -Path $Temp -Name "ConEmuPack.7z" -Url $Sources.'ConEmu' - DownloadFile -Path $Temp -Name "notepadplusplus.zip" -Url $Sources.'Notepad++' + DownloadFile -Path $Temp -Name "notepadplusplus.7z" -Url $Sources.'Notepad++' DownloadFile -Path $Temp -Name "ntpwedit.zip" -Url $Sources.'NTPWEdit' DownloadFile -Path $Temp -Name "wimlib.zip" -Url $Sources.'wimlib' @@ -128,6 +134,7 @@ if ($MyInvocation.InvocationName -ne ".") { ## Extract ## Copy-Item -Path "$SetupDir\pe\bin" -Destination "$BinDir" -Recurse -Force + Copy-Item -Path "$SetupDir\pe\tools" -Destination "$ToolsDir" -Recurse -Force # 7-Zip Write-Host "Extracting: 7-Zip" @@ -234,6 +241,16 @@ if ($MyInvocation.InvocationName -ne ".") { "WinPE-WMI", "WinPE-SecureStartup" ) + # $WinPEPackages = @( + # "WinPE-EnhancedStorage", + # "WinPE-FMAPI", + # "WinPE-WMI", + # "WinPE-SecureStartup", + # "WinPE-NetFX", + # "WinPE-Scripting", + # "WinPE-PowerShell", + # "WinPE-StorageWMI" + # ) foreach ($Package in $WinPEPackages) { $PackagePath = ("{0}\{1}\WinPE_OCs\{2}.cab" -f $Env:WinPERoot, $Arch, $Package) Write-Host " $Package..." @@ -255,6 +272,8 @@ if ($MyInvocation.InvocationName -ne ".") { # Add tools Write-Host "Copying tools..." Copy-Item -Path "$BinDir\*" -Destination "$Mount\Program Files" -Recurse -Force + New-Item -Path "$Mount\tools" -ItemType "directory" -Force | Out-Null + Copy-Item -Path "$ToolsDir\*" -Destination "$Mount\tools" -Recurse -Force Copy-Item -Path "$Root\Images\WinPE.jpg" -Destination "$Mount\Program Files\ConEmu\ConEmu.jpg" -Recurse -Force # Add System32 items @@ -288,13 +307,9 @@ if ($MyInvocation.InvocationName -ne ".") { $Hive.close() $RegKey.close() - # Hasleo Disk Clone - # $ArgumentList = @("import", "$SetupDir\pe\Hasleo.reg") - # Start-Process -FilePath $Reg -ArgumentList $ArgumentList -NoNewWindow -Wait - # Replace Notepad $RegPath = "HKLM:\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" - $NewValue = 'cmd /c "%SystemDrive%\.bin\NotepadPlusPlus\npp.cmd"' + $NewValue = 'cmd /c "%SystemDrive%\tools\npp.cmd"' New-Item -Path $RegPath -Force | Out-Null New-ItemProperty -Path $RegPath -Name "Debugger" -Value $NewValue -Force | Out-Null diff --git a/setup/pe/tools/deja-vu.toml b/setup/pe/tools/deja-vu.toml new file mode 100644 index 00000000..41cba102 --- /dev/null +++ b/setup/pe/tools/deja-vu.toml @@ -0,0 +1 @@ +clone_app = 'X:\Program Files\Some\tool.exe' diff --git a/setup/pe/tools/menu.cmd b/setup/pe/tools/menu.cmd new file mode 100644 index 00000000..ea6d0726 --- /dev/null +++ b/setup/pe/tools/menu.cmd @@ -0,0 +1,11 @@ +@echo off +pushd %~dp0 +wpeutil EnableFirewall + +:loop +cls +pe-menu.exe +goto loop + +:done +popd diff --git a/setup/pe/tools/npp.cmd b/setup/pe/tools/npp.cmd new file mode 100644 index 00000000..260b38be --- /dev/null +++ b/setup/pe/tools/npp.cmd @@ -0,0 +1,3 @@ +@echo off + +start "" "%PROGRAMFILES%\NotepadPlusPlus\notepad++.exe" %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/setup/pe/tools/pe-menu.toml b/setup/pe/tools/pe-menu.toml new file mode 100644 index 00000000..377a4442 --- /dev/null +++ b/setup/pe/tools/pe-menu.toml @@ -0,0 +1,2 @@ +con_emu = 'X:\Program Files\ConEmu\ConEmu64.exe' +tools = [] diff --git a/setup/pe/tools/tools/01-deja-vu.toml b/setup/pe/tools/tools/01-deja-vu.toml new file mode 100644 index 00000000..68996224 --- /dev/null +++ b/setup/pe/tools/tools/01-deja-vu.toml @@ -0,0 +1,4 @@ +name = 'Deja-Vu' +command = 'X:\tools\deja-vu.exe' +use_conemu = true +separator = false diff --git a/setup/pe/tools/tools/01-z_separator_.toml b/setup/pe/tools/tools/01-z_separator_.toml new file mode 100644 index 00000000..ed50f1c4 --- /dev/null +++ b/setup/pe/tools/tools/01-z_separator_.toml @@ -0,0 +1,4 @@ +name = '' +command = '' +use_conemu = false +separator = true diff --git a/setup/pe/tools/tools/02-diskpart.toml b/setup/pe/tools/tools/02-diskpart.toml new file mode 100644 index 00000000..554a5304 --- /dev/null +++ b/setup/pe/tools/tools/02-diskpart.toml @@ -0,0 +1,4 @@ +name = 'Diskpart' +command = 'X:\Windows\System32\diskpart.exe' +use_conemu = true +separator = false diff --git a/setup/pe/tools/tools/03-regedit.toml b/setup/pe/tools/tools/03-regedit.toml new file mode 100644 index 00000000..82ad1d2c --- /dev/null +++ b/setup/pe/tools/tools/03-regedit.toml @@ -0,0 +1,4 @@ +name = 'Registry Editor' +command = 'X:\Windows\regedit.exe' +use_conemu = false +separator = false diff --git a/setup/pe/tools/tools/04-ntpwedit.toml b/setup/pe/tools/tools/04-ntpwedit.toml new file mode 100644 index 00000000..9b07df9f --- /dev/null +++ b/setup/pe/tools/tools/04-ntpwedit.toml @@ -0,0 +1,4 @@ +name = 'NTPWEdit' +command = 'X:\Program Files\NTPWEdit\ntpwedit.exe' +use_conemu = false +separator = false