diff --git a/hack/boot.sh b/hack/boot.sh old mode 100644 new mode 100755 diff --git a/hack/boxee/skin/boxee/720p/boxee_browse_menu.xml b/hack/boxee/skin/boxee/720p/boxee_browse_menu.xml index a6ff8d4..334373c 100644 --- a/hack/boxee/skin/boxee/720p/boxee_browse_menu.xml +++ b/hack/boxee/skin/boxee/720p/boxee_browse_menu.xml @@ -475,9 +475,9 @@ - 534 + 518 396 - 212 + 265 56 12 200 @@ -533,10 +533,15 @@ ActivateWindow(10493) + StringCompare(Skin.String(showvpn),1) + ../720p/resources/icons/icon_browse_menu_vpn.png + XBMC.RunScript("special://skin/720p/scripts/boxeehack_vpn.py", "vpn") + + mainmenu/graphic-icon-settings.png ActivateWindow(Settings) - + mainmenu/graphic-icon-exit.png ActivateWindow(111) diff --git a/hack/boxee/skin/boxee/720p/custom_BoxeeHack.xml b/hack/boxee/skin/boxee/720p/custom_BoxeeHack.xml index f3e2161..02d02dd 100644 --- a/hack/boxee/skin/boxee/720p/custom_BoxeeHack.xml +++ b/hack/boxee/skin/boxee/720p/custom_BoxeeHack.xml @@ -105,12 +105,19 @@ StringCompare(Skin.String(jump-to-unwatched),1) XBMC.RunScript("special://skin/720p/scripts/boxeehack_settings.py", "toggle-jump-to-last-unwatched") - + + SettingsRadioButton + + StringCompare(Skin.String(showvpn),1) + XBMC.RunScript("special://skin/720p/scripts/boxeehack_settings.py", "showvpn") + + SettingsButton $INFO[Skin.String(boxeeplus-version)] XBMC.RunScript("special://skin/720p/scripts/boxeehack_settings.py", "version") + diff --git a/hack/boxee/skin/boxee/720p/resources/icons/icon_browse_menu_vpn.png b/hack/boxee/skin/boxee/720p/resources/icons/icon_browse_menu_vpn.png new file mode 100644 index 0000000..48cd852 Binary files /dev/null and b/hack/boxee/skin/boxee/720p/resources/icons/icon_browse_menu_vpn.png differ diff --git a/hack/boxee/skin/boxee/720p/scripts/boxeehack_settings.py b/hack/boxee/skin/boxee/720p/scripts/boxeehack_settings.py index 4fab386..62ae007 100644 --- a/hack/boxee/skin/boxee/720p/scripts/boxeehack_settings.py +++ b/hack/boxee/skin/boxee/720p/scripts/boxeehack_settings.py @@ -258,6 +258,18 @@ def get_featured_feed_value(): replace = "0" return replace +# Hide / Show VPN Shortcut icon +def showvpn_function(): + showvpn = common.file_get_contents("/data/etc/.showvpn_enabled") + + if showvpn == "1": + showvpn = "0" + else: + showvpn = "1" + + xbmc.executebuiltin("Skin.SetString(showvpn,%s)" % showvpn) + common.file_put_contents("/data/etc/.showvpn_enabled", showvpn) + # Enable/disable the subtitle functionality def toggle_subtitles(mode, current): if mode == "all": @@ -404,5 +416,5 @@ def shutdown(): if command == "browser-homepage": set_browser_homepage() if command == "toggle-jump-to-last-unwatched": toggle_jump_to_last_unwatched() - + if command == "showvpn": showvpn_function() if command == "shutdown": shutdown() diff --git a/hack/boxee/skin/boxee/720p/scripts/boxeehack_vpn.py b/hack/boxee/skin/boxee/720p/scripts/boxeehack_vpn.py new file mode 100644 index 0000000..a8aa6ae --- /dev/null +++ b/hack/boxee/skin/boxee/720p/scripts/boxeehack_vpn.py @@ -0,0 +1,21 @@ +import os +import xbmc, xbmcgui + +def vpn_function(): + os.system("sh /data/hack/vpn/vpn_chk.sh") + xbmc.sleep(100) +if os.path.exists("/data/hack/vpn/vpn.enabled"): + dialog = xbmcgui.Dialog() + if dialog.yesno("VPN Connection", "Connect/Disconnect VPN?"): + xbmc.executebuiltin("Notification(,Initiating...,2000)") + os.system("sh /data/hack/vpn/vpn_con.sh") + +else: + dialog = xbmcgui.Dialog() + ok = dialog.ok('VPN Connection', 'VPN has not been configured.') + +if (__name__ == "__main__"): + section = sys.argv[1] + +if section == "vpn": vpn_function() + diff --git a/hack/splash.sh b/hack/splash.sh old mode 100644 new mode 100755 diff --git a/hack/vpn/vpn_chk.sh b/hack/vpn/vpn_chk.sh new file mode 100755 index 0000000..6258d19 --- /dev/null +++ b/hack/vpn/vpn_chk.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Author: n3! +# + +host=`sed -n '/vpn*/,/<\/vpn>/p' /data/.boxee/UserData/guisettings.xml > /tmp/vpn_chk.tmp | grep server /tmp/vpn_chk.tmp | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'` + +if [ "$host" = "" ]; then + rm /data/hack/vpn/vpn.enabled +else + touch /data/hack/vpn/vpn.enabled +fi + +rm /tmp/vpn_chk.tmp diff --git a/hack/vpn/vpn_con.sh b/hack/vpn/vpn_con.sh new file mode 100755 index 0000000..c07c937 --- /dev/null +++ b/hack/vpn/vpn_con.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Author: n3! +# + +# Extracts VPN details from the guisettings.xml file and stores them into the following variables below. + +host=`sed -n '/vpn*/,/<\/vpn>/p' /data/.boxee/UserData/guisettings.xml > /tmp/vpn_con.tmp | grep server /tmp/vpn_con.tmp | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'` +username=`sed -n '/vpn*/,/<\/vpn>/p' /data/.boxee/UserData/guisettings.xml > /tmp/vpn_con.tmp | grep account /tmp/vpn_con.tmp | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'` +password=`sed -n '/vpn*/,/<\/vpn>/p' /data/.boxee/UserData/guisettings.xml > /tmp/vpn_con.tmp | grep password /tmp/vpn_con.tmp | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'` + +# Checks to see if there is a current VPN connection and if it finds one it disconnects you. + +status=`ifconfig |grep ppp | busybox awk '{ print $1 }'` + +if [ "$status" = "" ]; then + pppd pty "pptp $host --nolaunchpppd" file /etc/ppp/options.pptp user $username password $password + sleep 3 + ppp=`ifconfig |grep -A 6 ppp[01] |grep addr: | cut -f 2 -d ":" | cut -f 1 -d " "` + if [ "$ppp" = "" ]; then + echo "Failed!" + else + ip route | grep default | grep "eth[01]" | cut -f 3 -d " " > /data/hack/vpn/.gw + route del default + route add default gw $ppp + ifconfig ppp0 mtu 1400 + touch /tmp/vpn.up + fi + +else + dgw=`cat /data/hack/vpn/.gw` + killall pptp > /dev/null 2>&1 + route add default gw $dgw + rm /tmp/vpn.up + +fi +rm /tmp/vpn_con.tmp