def getConnector(cls, countryName='', cityName='', serverAddress='', custom=False): Logger.log( "Operating System Configured:%s custom:%s Country:%s city:%s server:%s" % (config.getOS(), custom, countryName, cityName, serverAddress)) if config.isAndroid(): Logger.log("Creating AndroidVPNConnector ...") return AndroidVPNConnector(countryName, cityName, serverAddress, custom) elif config.isLinux(): Logger.log("Creating LinuxVPNConnector ...") return LinuxVPNConnector(countryName, cityName, serverAddress, custom) elif config.isWindows(): Logger.log("Creating windowsVPNConnector ...") return WindowsVPNConnector(countryName, cityName, serverAddress, custom) elif config.isOpenElec(): Logger.log("Creating OpenElecVPNConnector ...") return OpenElecVPNConnector(countryName, cityName, serverAddress, custom) elif config.isRaspBMC(): Logger.log("Creating RaspBMCVPNConnector ...") return RaspBMCVPNConnector(countryName, cityName, serverAddress, custom) raise Exception("Platform %s not supported" % config.getOS())
def get_input(): os = config.getOS() if os == "Windows": while True: if msvcrt.kbhit(): return str(msvcrt.getch())[-2] if os == "Unix": os.system("""bash -c 'read -s -n 1'""")
def getConnector(cls, countryName = '', cityName = '', serverAddress = ''): Logger.log("Operating System Configured:%s Country:%s city:%s server:%s" % (config.getOS(),countryName, cityName, serverAddress) ) if config.isAndroid(): Logger.log("Creating AndroidVPNConnector ...") return AndroidVPNConnector(countryName, cityName, serverAddress) elif config.isLinux(): Logger.log("Creating LinuxVPNConnector ...") return LinuxVPNConnector(countryName, cityName, serverAddress) elif config.isWindows(): Logger.log("Creating windowsVPNConnector ...") return WindowsVPNConnector(countryName, cityName, serverAddress) elif config.isOpenElec(): Logger.log("Creating OpenElecVPNConnector ...") return OpenElecVPNConnector(countryName, cityName, serverAddress) elif config.isRaspBMC(): Logger.log("Creating RaspBMCVPNConnector ...") return RaspBMCVPNConnector(countryName, cityName, serverAddress) raise Exception("Platform %s not supported" % config.getOS())
def _prepareCmd(self): executableFile = self._getOpenVPNExecPath() Logger.log("OpenVPN Client should be on:%s" % executableFile) if not executableFile: Logger.log( 'Could not find a VPN application for %s' % config.getOS(), Logger.LOG_ERROR) gui.DialogOK(config.TITLE + ' - ' + config.VERSION, __language__(30031) % config.getOS(), __language__(30032)) raise OpenVPNExeNotFoundException() configFilePath = self._getOpenVPNConfigPath() cmdline = '"' + executableFile + '"' cmdline += ' ' cmdline += '"' + configFilePath + '"' cmdline = cmdline.replace('\\', '/') Logger.log("Cmd line before sudo:%s" % cmdline, Logger.LOG_DEBUG) cmdline = self._addSudoIfNeeded(cmdline) return cmdline
def _prepareCmdList(self): Logger.log("_prepareCmdList Preparing cmdList ...", Logger.LOG_DEBUG) executableFile = self._getOpenVPNExecPath() Logger.log("OpenVPN Client should be on:%s" % executableFile) if not executableFile: Logger.log( 'Could not find a VPN application for %s' % config.getOS(), Logger.LOG_ERROR) gui.DialogOK(config.TITLE + ' - ' + config.VERSION, __language__(30040) % config.getOS(), __language__(30041)) raise OpenVPNExeNotFoundException() executableFile = executableFile.replace('\\', '/') configFilePath = self._getOpenVPNConfigPath() configFilePath = configFilePath.replace('\\', '/') cmdList = [executableFile, configFilePath] Logger.log("Cmd list before sudo:%r" % cmdList, Logger.LOG_DEBUG) cmdList = self._addSudoIfNeeded(cmdList) Logger.log("Cmd list before sudo:%r" % cmdList, Logger.LOG_DEBUG) return cmdList
def _allowAction(self, action, extra=''): Logger.log("allowAction %s" % action, Logger.LOG_DEBUG) user = self._getUsername() pwd = config.getPassword() data = { "username": user, "apiKey": pwd, "action": action, "country": self._countryName, "city": self._cityName, "server": self._serverAddress, "extra": extra, "os": config.getOS() } self._actionNotification.push(data)
def _prepareCmd(self): executableFile = self._getOpenVPNExecPath() Logger.log("OpenVPN Client should be on:%s" % executableFile) if not executableFile: Logger.log('Could not find a VPN application for %s' % config.getOS(), Logger.LOG_ERROR) gui.DialogOK(config.TITLE + ' - ' + config.VERSION, __language__(30031) % config.getOS(), __language__(30032)) raise OpenVPNExeNotFoundException() configFilePath = self._getOpenVPNConfigPath() cmdline = '"' + executableFile + '"' cmdline += ' ' cmdline += '"' + configFilePath + '"' cmdline = cmdline.replace('\\', '/') Logger.log("Cmd line before sudo:%s" % cmdline, Logger.LOG_DEBUG) cmdline = self._addSudoIfNeeded(cmdline) return cmdline
def _prepareCmdList(self): Logger.log("_prepareCmdList Preparing cmdList ...", Logger.LOG_DEBUG) executableFile = self._getOpenVPNExecPath() Logger.log("OpenVPN Client should be on:%s" % executableFile) if not executableFile: Logger.log('Could not find a VPN application for %s' % config.getOS(), Logger.LOG_ERROR) gui.DialogOK(config.TITLE + ' - ' + config.VERSION, __language__(30040) % config.getOS(), __language__(30041)) raise OpenVPNExeNotFoundException() executableFile = executableFile.replace('\\', '/') configFilePath = self._getOpenVPNConfigPath() configFilePath = configFilePath.replace('\\', '/') cmdList = [executableFile, configFilePath] Logger.log("Cmd list before sudo:%r" % cmdList, Logger.LOG_DEBUG) cmdList = self._addSudoIfNeeded(cmdList) Logger.log("Cmd list before sudo:%r" % cmdList, Logger.LOG_DEBUG) return cmdList
def _allowAction(self, action, extra = ''): Logger.log("allowAction %s" % action, Logger.LOG_DEBUG) user = self._getUsername() pwd = config.getPassword() data = {"username" : user, "apiKey" : pwd, "action" : action, "country" : self._countryName, "city" : self._cityName, "server" : self._serverAddress, "extra" : extra, "os" : config.getOS()} self._actionNotification.push(data)
if __name__ == "__main__": import config else: try: from Scrybe import config except ImportError: import config os = config.getOS() if os == "Windows": import msvcrt def get_input(): os = config.getOS() if os == "Windows": while True: if msvcrt.kbhit(): return str(msvcrt.getch())[-2] if os == "Unix": os.system("""bash -c 'read -s -n 1'""") if __name__ == "__main__": key = get_input() print(key) a = input("...")