Oiler Works
  • Home
    • My resume
    • Free premium
    • Privacy Policy
  • Portfolio
  • Blogs
    • Computing
    • Science & MBA
    • Gaveta de remédios
    • Canadá
    • Presentes

SurfShark Reconnect Script

23/8/2021

0 Comments

 
This is a Powershell script that will randomly connect to one of the ikev2 Surfshark servers when called.
Because rasdial.exe is broken since Windows 10 21H1 and ignores user and password, you shall manually connect once saving your credentials, before the script works.
If you need it for JDownloader, set Reconnect Method to "External Batch Reconnect"
#Surfshark_reconnect.ps1
$vpnname="Surfshark Random";
[email protected](
"al-tia.prod.surfshark.com",
"ar-bua.prod.surfshark.com",
"au-bne.prod.surfshark.com",
"au-syd.prod.surfshark.com",
"au-mel.prod.surfshark.com",
"au-adl.prod.surfshark.com",
"at-vie.prod.surfshark.com",
"az-bak.prod.surfshark.com",
"be-bru.prod.surfshark.com",
"ba-sjj.prod.surfshark.com",
"br-sao.prod.surfshark.com",
"bg-sof.prod.surfshark.com",
"ca-van.prod.surfshark.com",
"ca-tor.prod.surfshark.com",
"ca-mon.prod.surfshark.com",
"cl-san.prod.surfshark.com",
"co-bog.prod.surfshark.com",
"cr-sjn.prod.surfshark.com",
"hr-zag.prod.surfshark.com",
"cy-nic.prod.surfshark.com",
"cz-prg.prod.surfshark.com",
"dk-cph.prod.surfshark.com",
"ee-tll.prod.surfshark.com",
"fi-hel.prod.surfshark.com",
"fr-mrs.prod.surfshark.com",
"fr-par.prod.surfshark.com",
"fr-bod.prod.surfshark.com",
"ge-tbs.prod.surfshark.com",
"de-ber.prod.surfshark.com",
"de-fra.prod.surfshark.com",
"gr-ath.prod.surfshark.com",
"hk-hkg.prod.surfshark.com",
"hu-bud.prod.surfshark.com",
"is-rkv.prod.surfshark.com",
"in-mum.prod.surfshark.com",
"in-chn.prod.surfshark.com",
"in-idr.prod.surfshark.com",
"id-jak.prod.surfshark.com",
"ie-dub.prod.surfshark.com",
"il-tlv.prod.surfshark.com",
"it-mil.prod.surfshark.com",
"it-rom.prod.surfshark.com",
"jp-tok.prod.surfshark.com",
"kz-ura.prod.surfshark.com",
"lv-rig.prod.surfshark.com",
"lu-ste.prod.surfshark.com",
"my-kul.prod.surfshark.com",
"mt-mla.prod.surfshark.com",
"mx-mex.prod.surfshark.com",
"md-chi.prod.surfshark.com",
"nl-ams.prod.surfshark.com",
"nz-akl.prod.surfshark.com",
"mk-skp.prod.surfshark.com",
"no-osl.prod.surfshark.com",
"pa-pac.prod.surfshark.com",
"pe-lim.prod.surfshark.com",
"ph-mnl.prod.surfshark.com",
"pl-waw.prod.surfshark.com",
"pl-gdn.prod.surfshark.com",
"pt-lis.prod.surfshark.com",
"pt-opo.prod.surfshark.com",
"ro-buc.prod.surfshark.com",
"ru-mos.prod.surfshark.com",
"rs-beg.prod.surfshark.com",
"sg-sng.prod.surfshark.com",
"sk-bts.prod.surfshark.com",
"si-lju.prod.surfshark.com",
"za-jnb.prod.surfshark.com",
"kr-seo.prod.surfshark.com",
"es-bcn.prod.surfshark.com",
"es-mad.prod.surfshark.com",
"es-vlc.prod.surfshark.com",
"se-sto.prod.surfshark.com",
"ch-zur.prod.surfshark.com",
"tw-tai.prod.surfshark.com",
"th-bkk.prod.surfshark.com",
"tr-ist.prod.surfshark.com",
"ua-iev.prod.surfshark.com",
"ae-dub.prod.surfshark.com",
"uk-man.prod.surfshark.com",
"uk-gla.prod.surfshark.com",
"uk-lon.prod.surfshark.com",
"us-sea.prod.surfshark.com",
"us-sfo.prod.surfshark.com",
"us-slc.prod.surfshark.com",
"us-bdn.prod.surfshark.com",
"us-lax.prod.surfshark.com",
"us-las.prod.surfshark.com",
"us-den.prod.surfshark.com",
"us-phx.prod.surfshark.com",
"us-chi.prod.surfshark.com",
"us-buf.prod.surfshark.com",
"us-dal.prod.surfshark.com",
"us-kan.prod.surfshark.com",
"us-ltm.prod.surfshark.com",
"us-atl.prod.surfshark.com",
"us-mnz.prod.surfshark.com",
"us-nyc.prod.surfshark.com",
"us-ash.prod.surfshark.com",
"us-dtw.prod.surfshark.com",
"us-bos.prod.surfshark.com",
"us-mia.prod.surfshark.com",
"us-tpa.prod.surfshark.com",
"us-clt.prod.surfshark.com",
"us-hou.prod.surfshark.com",
"us-orl.prod.surfshark.com",
"ve-car.prod.surfshark.com",
"vn-hcm.prod.surfshark.com"
)
if (-not (Get-VpnConnection | where {$_.Name -eq "$vpnname"} )) { 
        Add-VpnConnection -Name "$vpnname" -ServerAddress br-sao.prod.surfshark.com -TunnelType ikev2 -EncryptionLevel Required -AuthenticationMethod EAP -RememberCredential
        # -RememberCredential -SplitTunneling
}
if ((Get-VpnConnection | where {$_.Name -eq $vpnname}).ConnectionStatus -eq "Connected") {
        Invoke-Expression -Command "$env:WINDIR\System32\rasdial.exe ""$vpnname"" /DISCONNECT"
}
$random = Get-Random -Minimum 1 -Maximum $servers.length
Set-VpnConnection -Name "$vpnname" -ServerAddress $servers[$random-1]
Invoke-Expression -Command "$env:WINDIR\System32\rasdial.exe ""$vpnname"" "
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Arquivos

    November 2021
    August 2021
    August 2020
    August 2019
    November 2018
    October 2018
    August 2017
    March 2017
    April 2016
    March 2016
    November 2013
    March 2013
    February 2013
    November 2012
    October 2012

    Categorias

    All
    Linux
    Openwrt
    Windows 8

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
    • My resume
    • Free premium
    • Privacy Policy
  • Portfolio
  • Blogs
    • Computing
    • Science & MBA
    • Gaveta de remédios
    • Canadá
    • Presentes