############################## GLOBALS ############################## $global:debug = 0 $global:display = 'Normal' $global:title = 'Ganian App' $global:args = $args ############################## VARIABLES ############################## $domain = 'ganian' $vpn_ip = '26.235.25.211' ############################## MAIN CODE ############################## function main { run_as_admin show_title $global:title -set_title "`n`n`t Αρχείο διευθύνσεων Windows:" $hosts = @{ path = "$env:WINDIR\System32\drivers\etc\hosts" content = $NULL old_content = $NULL differences = $NULL } $hosts.content = $hosts.old_content = Get-Content $hosts.path $domains_with_ip = $hosts.content -Match $domain -Match $vpn_ip if ($domains_with_ip.count -eq 0) { list_item 'Προσθήκη νέας διεύθυνσης...' $hosts.content += "`n$vpn_ip $domain" check_mark } $domains_without_ip = $hosts.content -Match $domain -NotMatch $vpn_ip if ($domains_without_ip.count -gt 0) { list_item 'Αφαίρεση παλαιών διευθύνσεων...' $hosts.content = $hosts.content -Replace ($domains_without_ip -join '|'), '' check_mark } $hosts.differences = Compare-Object $hosts.content $hosts.old_content if ($NULL -ne $hosts.differences) { list_item 'Αποθήκευση...' $hosts.content -join "`n" -replace '\n{3,}', "`n`n" | Out-File -Encoding ASCII $hosts.path check_mark } "`n`n`n`t Εικονικό ιδιωτικό δίκτυο Radmin:" $radmin = @{ path = "${env:ProgramFiles(x86)}\Radmin VPN\RvRvpnGui.exe" url = 'https://www.radmin-vpn.com/' download = "$env:TMP/radmin_vpn.exe" } if (-Not (Test-Path $radmin.path)) { list_item 'Λήψη...' $radmin_page = Invoke-RestMethod $radmin.url $download_url = ($radmin_page | Select-String "