예제 #1
0
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
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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
예제 #6
0
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
예제 #7
0
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
예제 #8
0
                # Surpress a reconnection to the same unless it's become disconnected
                if (not getVPNRequestedProfile() == getVPNProfile()) or (
                        getVPNRequestedProfile() == getVPNProfile()
                        and not isVPNConnected()):

                    # Stop any media playing before switching VPNs around
                    if player.isPlaying(): player.stop()

                    # Stop any existing VPN
                    debugTrace(
                        "Stopping VPN before any new connection attempt")
                    if getVPNState() == "started":
                        stopVPNConnection()
                        if getVPNRequestedProfile(
                        ) == "Disconnect" and display_location_info == "true":
                            _, ip, country, isp = getIPInfo(addon)
                            xbmcgui.Dialog().notification(
                                addon_name,
                                "Not connected to PureVPN. Service Provider is "
                                + isp + " in " + country + ". IP is " + ip +
                                ".",
                                getAddonPath(True,
                                             "/resources/disconnected.png"),
                                20000, False)
                        else:
                            xbmcgui.Dialog().notification(
                                addon_name, "Not connected",
                                getAddonPath(True,
                                             "/resources/disconnected.png"),
                                3000, False)
                        infoTrace("service.py", "Disconnect from VPN")
예제 #9
0
                forceCycleLock()
                debugTrace("Got forced cycle lock in connection part of service")
                
				# Stop the VPN and reset the connection timer
                # Surpress a reconnection to the same unless it's become disconnected
                if (not getVPNRequestedProfile() == getVPNProfile()) or (getVPNRequestedProfile() == getVPNProfile() and not isVPNConnected()):                    

                    # Stop any media playing before switching VPNs around   
                    if player.isPlaying(): player.stop()
                    
                    # Stop any existing VPN
                    debugTrace("Stopping VPN before any new connection attempt")
                    if getVPNState() == "started":
                        stopVPNConnection()
                        if getVPNRequestedProfile() == "Disconnect" and addon.getSetting("display_location_on_connect") == "true":
                            _, ip, country, isp = getIPInfo(addon)
                            xbmcgui.Dialog().notification(addon_name, "Disconnected from VPN. Service Provider is " + isp + " in " + country + ". IP is " + ip + ".", getAddonPath(True, "/resources/disconnected.png"), 20000, False)
                        else:
                            xbmcgui.Dialog().notification(addon_name, "Disconnected", getAddonPath(True, "/resources/disconnected.png"), 3000, False)
                        infoTrace("service.py", "Disconnect from VPN")
                    else:
                        # Just incase we're in a weird unknown state, this should clear things up
                        stopVPNConnection()
                        debugTrace("Unconnected state, " + getVPNState() + " so disconnected anyway")
                    
                    timer = 0
                
                    # Don't reconnect if this is a disconnect request, or there is nothing to connect to (primary not set)
                    if not getVPNRequestedProfile() == "Disconnect":
                        if not getVPNRequestedProfile() == "":
                            infoTrace("service.py", "Connecting to VPN profile " + getVPNRequestedProfile())