def installMacOS(): import download import extract import stat url = utils.getResourceUrl() + 'openvpn-macos-2.3.4.zip' bindir = xbmc.translatePath( 'special://profile/addon_data/plugin.program.vpnicity/macos/sbin/') dest = os.path.join(bindir, 'openvpn-macos.zip') macbin = os.path.join(bindir, 'openvpn') try: os.makedirs(bindir) except: pass download.download(url, dest) extract.all(dest, bindir) st = os.stat(macbin) os.chmod(macbin, st.st_mode | stat.S_IEXEC) try: os.remove(dest) except: pass success = path.getPath(utils.ADDON.getSetting('OS'), silent=True) if success: utils.dialogOK('MacOS VPN application successfully installed') else: utils.dialogOK('MacOS VPN application installation failed', 'Please try again later')
def Login(): utils.log('================ VPNicity Login ================') with requests.Session() as s: try: s.get(LOGINURL) except: return False USER = ADDON.getSetting('USER') PASS = ADDON.getSetting('PASS') PAYLOAD = { 'log' : USER, 'pwd' : PASS, 'wp-submit' : 'Log In' } response = 'login_error' code = 0 if USER and PASS: login = s.post(LOGINURL, data=PAYLOAD) response = login.content # code = login.status_code # saveCookies(s.cookies, cookiefile) if 'no-access-redirect' in response: error = '301 - No Access.' message = 'It appears that your subscription has expired.' utils.log(message + ' : ' + error) utils.dialogOK(message, error, 'Please check your account at www.vpnicity.com') KillVPN(silent=True) return False areLost = 'Are you lost' in response loginError = 'login_error' in response okay = (not areLost) and (not loginError) if okay: message = 'Logged into VPNicity' utils.log(message) utils.notify(message) return True try: error = re.compile('<div id="login_error">(.+?)<br />').search(response).groups(1)[0] error = error.replace('<strong>', '') error = error.replace('</strong>', '') error = error.replace('<a href="https://www.vpnicity.com/wp-login.php?action=lostpassword">Lost your password?</a>', '') error = error.strip() print error except: error = '' message = 'There was a problem logging into VPNicity' utils.log('************ VPNicity Error ************') utils.log(message + ' : ' + error) utils.log('****************************************') utils.dialogOK(message, error, 'Please check your account at www.vpnicity.com') KillVPN(silent=True) return False
def SetupAccount(): utils.checkOS() os = utils.GetSetting('OS') if os == 'MacOS': utils.dialogOK('It appears you are running on Mac OS.', '', 'You may need administrator access to run VPNicity.') sudo = utils.dialogKB('', "Enter the 'User Account' password for your computer.") ADDON.setSetting('SUDO', 'true') ADDON.setSetting('SUDOPASS', sudo) utils.dialogOK('We will now finish your installation.', 'Please double check your settings after we are done.', 'Thank you!') xbmc.executebuiltin('XBMC.RunScript(special://home/addons/plugin.program.vpnicity/install.py)') if 'OpenELEC' in os: utils.dialogOK('It appears you are running on OpenELEC.', 'We will now finish your installation.', 'Please double check your settings after we are done.') xbmc.executebuiltin('XBMC.RunScript(/storage/.kodi/addons/plugin.program.vpnicity/install.py)') if 'Ember 3.x.x' in os: utils.dialogOK('It appears you are running on Ember.', 'We will now finish your installation.', 'Please double check your settings after we are done.') xbmc.executebuiltin('XBMC.RunScript(/storage/.kodi/addons/plugin.program.vpnicity/install.py)') else: return
def install(silent=False): if utils.ADDON.getSetting('OS') == 'Windows': return if utils.ADDON.getSetting('OS') == 'MacOS': installMacOS() return if 'OpenELEC' in utils.ADDON.getSetting('OS'): installOpenELEC() return cmdLine = utils.getSudo() cmdLine += 'apt-get update;' cmdLine += 'sudo apt-get -y install openvpn;' cmdLine += 'sudo apt-get -y install psmisc' dp = None if not silent: dp = utils.progress('Installing VPN application', 'Please be patient this may take a few minutes') p = subprocess.Popen(cmdLine, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = p.communicate() if silent: return import xbmc xbmc.sleep(100) dp.close() success = path.getPath(utils.ADDON.getSetting('OS'), silent=True) if success: utils.dialogOK('VPN application successfully installed') else: utils.dialogOK('VPN application installation failed', 'Please try again later')
def SetupAccount(): utils.checkOS() os = utils.GetSetting('OS') if os == 'MacOS': utils.dialogOK('It appears you are running on Mac OS.', '', 'You may need administrator access to run VPNicity.') sudo = utils.dialogKB( '', "Enter the 'User Account' password for your computer.") ADDON.setSetting('SUDO', 'true') ADDON.setSetting('SUDOPASS', sudo) utils.dialogOK('We will now finish your installation.', 'Please double check your settings after we are done.', 'Thank you!') xbmc.executebuiltin( 'XBMC.RunScript(special://home/addons/plugin.program.vpnicity/install.py)' ) if 'OpenELEC' in os: utils.dialogOK('It appears you are running on OpenELEC.', 'We will now finish your installation.', 'Please double check your settings after we are done.') xbmc.executebuiltin( 'XBMC.RunScript(/storage/.kodi/addons/plugin.program.vpnicity/install.py)' ) else: return
def installOpenELEC(): import download import extract import stat url = utils.getOEUrl() if not url: utils.dialogOK('You do not appear to be running OpenELEC', 'Please check your settings') return bindir = xbmc.translatePath( 'special://profile/addon_data/plugin.program.vpnicity/bin/') dest = os.path.join(bindir, 'openvpn-oe.zip') oebin = os.path.join(bindir, 'openvpn') try: os.makedirs(bindir) except: pass download.download(url, dest) extract.all(dest, bindir) st = os.stat(oebin) os.chmod(oebin, st.st_mode | stat.S_IEXEC) try: os.remove(dest) except: pass success = path.getPath(utils.ADDON.getSetting('OS'), silent=True) if success: utils.dialogOK('VPN application successfully installed') else: utils.dialogOK('VPN application installation failed', 'Please try again later')
# any later version. # # This Program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html # import vpn import browser import vpn_utils as utils import xbmc import xbmcgui utils.dialogOK('Please choose a country to connect to.', '', 'Netflix will start after we are connected.') country = browser.getCountry(utils.ADDONID, vpn.GetCountries()) print '************ in netcon.py country chosen, trying VPN ************' vpn.BestVPN(country) if xbmcgui.Window(10000).getProperty('VPNICITY_CONNECTED') == 'True': utils.dialogOK('VPN connected.', '', 'We will now log you into your Netflix account.') xbmc.executebuiltin('StartAndroidActivity("com.netflix.mediaclient"),return')
utils.SetSetting('SFPLUGIN', 'true') utils.SetSetting('CONTEXT', 'false') return passed except Exception, e: utils.log('Installing VPNicity Connect Plugin...EXCEPTION %s' % str(e)) return False def install_file(filename): vpn = utils.HOME src = os.path.join(vpn, 'resources', filename) if not os.path.exists(path): sfile.makedirs(path) sfile.copy(src, file) if __name__ == '__main__': xbmc.executebuiltin('Dialog.Show(busydialog)') if vpnConnect(): xbmc.executebuiltin('Dialog.Close(busydialog)') utils.dialogOK('VPNicity Connect plug-in installed ', 'into the Super Favourites Gobal Menu', 'Thank you.') else: xbmc.executebuiltin('Dialog.Close(busydialog)') utils.dialogOK('VPNicity Connect plug-in failed to install.', 'Ensure you have Super Favourites installed.', 'Thank you.')
def Login(): utils.log('================ VPNicity Login ================') with requests.Session() as s: try: s.get(LOGINURL) except: return False USER = ADDON.getSetting('USER') PASS = ADDON.getSetting('PASS') PAYLOAD = {'log': USER, 'pwd': PASS, 'wp-submit': 'Log In'} response = 'login_error' code = 0 if USER and PASS: login = s.post(LOGINURL, data=PAYLOAD) response = login.content # code = login.status_code # saveCookies(s.cookies, cookiefile) if 'no-access-redirect' in response: error = '301 - No Access.' message = 'It appears that your subscription has expired.' utils.log(message + ' : ' + error) utils.dialogOK(message, error, 'Please check your account at www.vpnicity.com') KillVPN(silent=True) return False areLost = 'Are you lost' in response loginError = 'login_error' in response okay = (not areLost) and (not loginError) if okay: message = 'Logged into VPNicity' utils.log(message) utils.notify(message) return True try: error = re.compile('<div id="login_error">(.+?)<br />').search( response).groups(1)[0] error = error.replace('<strong>', '') error = error.replace('</strong>', '') error = error.replace( '<a href="https://www.vpnicity.com/wp-login.php?action=lostpassword">Lost your password?</a>', '') error = error.strip() print error except: error = '' message = 'There was a problem logging into VPNicity' utils.log('************ VPNicity Error ************') utils.log(message + ' : ' + error) utils.log('****************************************') utils.dialogOK(message, error, 'Please check your account at www.vpnicity.com') KillVPN(silent=True) return False
# This Program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html # import vpn import browser import vpn_utils as utils import xbmc import xbmcgui utils.dialogOK('Please choose a country to connect to.', '', 'Netflix will start after we are connected.') country = browser.getCountry(utils.ADDONID, vpn.GetCountries()) print '************ in netcon.py country chosen, trying VPN ************' vpn.BestVPN(country) if xbmcgui.Window(10000).getProperty('VPNICITY_CONNECTED') == 'True': utils.dialogOK('VPN connected.', '', 'We will now log you into your Netflix account.') xbmc.executebuiltin( 'StartAndroidActivity("com.netflix.mediaclient"),return')
# # This Program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XBMC; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html # import vpn import browser import vpn_utils as utils import xbmc import xbmcgui if not utils.yesno('Would you like to connect a different ', 'country before watching Netflix?', ''): xbmc.executebuiltin('StartAndroidActivity("com.netflix.mediaclient"),return') else: country = browser.getCountry(utils.ADDONID, vpn.GetCountries()) vpn.BestVPN(country) if xbmcgui.Window(10000).getProperty('VPNICITY_CONNECTED') == 'True': utils.dialogOK('VPN connected.', '', 'We will now log you into your Netflix account.') xbmc.executebuiltin('StartAndroidActivity("com.netflix.mediaclient"),return')