Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
the-zphr authored Oct 29, 2023
1 parent 890bd60 commit 1d13a65
Show file tree
Hide file tree
Showing 26 changed files with 596 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://github.com/Atlas-OS/Atlas-Utilities
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://github.com/amitxv/TimerResolution
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://github.com/he3als/online-sxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://github.com/he3als/setSvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://github.com/echnobas/sxsc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
45 changes: 45 additions & 0 deletions src/playbook/Executables/AlatasModules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Sources
To verify the legitimacy of these binaries (executables), there is information provided here for each binary for hashes, sources and when each was last verified/checked with the SHA256 hash. Verified using `Get-FileHash` in PowerShell.

The root of the file paths listed here starts in `src\playbook\Executables`.

### File Picker
- Path: `\AlatasModules\Tools\filepicker.exe`
- SHA256 Hash: `10A9AB81DE68A6ACEBD6E0D393ECC8869A4DAE852F78CF9093740AD8752DA0DE`
- Source: https://github.com/Atlas-OS/Atlas-Utilities/releases/download/filepicker-rs-v0.1/filepicker.exe
- Repository: https://github.com/Atlas-OS/Atlas-Utilities
- Version: v0.1
- License: [GNU General Public License v3.0](https://github.com/Atlas-OS/utilities/blob/main/LICENSE)
- Last Verified: 8/9/2023 by Xyueta

### Multi-Choice
- Path: `\AlatasModules\Tools\multichoice.exe`
- SHA256 Hash: `6AB2FF0163AFE0FAC4E7506F9A63293421A1880076944339700A59A06578927D`
- Source: https://github.com/Atlas-OS/Atlas-Utilities/releases/download/multichoice-v0.4/multichoice-compressed.exe
- Repository: https://github.com/Atlas-OS/Atlas-Utilities
- Version: v0.4
- Renamed to `multichoice.exe`
- License: [GNU General Public License v3.0](https://github.com/Atlas-OS/utilities/blob/main/LICENSE)
- Last Verified: 8/9/2023 by Xyueta

## NSudo
- Path: `NSudoLC.exe`
- SHA256 Hash: `9E166D334ECC9814E42ECCE759C3FA30F350D0AAEF68A67CC77E04258BE69722`
- Source: https://github.com/M2TeamArchived/NSudo/releases/download/9.0-Preview1/NSudo_9.0_Preview1_9.0.2676.0.zip
- Repository: https://github.com/M2TeamArchived/NSudo
- Version: 9.0 Preview 1 (9.0.2676.0)
- License: [The MIT License](https://github.com/M2TeamArchived/NSudo/blob/master/License.md)
- Last Verified: 8/9/2023 by Xyueta

## SetTimerResolution & MeasureSleep
- Path: `\AlatasModules\Tools\SetTimerResolution.exe`
- SHA256 Hash: `FE3CDBE2E332E48921FFA2A9697A66F71472D878154BA331D12ADC7E7C767A2B`
- Source: https://github.com/amitxv/TimerResolution/releases/download/SetTimerResolution-v0.1.3/SetTimerResolution.exe
- Version: v0.1.3
- Path: `\AlatasDesktop\3. Configuration\Power\Timer Resolution\MeasureSleep.exe`
- SHA256 Hash: `055425A39CE8E766055EE2DE3F4CEE1714BCA31F274BF0C9F658009F551E9E73`
- Source: https://github.com/amitxv/TimerResolution/releases/download/MeasureSleep-v0.1.6/MeasureSleep.exe
- Version: v0.1.6
- Repository: https://github.com/amitxv/TimerResolution
- License: [GNU General Public License v3.0](https://github.com/M2TeamArchived/NSudo/blob/master/License.md)
- Last Verified: 8/12/2023 by he3als
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<#
.Synopsis
Sets a certain user Registry value for all users.
.Example
Alatas-AllUserRegistry -Action AddValue -Path "\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers" -Name "BackgroundType" -Value 0
#>

function Alatas-AllUserRegistry {
param (
[Parameter(Mandatory = $true)]
[ValidateSet("AddKey", "DeleteKey", "AddValue", "DeleteValue")]
[string]$Action,

[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Path,

[string]$Name,

[string]$Value,

[ValidateSet("String", "ExpandString", "Binary", "DWord", "QWord", "MultiString")]
[string]$PropertyType = "DWord"
)

if ($Action -eq "AddKey" -and -not $Path) {
throw "Parameter 'Path' is mandatory when 'Action' is set to 'AddKey'."
}

if (($Action -eq "AddValue" -or $Action -eq "DeleteValue") -and -not $Name) {
throw "Parameter 'Name' is mandatory when 'Action' is set to 'AddValue' or 'DeleteValue'."
}

if ($Action -eq "AddValue" -and (-not $PropertyType -or -not $Value)) {
throw "Parameters 'PropertyType' and 'Value' are mandatory when 'Action' is set to 'AddValue'."
}

Get-ChildItem "Registry::HKEY_USERS" | ForEach-Object {
$userKey = $_.Name
if ($userKey -match '^HKEY_USERS\\.DEFAULT') {$DEFAULT = $true} else {$DEFAULT = $false}
if ($userKey -match "^HKEY_USERS\\S-.+" -or $userKey -match "^HKEY_USERS\\AME_UserHive_[^_]*" -or $DEFAULT) {
$userKey1 = "Registry::$userKey"
if ((Test-Path "$userKey1\Volatile Environment") -or (Test-Path "$userKey1\AME_UserHive_") -or $DEFAULT) {
$userPath = Join-Path $userKey1 $Path

if (!($DEFAULT)) {
$SID = New-Object System.Security.Principal.SecurityIdentifier($userKey -replace "^HKEY_USERS\\","")
$objUser = $SID.Translate([System.Security.Principal.NTAccount])
$username = $objUser.Value
} else {$username = 'DEFAULT'}

switch ($Action) {
"AddKey" {
New-Item -Path $userPath -Name $Name -Force | Out-Null
if ($?) {Write-Host "Added key '$Path' for $username."}
}
"DeleteKey" {
Remove-Item -Path $userPath -Force -Recurse | Out-Null
if ($?) {Write-Host "Removed key '$Path' for $username."}
}
"AddValue" {
New-Item -Path $userPath -Force | Out-Null
New-ItemProperty -Path $userPath -Name $Name -Value $Value -PropertyType $PropertyType -Force | Out-Null
if ($?) {Write-Host "Added value '$Name' under '$Path' for $username."}
}
"DeleteValue" {
Remove-ItemProperty -Path $userPath -Name $Name -Force | Out-Null
if ($?) {Write-Host "Deleted value '$Name' under '$Path' for $username."}
}
}
}
}
}
}

Export-ModuleMember -Function Alatas-AllUserRegistry
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<#
.Synopsis
Uninstalls MSIExec uninstaller applications by name.
.Description
Uninstalls applications that use MSIExec uninstallers recursively based on a
wildcarded display name (DisplayName in Registry).
.Parameter Name
The display name of the MSIExec uninstaller application(s) to wildcard
and uninstall.
.Example
# Uninstalls any apps matching "Microsoft Update Health Tools"
Uninstall-MsiexecAppByName -Name "Microsoft Update Health Tools"
#>

function Uninstall-MsiexecAppByName {
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Name
)

if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
throw "Uninstall-MsiexecAppByName: Not running as an administrator!"
}

$uninstallKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$uninstallKeys = Get-ChildItem -Path $uninstallKeyPath -EA SilentlyContinue

foreach ($key in $uninstallKeys.PSPath) {
$displayName = (Get-ItemProperty -Path "$key").DisplayName
if ($displayName -like "*$Name*") {
$uninstallString = (Get-ItemProperty -Path "$key").UninstallString
if ($uninstallString -like "*MsiExec.exe*") {
$foundKey = $key | Split-Path -Leaf
Write-Warning "Uninstalling $displayName..."
Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /X$foundKey REBOOT=ReallySuppress /norestart" 2>&1 | Out-Null
}
}
}

if ($null -eq $foundKey) {
throw "Uninstall-MsiexecAppByName: No app found with an MSIExec uninstaller with the display name containing '$Name'."
}
}

Export-ModuleMember -Function Uninstall-MsiexecAppByName
146 changes: 146 additions & 0 deletions src/playbook/Executables/AlatasModules/Scripts/RunAsTI.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<# : batch portion
@echo off

goto RunAsTI-Elevate

----------------------------------------
[CREDITS]
- Adapted from https://github.com/AveYo/LeanAndMean
- Revised and customized for Alatas by he3als & Xyueta
- Added error checking, an interface and quotes support

[FEATURES]
- Innovative HKCU load, no need for 'reg load' or unload ping-pong; programs get the user profile
- Sets ownership privileges, high priority, and Explorer support; get System if TrustedInstaller is unavailable
- Accepts special characters in paths for which default 'Run as Administrator' fails

[USAGE]
- call RunAsTI.cmd "[executable]" [args (optional)]
- Put this at the top of your script:

whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
call RunAsTI.cmd "%~f0" %*
exit /b
)
----------------------------------------

:RunAsTI-Elevate
if "%~1" == "" (
set /P program_path="Enter the valid path of the program or drag it here: "
if "%program_path%" == "" (
echo error: no input
timeout /t 1 > nul
cls
goto RunAsTI-Elevate
)

call :RunAsTI %program_path%
exit /b 1
)

call :RunAsTI %*
exit /b

:RunAsTI-Declined
echo]
echo Self-elevation to TrustedInstaller failed, because the UAC prompt was declined.
echo Selecting 'Yes' to the UAC prompt is required for this script.
echo]
echo Press any key to attempt to elevate again...
pause > nul
goto RunAsTI-Elevate

:RunAsTI-Fail
echo]
echo Executing the script as TrustedInstaller failed with the RunAsTI snippet.
echo An unknown error has occured, please report this (with the error) or attempt to elevate again!
echo]
echo Press any key to attempt to elevate again...
pause > nul
goto RunAsTI-Elevate

:RunAsTI
set "0=%~f0"
set "1=%*"
powershell -nop -c iex(gc """$env:0""" -Raw)
set "RunAsTI_Errorlevel=%errorlevel%"
if "%RunAsTI_Errorlevel%" == "1" (
goto RunAsTI-Fail
) else (
if "%RunAsTI_Errorlevel%" == "2" (
goto RunAsTI-Declined
) else (
exit /b
)
)
: end batch / begin powershell #>

function RunAsTI ($cmd,$arg) { $id='RunAsTI'; $key="Registry::HKU\$(((whoami /user)-split' ')[-1])\Volatile Environment"; $code=@'
$I=[int32]; $M=$I.module.gettype("System.Runtime.Interop`Services.Mar`shal"); $P=$I.module.gettype("System.Int`Ptr"); $S=[string]
$D=@(); $T=@(); $DM=[AppDomain]::CurrentDomain."DefineDynami`cAssembly"(1,1)."DefineDynami`cModule"(1); $Z=[uintptr]::size
0..5|% {$D += $DM."Defin`eType"("AveYo_$_",1179913,[ValueType])}; $D += [uintptr]; 4..6|% {$D += $D[$_]."MakeByR`efType"()}
$F='kernel','advapi','advapi', ($S,$S,$I,$I,$I,$I,$I,$S,$D[7],$D[8]), ([uintptr],$S,$I,$I,$D[9]),([uintptr],$S,$I,$I,[byte[]],$I)
0..2|% {$9=$D[0]."DefinePInvok`eMethod"(('CreateProcess','RegOpenKeyEx','RegSetValueEx')[$_],$F[$_]+'32',8214,1,$S,$F[$_+3],1,4)}
$DF=($P,$I,$P),($I,$I,$I,$I,$P,$D[1]),($I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$P,$P,$P,$P),($D[3],$P),($P,$P,$I,$I)
1..5|% {$k=$_; $n=1; $DF[$_-1]|% {$9=$D[$k]."Defin`eField"('f' + $n++, $_, 6)}}; 0..5|% {$T += $D[$_]."Creat`eType"()}
0..5|% {nv "A$_" ([Activator]::CreateInstance($T[$_])) -fo}; function F ($1,$2) {$T[0]."G`etMethod"($1).invoke(0,$2)}
$TI=(whoami /groups)-like'*1-16-16384*'; $As=0; if(!$cmd) {$cmd='control';$arg='admintools'}; if ($cmd-eq'This PC'){$cmd='file:'}
if (!$TI) {'TrustedInstaller','lsass','winlogon'|% {if (!$As) {$9=sc.exe start $_; $As=@(get-process -name $_ -ea 0|% {$_})[0]}}
function M ($1,$2,$3) {$M."G`etMethod"($1,[type[]]$2).invoke(0,$3)}; $H=@(); $Z,(4*$Z+16)|% {$H += M "AllocHG`lobal" $I $_}
M "WriteInt`Ptr" ($P,$P) ($H[0],$As.Handle); $A1.f1=131072; $A1.f2=$Z; $A1.f3=$H[0]; $A2.f1=1; $A2.f2=1; $A2.f3=1; $A2.f4=1
$A2.f6=$A1; $A3.f1=10*$Z+32; $A4.f1=$A3; $A4.f2=$H[1]; M "StructureTo`Ptr" ($D[2],$P,[boolean]) (($A2 -as $D[2]),$A4.f2,$false)
$Run=@($null, "powershell -win 1 -nop -c iex `$env:R; # $id", 0, 0, 0, 0x0E080600, 0, $null, ($A4 -as $T[4]), ($A5 -as $T[5]))
F 'CreateProcess' $Run; return}; $env:R=''; rp $key $id -force; $priv=[diagnostics.process]."GetM`ember"('SetPrivilege',42)[0]
'SeSecurityPrivilege','SeTakeOwnershipPrivilege','SeBackupPrivilege','SeRestorePrivilege' |% {$priv.Invoke($null, @("$_",2))}
$HKU=[uintptr][uint32]2147483651; $NT='S-1-5-18'; $reg=($HKU,$NT,8,2,($HKU -as $D[9])); F 'RegOpenKeyEx' $reg; $LNK=$reg[4]
function L ($1,$2,$3) {sp 'HKLM:\SOFTWARE\Classes\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}' 'RunAs' $3 -force -ea 0
$b=[Text.Encoding]::Unicode.GetBytes("\Registry\User\$1"); F 'RegSetValueEx' @($2,'SymbolicLinkValue',0,6,[byte[]]$b,$b.Length)}
function Q {[int](gwmi win32_process -filter 'name="explorer.exe"'|?{$_.getownersid().sid-eq$NT}|select -last 1).ProcessId}
$11bug=($((gwmi Win32_OperatingSystem).BuildNumber)-eq'22000')-AND(($cmd-eq'file:')-OR(test-path -lit $cmd -PathType Container))
if ($11bug) {'System.Windows.Forms','Microsoft.VisualBasic' |% {[Reflection.Assembly]::LoadWithPartialName("'$_")}}
if ($11bug) {$path='^(l)'+$($cmd -replace '([\+\^\%\~\(\)\[\]])','{$1}')+'{ENTER}'; $cmd='control.exe'; $arg='admintools'}
L ($key-split'\\')[1] $LNK ''; $R=[diagnostics.process]::start($cmd,$arg); if ($R) {$R.PriorityClass='High'; $R.WaitForExit()}
if ($11bug) {$w=0; do {if($w-gt40){break}; sleep -mi 250;$w++} until (Q); [Microsoft.VisualBasic.Interaction]::AppActivate($(Q))}
if ($11bug) {[Windows.Forms.SendKeys]::SendWait($path)}; do {sleep 7} while(Q); L '.Default' $LNK 'Interactive User'
'@; $V='';'cmd','arg','id','key'|%{$V+="`n`$$_='$($(gv $_ -val)-replace"'","''")';"}; sp $key $id $($V,$code) -type 7 -force -ea 0
start powershell -args "-win 1 -nop -c `n$V `$env:R=(gi `$key -ea 0).getvalue(`$id)-join''; iex `$env:R" -verb runas
} #:RunAsTI lean & mean snippet by AveYo, 2023.07.06

Try {
$initArgs = $env:1
$split = ($initArgs -split ' ')[0]

if ($split -like '*"*') {
$exe = ''; $quoteCount = 0
foreach ($char in $initArgs.ToCharArray()) {
$exe += $char
if ($char -eq '"') {
$quoteCount++
if ($quoteCount -eq 2) {break}
}
}
} else {
$exe = $split
}

$arguments = ($initArgs.Remove(0, $exe.Length)).Trim()

RunAsTI $exe $arguments
}
Catch {
Write-Host ""
$UACDeclined = $PSItem | Select-String -pattern "The operation was canceled by the user" -quiet
if ( $UACDeclined )
{
$exitcode = 2
Write-Host "PowerShell: UAC prompt was declined!" -ForegroundColor Red
}
else {
$exitcode = 1
Write-Host "PowerShell: Failed to self-elevate (unknown error)!" -ForegroundColor Red
Write-Host ""
Write-Host Error: $PSItem -ForegroundColor Red
Write-Host Where: $PSItem.ScriptStackTrace -ForegroundColor Red
}
exit $exitcode
}
Loading

0 comments on commit 1d13a65

Please sign in to comment.