Skip to content

Instantly share code, notes, and snippets.

@onesmartguy
Last active December 3, 2021 17:44
Show Gist options
  • Save onesmartguy/5609ce4249da8510f8a8dbd1248ea6c2 to your computer and use it in GitHub Desktop.
Save onesmartguy/5609ce4249da8510f8a8dbd1248ea6c2 to your computer and use it in GitHub Desktop.
$InstallDir = "$env:USERPROFILE\.love"
$SourceZip = "$env:TEMP\love.zip"
$SourceZipTemp = "$env:TEMP\love"
$GitRepo = "https://api.github.com/repos/onesmartguy/idle-bot/zipball/"
$LogStart = 'Log '
$LogDate = Get-Date -Format "dd-MM-yyy-hh-mm-ss"
$LogFileName = $LogStart + $LogDate + '.txt.'
$StartingLocation = Get-Location
if (!(Test-Path $InstallDir))
{
New-Item $InstallDir -ItemType Directory -Force > $null
Write-Host "Folder Created successfully"
}
$Folder = Get-Item $InstallDir -Force
$HiddenAttributes = $Folder.Attributes -bor [System.IO.FileAttributes]::Hidden
$UnhiddenAttributes = $Folder.Attributes -band -bnot [System.IO.FileAttributes]::Hidden
if($Folder.Attributes -eq ($UnhiddenAttributes)){
Write-Host "Hiding Folder: $Folder"
$Folder.attributes = $HiddenAttributes
}
Write-Host "Repo: $GitRepo"
Write-Host "secret: $TOKEN"
$TOKEN = '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'
Invoke-RestMethod -Uri $GitRepo -Headers @{ Accept = "application/vnd.github.v3+json"
Authorization = "token $TOKEN" } -OutFile $SourceZip # -OutFile $SourceZip
$ExtractShell = New-Object -ComObject Shell.Application
$Files = $ExtractShell.Namespace($SourceZip).Items()
New-Item $SourceZipTemp -ItemType Directory -Force > $null
$ExtractShell.NameSpace($SourceZipTemp).CopyHere($Files, 0x14)
Get-ChildItem -Path $SourceZipTemp -Recurse -Include *.* | % {Join-Path -Path $_.Directory -ChildPath $_.Name } | Copy-Item -Destination $InstallDir -Force
Remove-Item -Path $SourceZip -Force
Get-ChildItem $SourceZipTemp -Recurse | Remove-Item -Recurse -Force
$scriptList = @(
"$InstallDir\Install.ps1"
"$InstallDir\Disable-Jiggler.ps1"
);
Start-Transcript -Path "C:\Scripts\$LogFileName"
foreach ($script in $scriptList) {
& $script
Write-Output "The $script is running."
}
Stop-Transcript
Start-Process $InstallDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment