def changeConnection(): # Connect, or display status if we're already using selected VPN profile # If there is no profile, then skip this as the user has selected something non-selectable debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) addon = xbmcaddon.Addon(getID()) ignore = False user_text = "" vpn_provider = addon.getSetting("vpn_provider") if isAlternative(vpn_provider): # Convert the friendly name to a file name, or an error message _, ovpn_connection, user_text, ignore = getAlternativeLocation( vpn_provider, params, 0, True) else: # Just extract the ovpn name from the URL for regular providers ovpn_connection = params # Try and connect if we've got a connection name. If we're already connection, display the status if not ignore: if not user_text == "": xbmcgui.Dialog().ok(addon_name, user_text) elif isVPNConnected() and ovpn_connection == getVPNProfile( ) and not allowReconnection(vpn_provider) and not addon.getSetting( "allow_cycle_reconnect") == "true": displayStatus() else: connectVPN("0", ovpn_connection) return
def changeConnection(): # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile(): displayStatus() else: connectVPN("0", params) return
def changeConnection(): # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile() and not isAlternative( addon.getSetting("vpn_provider")) and not addon.getSetting( "allow_cycle_reconnect") == "true": displayStatus() else: connectVPN("0", params) return
def changeConnection(): xbmc.executebuiltin("ActivateWindow(busydialog)") # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile(): displayStatus() else: disconnectVPN2() connectVPN("1", params) xbmc.executebuiltin("Dialog.Close(busydialog)") return
def displayStatus(): # Create a busy dialog whilst the data is retrieved. It # could take a while to deduce that the network is bad... xbmc.executebuiltin('ActivateWindow(busydialognocancel)') try: _, ip, country, isp = getIPInfo(addon) if isVPNConnected(): debugTrace("VPN is connected, displaying the connection info") xbmc.executebuiltin('Dialog.Close(busydialognocancel)') if fakeConnection(): # Kodi18 bug, this should be a single multi line call, but \n doesn't work xbmcgui.Dialog().ok(addon_name, "[B]Faked connection to a VPN[/B]", "Using " + ip + ", located in " + country, "Service Provider is " + isp) else: server = getVPNServer() if not server == "": server = ", " + server + "\n" else: server = "\n" # Kodi18 bug, this should be a single multi line call, but \n doesn't work xbmcgui.Dialog().ok(addon_name, "[B]Connected to a VPN[/B]", "Using " + ip + ", located in " + country, "Service Provider is " + isp) else: debugTrace("VPN is not connected, displaying the connection info") xbmc.executebuiltin('Dialog.Close(busydialognocancel)') # Kodi18 bug, this should be a single multi line call, but \n doesn't work xbmcgui.Dialog().ok(addon_name, "[B]Disconnected from VPN[/B]", "Using " + ip + ", located in " + country, "Service Provider is " + isp) except Exception: xbmc.executebuiltin('Dialog.Close(busydialognocancel)') return
def displayStatus(): # Create a busy dialog whilst the data is retrieved. It # could take a while to deduce that the network is bad... xbmc.executebuiltin('ActivateWindow(busydialognocancel)') try: _, ip, country, isp = getIPInfo(addon) if isVPNConnected(): debugTrace("VPN is connected, displaying the connection info") xbmc.executebuiltin('Dialog.Close(busydialognocancel)') # Display the server if enhanced system info is switched on server = "" if addon.getSetting("vpn_server_info") == "true": server = getVPNURL() if not server == "": server = "\nServer is " + server + "\n" else: server = "\n" ovpn_name = getVPNProfileFriendly() if fakeConnection(): xbmcgui.Dialog().ok(addon_name, "[B]Faked connection to a VPN[/B]\nProfile is " + ovpn_name + server + "Using " + ip + ", located in " + country + "\nService Provider is " + isp) else: xbmcgui.Dialog().ok(addon_name, "[B]Connected to a VPN[/B]\nProfile is " + ovpn_name + server + "Using " + ip + ", located in " + country + "\nService Provider is " + isp) else: debugTrace("VPN is not connected, displaying the connection info") xbmc.executebuiltin('Dialog.Close(busydialognocancel)') xbmcgui.Dialog().ok(addon_name, "[B]Disconnected from VPN[/B]\nUsing " + ip + ", located in " + country +"+\nService Provider is " + isp) except Exception: xbmc.executebuiltin('Dialog.Close(busydialognocancel)') return
def listConnections(): # We should have a VPN set up by now, but don't list if we haven't. vpn_provider = addon.getSetting("vpn_provider") debugTrace("Listing the connections available for " + vpn_provider) if vpn_provider != "": # Get the list of connections and add them to the directory all_connections = getProfileList(vpn_provider) ovpn_connections = getFilteredProfileList( all_connections, addon.getSetting("vpn_protocol"), None) connections = getFriendlyProfileList(vpn_provider, ovpn_connections) inc = 0 for connection in ovpn_connections: url = base_url + "?change?" + ovpn_connections[inc] conn_text = "" conn_primary = "" if getVPNProfileFriendly() == connections[inc] and isVPNConnected( ): conn_text = "[COLOR ff00ff00]" + connections[ inc] + conn_primary + " (Connected)[/COLOR]" icon = getIconPath() + "connected.png" else: conn_text = connections[inc] + conn_primary icon = getIconPath() + "locked.png" li = xbmcgui.ListItem(conn_text, iconImage=icon) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) inc = inc + 1 xbmcplugin.endOfDirectory(addon_handle) return
def displayStatus(): _, ip, country, isp = getIPInfo(addon) if isVPNConnected(): debugTrace("VPN is connected, displaying the connection info") if fakeConnection(): xbmcgui.Dialog().ok( addon_name, "Faked connection to a VPN in " + country + "\nUsing profile " + getVPNProfileFriendly() + "\nExternal IP address is " + ip + "\nService Provider is " + isp) else: server = getVPNServer() if not server == "": server = ", " + server + "\n" else: server = "\n" xbmcgui.Dialog().ok( addon_name, "Connected to a VPN in " + country + "\nUsing profile " + getVPNProfileFriendly() + server + "External IP address is " + ip + "\nService Provider is " + isp) else: debugTrace("VPN is not connected, displaying the connection info") xbmcgui.Dialog().ok( addon_name, "Disconnected from VPN.\nNetwork location is " + country + ".\nIP address is " + ip + ".\nService Provider is " + isp) return
def listConnections(): # Start with the disconnect option url = base_url + "?disconnect" if getVPNProfileFriendly() == "": li = xbmcgui.ListItem("[COLOR ffff0000](Disconnected)[/COLOR]") li.setArt({"icon":getIconPath()+"disconnected.png"}) else: li = xbmcgui.ListItem("[COLOR ffff0000]Disconnect[/COLOR]") li.setArt({"icon":getIconPath()+"unlocked.png"}) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) # We should have a VPN set up by now, but don't list if we haven't. vpn_provider = addon.getSetting("vpn_provider") debugTrace("Listing the connections available for " + vpn_provider) if not vpn_provider == "": # Get the list of connections and add them to the directory if not isAlternative(vpn_provider): all_connections = getAddonList(vpn_provider, "*.ovpn") ovpn_connections = getFilteredProfileList(all_connections, addon.getSetting("vpn_protocol"), None) connections = getFriendlyProfileList(ovpn_connections, "", "") else: ovpn_connections = getAlternativeLocations(vpn_provider, False) connections = getAlternativeFriendlyLocations(vpn_provider, False) inc = 0 for connection in ovpn_connections: if not isAlternative(vpn_provider): # Regular connections have the ovpn filename added ot the URL url = base_url + "?change?" + ovpn_connections[inc] else: # Alternative connections use the friendly name which can then be resolved later url = base_url + "?change?" + connections[inc] conn_text = "" conn_primary = "" i=1 # Adjust 10 and 11 below if changing number of conn_max while (i < 11): if addon.getSetting(str(i) + "_vpn_validated_friendly") == connections[inc].strip(" ") : conn_primary = " (" + str(i) + ")" i = 10 i=i+1 if getVPNProfileFriendly() == connections[inc].strip(" ") and isVPNConnected(): conn_text = "[COLOR ff00ff00]" + connections[inc] + conn_primary + " (Connected)[/COLOR]" if fakeConnection(): icon = getIconPath()+"faked.png" else: icon = getIconPath()+"connected.png" else: if not conn_primary == "": conn_text = "[COLOR ff0099ff]" + connections[inc] + conn_primary + "[/COLOR]" else: conn_text = connections[inc] + conn_primary icon = getIconPath()+"locked.png" li = xbmcgui.ListItem(conn_text) li.setArt({"icon":icon}) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) inc = inc + 1 xbmcplugin.endOfDirectory(addon_handle) return
def disconnect(): # Disconnect or display status if already disconnected debugTrace("Disconnect selected from connections menu") if isVPNConnected(): disconnectVPN() setVPNState("off") else: displayStatus() return
def displayStatus(): _, ip, country, isp = getIPInfo(addon) if isVPNConnected(): debugTrace("VPN is connected, displaying the connection info") xbmcgui.Dialog().ok(addon_name, "Connected to a VPN in " + country + ".\nUsing profile " + getVPNProfileFriendly() + ".\nExternal IP address is " + ip + ".\nService Provider is " + isp) else: debugTrace("VPN is not connected, displaying the connection info") xbmcgui.Dialog().ok(addon_name, "Disconnected from VPN.\nNetwork location is " + country + ".\nIP address is " + ip + ".\nService Provider is " + isp) return
def listConnections(): # Start with the disconnect option url = base_url + "?disconnect" if getVPNProfileFriendly() == "": li = xbmcgui.ListItem("[COLOR ffff0000](Disconnected)[/COLOR]", iconImage=getIconPath() + "disconnected.png") else: li = xbmcgui.ListItem("[COLOR ffff0000]Disconnect[/COLOR]", iconImage=getIconPath() + "unlocked.png") xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) # We should have a VPN set up by now, but don't list if we haven't. vpn_provider = addon.getSetting("vpn_provider") debugTrace("Listing the connections available for " + vpn_provider) if vpn_provider != "": # Get the list of connections and add them to the directory all_connections = getAddonList(vpn_provider, "*.ovpn") ovpn_connections = getFilteredProfileList( all_connections, addon.getSetting("vpn_protocol"), None) connections = getFriendlyProfileList(ovpn_connections, "", "") inc = 0 for connection in ovpn_connections: url = base_url + "?change?" + ovpn_connections[inc] conn_text = "" conn_primary = "" i = 1 # Adjust 10 and 11 below if changing number of conn_max while (i < 11): if addon.getSetting( str(i) + "_vpn_validated_friendly") == connections[inc]: conn_primary = " (" + str(i) + ")" i = 10 i = i + 1 if getVPNProfileFriendly() == connections[inc] and isVPNConnected( ): conn_text = "[COLOR ff00ff00]" + connections[ inc] + conn_primary + " (Connected)[/COLOR]" if fakeConnection(): icon = getIconPath() + "faked.png" else: icon = getIconPath() + "connected.png" else: if not conn_primary == "": conn_text = "[COLOR ff0099ff]" + connections[ inc] + conn_primary + "[/COLOR]" else: conn_text = connections[inc] + conn_primary icon = getIconPath() + "locked.png" li = xbmcgui.ListItem(conn_text, iconImage=icon) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) inc = inc + 1 xbmcplugin.endOfDirectory(addon_handle) return
def disconnect(): # Disconnect or display status if already disconnected debugTrace("Disconnect selected from connections menu") if isVPNConnected(): disconnectVPN(True) setVPNState("off") else: displayStatus() return
def disconnect(): xbmc.executebuiltin("ActivateWindow(busydialog)") # Disconnect or display status if already disconnected debugTrace("Disconnect selected from connections menu") if isVPNConnected(): disconnectVPN() setVPNState("off") #else: # displayStatus() xbmc.executebuiltin("Dialog.Close(busydialog)") return
def displayStatus(): xbmc.executebuiltin("ActivateWindow(busydialog)") _, ip, country, isp = getIPInfo(addon) if isVPNConnected(): debugTrace("VPN is connected, displaying the connection info") xbmcgui.Dialog().ok( addon_name, "Connected to PureVPN in " + country + ".\nUsing profile " + getVPNProfileFriendly() + ".\nIP address is " + ip + ".") else: debugTrace("VPN is not connected, displaying the connection info") xbmcgui.Dialog().ok( addon_name, "Not connected to PureVPN.\nNetwork location is " + country + ".\nIP address is " + ip + ".") xbmc.executebuiltin("Dialog.Close(busydialog)") return
def listConnections(): # Start with the disconnect option url = base_url + "?disconnect" if getVPNProfileFriendly() == "": li = xbmcgui.ListItem("[COLOR ffff0000](Disconnected)[/COLOR]", iconImage=getIconPath()+"disconnected.png") else: li = xbmcgui.ListItem("[COLOR ffff0000]Disconnect[/COLOR]", iconImage=getIconPath()+"unlocked.png") xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) # We should have a VPN set up by now, but don't list if we haven't. vpn_provider = addon.getSetting("vpn_provider") debugTrace("Listing the connections available for " + vpn_provider) if vpn_provider != "": # Get the list of connections and add them to the directory all_connections = getAddonList(vpn_provider, "*.ovpn") ovpn_connections = getFilteredProfileList(all_connections, addon.getSetting("vpn_protocol"), None) connections = getFriendlyProfileList(ovpn_connections) inc = 0 for connection in ovpn_connections: url = base_url + "?change?" + ovpn_connections[inc] conn_text = "" conn_primary = "" i=1 # Adjust 10 and 11 below if changing number of conn_max while (i < 11): if addon.getSetting(str(i) + "_vpn_validated_friendly") == connections[inc] : conn_primary = " (" + str(i) + ")" i = 10 i=i+1 if getVPNProfileFriendly() == connections[inc] and isVPNConnected(): conn_text = "[COLOR ff00ff00]" + connections[inc] + conn_primary + " (Connected)[/COLOR]" icon = getIconPath()+"connected.png" else: if not conn_primary == "": conn_text = "[COLOR ff0099ff]" + connections[inc] + conn_primary + "[/COLOR]" else: conn_text = connections[inc] + conn_primary icon = getIconPath()+"locked.png" li = xbmcgui.ListItem(conn_text, iconImage=icon) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) inc = inc + 1 xbmcplugin.endOfDirectory(addon_handle) return
def listSystem(): lines = [] site, ip, country, isp = getIPInfo(addon) lines.append("[B][COLOR ff0099ff]Connection[/COLOR][/B]") if isVPNConnected(): lines.append("Connected using profile " + getVPNProfileFriendly()) lines.append("VPN provider is " + addon.getSetting("vpn_provider")) else: lines.append("Not connected to a VPN") lines.append("Connection location is " + country) lines.append("External IP address is " + ip) lines.append("Service Provider is " + isp) lines.append("Location sourced from " + site) lines.append("[B][COLOR ff0099ff]Network[/COLOR][/B]") lines.append("IP address is " + xbmc.getInfoLabel("Network.IPAddress")) lines.append("Gateway is " + xbmc.getInfoLabel("Network.GatewayAddress")) lines.append("Subnet mask is " + xbmc.getInfoLabel("Network.SubnetMask")) lines.append("Primary DNS is " + xbmc.getInfoLabel("Network.DNS1Address")) lines.append("Secondary DNS is " + xbmc.getInfoLabel("Network.DNS2Address")) lines.append("[B][COLOR ff0099ff]PureVPN monitor[/COLOR][/B]") lines.append("PureVPN monitor verison is " + addon.getAddonInfo("version")) lines.append("PureVPN monitor behaviour is " + getPlatformString()) if isVPNMonitorRunning(): lines.append("PureVPN monitor add-on split tunneling is playing") else: lines.append("PureVPN monitor add-on split tunneling is stopped") lines.append("[B][COLOR ff0099ff]System[/COLOR][/B]") lines.append("Kodi build version is " + xbmc.getInfoLabel("System.BuildVersion")) lines.append("System name is " + xbmc.getInfoLabel("System.FriendlyName")) lines.append("System date is " + xbmc.getInfoLabel("System.Date")) lines.append("System time is " + xbmc.getInfoLabel("System.Time")) lines.append("Platform is " + sys.platform) lines.append("Free memory is " + xbmc.getInfoLabel("System.FreeMemory")) lines.append("Disk is " + xbmc.getInfoLabel("System.TotalSpace") + ", " + xbmc.getInfoLabel("System.UsedSpace")) for line in lines: url = base_url + "?back" li = xbmcgui.ListItem(line, iconImage=getIconPath() + "enhanced.png") xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle) return
def listSystem(): lines = [] site, ip, country, isp = getIPInfo(addon) lines.append("[B][COLOR ff0099ff]Connection[/COLOR][/B]") if isVPNConnected(): lines.append("Connected using profile " + getVPNProfileFriendly()) lines.append("VPN provider is " + addon.getSetting("vpn_provider")) else: lines.append("Not connected to a VPN") lines.append("Connection location is " + country) lines.append("External IP address is " + ip) lines.append("Service Provider is " + isp) lines.append("Location sourced from " + site) lines.append("[B][COLOR ff0099ff]Network[/COLOR][/B]") lines.append("IP address is " + xbmc.getInfoLabel("Network.IPAddress")) lines.append("Gateway is " + xbmc.getInfoLabel("Network.GatewayAddress")) lines.append("Subnet mask is " + xbmc.getInfoLabel("Network.SubnetMask")) lines.append("Primary DNS is " + xbmc.getInfoLabel("Network.DNS1Address")) lines.append("Secondary DNS is " + xbmc.getInfoLabel("Network.DNS2Address")) lines.append("[B][COLOR ff0099ff]VPN Manager[/COLOR][/B]") lines.append("VPN Manager verison is " + addon.getAddonInfo("version")) lines.append("VPN Manager behaviour is " + getPlatformString()) if isVPNMonitorRunning(): lines.append("VPN Manager add-on filtering is running") else: lines.append("VPN Manager add-on filtering is paused") lines.append("[B][COLOR ff0099ff]System[/COLOR][/B]") lines.append("Kodi build version is " + xbmc.getInfoLabel("System.BuildVersion")) lines.append("System name is " + xbmc.getInfoLabel("System.FriendlyName")) lines.append("System date is " + xbmc.getInfoLabel("System.Date")) lines.append("System time is " + xbmc.getInfoLabel("System.Time")) lines.append("Platform is " + sys.platform) lines.append("Free memory is " + xbmc.getInfoLabel("System.FreeMemory")) lines.append("Disk is " + xbmc.getInfoLabel("System.TotalSpace") + ", " + xbmc.getInfoLabel("System.UsedSpace")) for line in lines: url = base_url + "?back" li = xbmcgui.ListItem(line, iconImage=getIconPath()+"enhanced.png") xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle) return
debugTrace("-- Entered managefiles.py with parameter " + action + " --") if not getID() == "": addon = xbmcaddon.Addon(getID()) addon_name = getName() # Reset the ovpn files if action == "ovpn": if addon.getSetting("1_vpn_validated") == "" or xbmcgui.Dialog().yesno( addon_name, "Resetting the VPN provider will disconnect and reset all VPN connections, and then remove any files that have been created. Continue?" ): suspendConfigUpdate() # Disconnect so that live files are not being modified if isVPNConnected(): resetVPNConnections(addon) debugTrace("Deleting all generated files") # Delete the generated files, and reset the locations so it can be selected again removeGeneratedFiles() # Delete any values that have previously been validated vpn_provider = getVPNLocation(addon.getSetting("vpn_provider")) if isAlternative(vpn_provider): resetAlternative(vpn_provider) # Reset the IP service error counts, etc resetIPServices() addon = xbmcaddon.Addon(getID()) # Reset values that would have been stored as part of validation addon.setSetting("vpn_provider_validated", "") addon.setSetting("vpn_locations_list", "") addon.setSetting("vpn_username_validated", "") addon.setSetting("vpn_password_validated", "") # Re-enble the wizard
else: if xbmcvfs.exists(connection): setAPICommand(connection) else: errorTrace( "api.py", "Requested connection, " + connection + " does not exist") if not getID() == "": if lcommand == "disconnect": setAPICommand("Disconnect") elif lcommand == "cycle": setAPICommand("Cycle") elif lcommand.startswith("toggle"): if isVPNConnected(): setAPICommand("Disconnect") else: connection = command[7:].strip(' \t\n\r') apiConnect(connection) elif lcommand == "fake": setAPICommand("Fake") elif lcommand == "real": setAPICommand("Real") elif lcommand == "pause": setAPICommand("Pause") elif lcommand == "restart": setAPICommand("Restart") elif lcommand == "reconnect": setAPICommand("Reconnect") elif lcommand == "getip":
debugTrace( "Unknown VPN state so forcing reconnect") reconnect_vpn = True # This forces a connection validation after something stops playing if player.isPlaying(): playing = True if playing and not player.isPlaying(): playing = False timer = connection_retry_time + 1 # This just checks the connection is still good every hour, providing the player is not busy if vpn_setup and reconnect_on_drop == "true" and timer > connection_retry_time and not player.isPlaying( ): debugTrace("Reconnect timer triggered, checking connection") if not isVPNConnected() and not (getVPNState() == "off"): # Don't know why we're disconnected, but reconnect to the last known VPN errorTrace( "service.py", "VPN monitor service detected VPN connection " + getVPNProfile() + " is not running when it should be") writeVPNLog() if getVPNRequestedProfile() == "": setVPNRequestedProfile(getVPNProfile()) setVPNRequestedProfileFriendly(getVPNProfileFriendly()) setVPNProfile("") setVPNProfileFriendly("") reconnect_vpn = True timer = 0 # Fetch the path and name of the current addon
reconnect_vpn = True # This forces a connection validation after something stops playing if player.isPlaying(): playing = True if playing and not player.isPlaying(): playing = False timer = connection_retry_time + 1 # This just checks the connection is still good every hour, providing the player is not busy if vpn_setup and not player.isPlaying() and timer > connection_retry_time: addon = xbmcaddon.Addon() if addon.getSetting("vpn_reconnect") == "true": debugTrace("Reconnect timer triggered, checking connection") if not isVPNConnected() and not (getVPNState() == "off"): # Don't know why we're disconnected, but reconnect to the last known VPN errorTrace("service.py", "VPN monitor service detected VPN connection " + getVPNProfile() + " is not running when it should be") writeVPNLog() if getVPNRequestedProfile() == "": setVPNRequestedProfile(getVPNProfile()) setVPNRequestedProfileFriendly(getVPNProfileFriendly()) setVPNProfile("") setVPNProfileFriendly("") reconnect_vpn = True timer = 0 # Check to see if it's time for a reboot (providing we need to, and nothing is playing) if (not player.isPlaying()) and reboot_timer >= seconds_to_reboot_check: addon = xbmcaddon.Addon() reboot_timer = 0
except: errorTrace("Failed to copy log from " + log_path + " to " + dest_path) if xbmcvfs.exists(log_path): dialog_message = "Error copying log, try copying it to a different location." else: dialog_messsage = "Could not find the kodi.log file." errorTrace("managefiles.py", dialog_message + " " + log_path + ", " + dest_path) xbmcgui.Dialog().ok("Log Copy", dialog_message) # Delete the user key and cert files elif action == "user": if addon.getSetting("1_vpn_validated") == "" or xbmcgui.Dialog().yesno(addon_name, "Deleting key and certificate files will reset all VPN connections. Connections must be re-validated before use.\nContinue?"): # Reset the connection before we do anything else if isVPNConnected(): resetVPNConnections(addon) # Select the provider provider_list = [] for provider in providers: if usesUserKeys(provider): provider_list.append(getVPNDisplay(provider)) provider_list.sort() index = xbmcgui.Dialog().select("Select VPN provider", provider_list) provider_display = provider_list[index] provider = getVPNLocation(provider_display) # Get the key/cert pairs for that provider and offer up for deletion user_keys = getUserKeys(provider) user_certs = getUserCerts(provider) if len(user_keys) > 0 or len(user_certs) > 0: still_deleting = True