www.allisat-software.de
Open in
urlscan Pro
82.165.72.129
Public Scan
URL:
https://www.allisat-software.de/portal/RequestDirectDownload?DC=7cd25242-bc2e-4ff6-8744-74da4d2aeda6&K=NzFpTBIjN7M8LcuK
Submission: On April 25 via api from DE — Scanned from DE
Submission: On April 25 via api from DE — Scanned from DE
Form analysis
0 forms found in the DOMText Content
# ****************************** # Script parameter # ****************************** # # Examples: # -scriptmode headless -scriptoutput verbose # -scriptmode ui -scriptoutput silent # param ($scriptmode='headless', $scriptoutput='verbose', $scriptpath) # check mandatory parameters #if ($scriptmode -eq $null) { #$scriptmode = read-host -Prompt "Please enter a scriptmode" #} if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Parameter" Write-Output "******************************" Write-Output "scriptmode = $scriptmode" Write-Output "scriptoutput = $scriptoutput" if($scriptpath -ne $null) { Write-Output "scriptpath = $scriptpath" } } # ****************************** # Change directory to script path # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Change directory to script path" Write-Output "******************************" } if($scriptpath -ne $null) { Set-Location -Path "$scriptpath" [System.IO.Directory]::SetCurrentDirectory("$scriptpath") Write-Output "Changing directory to $scriptpath" } else { $scriptpath = $(get-location).Path [System.IO.Directory]::SetCurrentDirectory("$scriptpath") } Write-Output "Current powershell-directory is: ",$(get-location).Path Write-Output "Current .NET-directory is: ",([System.IO.Directory]::GetCurrentDirectory()) # ****************************** # Retrieve current application name # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Retrieve current application name" Write-Output "******************************" } $foldername = Split-Path (Split-Path ('"{0}"' -f $MyInvocation.MyCommand.Path) -Parent) -Leaf Write-Output "Current application name is: $foldername" # ****************************** # TLS 1.2 # ****************************** # [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # ****************************** # Read license # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Read license" Write-Output "******************************" } if([System.IO.File]::Exists("license.xml")) { $doc = [XML] (Get-Content -Path "license.xml") Write-Output "License found" } if ($doc -eq $null) { $licenseFileName = @(gci license_*.xml)[0] if([System.IO.File]::Exists($licenseFileName)) { $doc = [XML] (Get-Content -Path $licenseFileName) Write-Output "License found" } } if ($doc -eq $null) { if($scriptoutput -eq 'verbose') { Write-Output "Process stopped: Missing license" Write-Error "Process stopped: Missing license" -ErrorAction Stop } exit } $actions = $doc.SelectNodes("//license/update_sequence/action") foreach ($action in $actions) { $action_type = $action.attributes['type'].value ######### # action: elevate if ($action_type -eq "elevate") { # ****************************** # Ensure elevated execution # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Ensure elevated execution" Write-Output "******************************" } If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { $installpath = Split-Path $MyInvocation.MyCommand.Path $param = "-File",('"{0}"' -f $MyInvocation.MyCommand.Path),"-scriptmode","$scriptmode","-scriptoutput","$scriptoutput","-scriptpath","`"$installpath`"" Start-Process "powershell.exe" -ArgumentList $param -Verb RunAs -Wait exit $LASTEXITCODE } } ######### # action: process_kill # same in DeployViaPortal and UpdateViaPortal if ($action_type -eq "process_kill") { # ****************************** # Kill process # ****************************** # # Parameter: process_name $process_name = $action.attributes['process_name'].value if($process_name -eq $null) { $process_name = $foldername } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Kill process $process_name" Write-Output "******************************" } While ((Get-Process -Name "$process_name" -ErrorAction SilentlyContinue) -ne $null) { $p = Get-Process -Name "$process_name" Stop-Process -Force -InputObject $p Start-Sleep -s 1 if($scriptoutput -eq 'verbose') { Write-Output "Killing $process_name" } } Write-Output "Killed $process_name" } ######### # action: service_stop # same in DeployViaPortal and UpdateViaPortal if ($action_type -eq "service_stop") { # ****************************** #Check service and stop service if running # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Check service and stop service if running" Write-Output "******************************" } $serviceName = $action.attributes['service_name'].value if($serviceName -eq $null) { $serviceName = $foldername } $serviceStartNeeded = $false If (Get-Service $serviceName -ErrorAction SilentlyContinue) { If ((Get-Service $serviceName).Status -eq 'Running') { Stop-Service $serviceName if($scriptoutput -eq 'verbose') { Write-Output "Stopping $serviceName" } $serviceStartNeeded = $true } Else { if($scriptoutput -eq 'verbose') { Write-Output "$serviceName found, but it is not running." } } } Else { if($scriptoutput -eq 'verbose') { Write-Output "$serviceName not found" } } if($serviceStartNeeded) { While ((Get-Service $serviceName).Status -eq 'Running') { Start-Sleep -s 1 if($scriptoutput -eq 'verbose') { Write-Output "Stopping $serviceName" } } Start-Sleep -s 5 } Write-Output "Stopped $serviceName" } ######### # action: service_start # same in DeployViaPortal and UpdateViaPortal if ($action_type -eq "service_start") { # ****************************** # Start service if it was running before update # ****************************** # # Parameter: force # if provided, the service will be started always $force = $action.attributes['force'].value if($force -ne $null) { $serviceStartNeeded = $true } # Parameter: service_name $serviceName = $action.attributes['service_name'].value if($serviceName -eq $null) { $serviceName = $foldername } # if the service should be started If ($serviceStartNeeded) { if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Start service $serviceName" Write-Output "******************************" } Start-Service $serviceName While ((Get-Service $serviceName).Status -ne 'Running') { Start-Sleep -s 1 if($scriptoutput -eq 'verbose') { Write-Output "Starting $serviceName" } } Write-Output "Started $serviceName" } } ######### # action: website_stop if ($action_type -eq "website_stop") { # ****************************** # Check website and stop service if running # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Stop website" Write-Output "******************************" } $websiteName = $action.attributes['website_name'].value if($websiteName -eq $null) { $websiteName = $foldername } $websiteStartNeeded = $false If (Get-WebAppPoolState -name "$websiteName" -ErrorAction SilentlyContinue) { $websiteStatus = Get-WebAppPoolState -name "$websiteName" If ($websiteStatus -eq 'Started') { Get-Website -Name "$websiteName" | Stop-Website if($scriptoutput -eq 'verbose') { Write-Output "Stopping $websiteName" } $websiteStartNeeded = $true } Else { if($scriptoutput -eq 'verbose') { Write-Output "$websiteName found, but it is not running." } } } Else { if($scriptoutput -eq 'verbose') { Write-Output "$websiteName not found" } } if($websiteStartNeeded) { $websiteStatus = Get-WebAppPoolState -name "$websiteName" While ($websiteStatus -ne 'Stopped') { Start-Sleep -s 1 if($scriptoutput -eq 'verbose') { Write-Output "Stopping $websiteName" } } Start-Sleep -s 5 } } ######### # action: website_start if ($action_type -eq "website_start") { # ****************************** # Start website if it was running before update # ****************************** # If ($websiteStartNeeded) { if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Start website since it was running before update" Write-Output "******************************" } Get-Website -Name "$websiteName" | Start-Website $websiteStatus = Get-WebAppPoolState -name "$websiteName" While ($websiteStatus -ne 'Started') { Start-Sleep -s 1 if($scriptoutput -eq 'verbose') { Write-Output "Starting $websiteName" } } Start-Sleep -s 5 } } ######### # action: website_call if ($action_type -eq "website_call") { # ****************************** # Call website # ****************************** # If ($websiteStartNeeded) { if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Call website since it was running before update" Write-Output "******************************" } $websiteUrl = $action.attributes['website_url'].value if($websiteUrl -ne $null) { (New-Object System.Net.WebClient).DownloadString("$websiteUrl"); } } } ######### # action: download if ($action_type -eq "download") { # ****************************** # Loading and extracting current version of application # ****************************** # $url = $action.InnerText $file_name = $action.attributes['file_name'].value if($file_name -eq $null) { $file_name = "$foldername.zip" } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Loading current version of $foldername from $url" Write-Output "******************************" } $client = new-object System.Net.WebClient $client.DownloadFile($url,".\$file_name") } ######### # action: unzip if ($action_type -eq "unzip") { # ****************************** # Extracting current version of application # ****************************** # $file_name = $action.attributes['file_name'].value if($file_name -eq $null) { $file_name = "$foldername.zip" } $destination = $action.attributes['destination'].value if($destination -eq $null) { $destination = "." } if($action.attributes['destination_base'].value -eq 'homepath') { $destination = Join-Path ${env:homedrive} (Join-Path ${env:homepath} $destination) } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Extracting current version of $foldername" Write-Output "******************************" } Expand-Archive -force -Path "$file_name" -DestinationPath "$destination" } ######### # action: remove if ($action_type -eq "remove") { # ****************************** # Remove deployment package # ****************************** # $file_name = $action.attributes['file_name'].value if($file_name -eq $null) { $file_name = "$foldername.zip" } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Remove deployment package of $foldername" Write-Output "******************************" } if([System.IO.File]::Exists("$file_name")) { Remove-Item "$file_name" } } ######### # action: copy if ($action_type -eq "copy") { # ****************************** # Copy file to destination # ****************************** # $file_name = $action.attributes['file_name'].value $destination = $action.attributes['destination'].value if($action.attributes['destination_base'].value -eq 'homepath') { $destination = Join-Path ${env:homedrive} (Join-Path ${env:homepath} $destination) } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Copy file to destination" Write-Output "******************************" } if([System.IO.Directory]::Exists("$destination")) { Copy-Item "$file_name" -Destination "$destination" -Force -Recurse } } ######### # action: shortcut_create if ($action_type -eq "shortcut_create") { # ****************************** # Create shortcut # ****************************** # $file_name = $action.attributes['file_name'].value $destination = $action.attributes['destination'].value if($action.attributes['destination_base'].value -eq 'homepath') { $destination = Join-Path ${env:homedrive} (Join-Path ${env:homepath} $destination) } if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Create shortcut" Write-Output "******************************" } $installpath = Split-Path $MyInvocation.MyCommand.Path $RunScript= "$file_name" $ShCutLnk = "$RunScript.lnk" #create shortcut $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$destination\$ShCutLnk") $Shortcut.TargetPath = "$installpath\$file_name" #$Shortcut.IconLocation = "C:\Windows\System32\windowspowershell\v1.0\powershell.exe,0" # icon index 0 #$Shortcut.Arguments = "-Nop -Executionpolicy bypass -NoExit ""$installPath\$RunScript""" $Shortcut.WorkingDirectory = "$installpath" $Shortcut.Save() ## Make the Shortcut runas Administrator ## Source: https://stackoverflow.com/questions/28997799/how-to-create-a-run-as-administrator-shortcut-using-powershell #$bytes = [System.IO.File]::ReadAllBytes("$installpath\$ShCutLnk") #$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON #[System.IO.File]::WriteAllBytes("$installpath\$ShCutLnk", $bytes) } ######### # action: run if ($action_type -eq "run") { # ****************************** # Run file # ****************************** # $file_name = $action.attributes['file_name'].value if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Run file" Write-Output "******************************" } cmd /c "$file_name" } ######### # action: confirm_version if ($action_type -eq "confirm_version") { # ****************************** # waiting for ENTER to confirm version # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Waiting for ENTER to confirm version" Write-Output "******************************" } Write-Output ("Should this version be installed? -> " + (get-Content "deployment_version.txt")) Write-Output "Close console window if not or ..." if($scriptmode -eq 'ui') { Read-Host -Prompt "Press ENTER to continue" } } ######### # action: wait_enter if ($action_type -eq "wait_enter") { # ****************************** # Update finished, waiting for ENTER to close console # ****************************** # if($scriptoutput -eq 'verbose') { Write-Output "" Write-Output "******************************" Write-Output "Update finished, waiting for key to close console" Write-Output "******************************" } if($scriptmode -eq 'ui') { Read-Host -Prompt "Press ENTER to continue" } } }