def create_xunlei_client(self, config):
     client = LiXianAPI()
     if client.login(config['username'], config['password']):
         self.xunlei_client_cache[self.gen_cache_key(config)] = client
     else:
         raise PluginError("Cannot login to lixian.xunlei.com. Please check you username and password")
     return client
Example #2
0
 def create_xunlei_client(self, config):
     client = LiXianAPI()
     if client.login(config['username'], config['password']):
         self.xunlei_client_cache[self.gen_cache_key(config)] = client
     else:
         raise PluginError("Cannot login to lixian.xunlei.com. Please check you username and password")
     return client
Example #3
0
    def __init__(self, username=None, password=None):
        ConfigParser.RawConfigParser.OPTCRE = re.compile(
            r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$')
        self.CONFIG = ConfigParser.ConfigParser()
        self.CONFIG.read(os.path.join(os.path.dirname(__file__), __config__))

        self.LISTEN_IP = self.CONFIG.get('listen', 'ip')
        self.LISTEN_PORT = self.CONFIG.getint('listen', 'port')

        self.XUNLEI_ENABLE = self.CONFIG.getboolean('xunlei', 'enable')
        if self.XUNLEI_ENABLE:
            if username != None:
                self.USERNAME = username
            else:
                self.USERNAME = self.CONFIG.get('xunlei', 'username')
            if password != None:
                self.PASSWORD = password
            else:
                self.PASSWORD = self.CONFIG.get('xunlei', 'password')

        self.urls = self.CONFIG.items('url')
        self.filters = self.CONFIG.items('filter')

        self.destdir = os.path.join(os.path.dirname(__file__), 'cache')

        self.minsize = self.CONFIG.getint('download', 'minsize')

        self.downloadlist = {}
        self.ignorelist = []

        self.xunlei = LiXianAPI()

        if self.XUNLEI_ENABLE:
            if self.USERNAME == '' or self.PASSWORD == '':
                self.USERNAME = raw_input('Username: '******'Password: ')
            try:
                if not self.xunlei.login(self.USERNAME, self.PASSWORD):
                    print self.USERNAME, "login error"
                    key = raw_input("Press enter key to exit...")
                    sys.exit(-1)
            except:
                pass

        print self.info()
Example #4
0
def thunder_login(username, password, secure, hashstr):
    if not secure:
        hash = hex_md5(username + password + username)
    else:
        hash = hashstr

    lixianAPI = LiXianAPI()

    try:
        if secure:
            isLogin = lixianAPI.secure_login(username, password)
        else:
            isLogin = lixianAPI.login(username, password)
    except:
        isLogin = False

    if isLogin:
        print 'USER LOGIN SUCCESS: ' + username
        try:
            if not secure:
                #save user info
                print pyfile_dir

                f = open(pyfile_dir + '/.fakeThunder_' + hash + '.txt', 'w')
                f.truncate(0)
                f.write(username + '\n' + hex_md5(hex_md5(password)))
                f.close()

                pass
        except:
            pass

        lixianAPIs[hash] = lixianAPI
        lixianAPIs_login_status[hash] = True
        lixianAPIs_last_update_time[hash] = time()

        return True
    else:
        print 'USER LOGIN FAIL: ' + username
        return False
Example #5
0
def thunder_login(username, password, secure, hashstr):
	if not secure:
		hash = hex_md5(username + password + username)
	else:
		hash = hashstr

	lixianAPI = LiXianAPI()
	
	try:
		if secure:
			isLogin = lixianAPI.secure_login(username, password)
		else:
			isLogin = lixianAPI.login(username, password)
	except:
		isLogin = False
	
	if isLogin:
		print 'USER LOGIN SUCCESS: ' + username
		try:
			if not secure:
				#save user info
				print pyfile_dir
				
				f = open(pyfile_dir + '/.fakeThunder_' + hash +'.txt', 'w')
				f.truncate(0)
				f.write(username + '\n' + hex_md5(hex_md5(password)))
				f.close()
				
				pass
		except:
			pass
				
		lixianAPIs[hash] = lixianAPI
		lixianAPIs_login_status[hash] = True
		lixianAPIs_last_update_time[hash] = time()
		
		return True
	else:
		print 'USER LOGIN FAIL: ' + username
		return False
Example #6
0
    def __init__(self,username = None,password = None):
        ConfigParser.RawConfigParser.OPTCRE = re.compile(r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$')
        self.CONFIG = ConfigParser.ConfigParser()
        self.CONFIG.read(os.path.join(os.path.dirname(__file__), __config__))

        self.LISTEN_IP = self.CONFIG.get('listen', 'ip')
        self.LISTEN_PORT = self.CONFIG.getint('listen', 'port')

        self.XUNLEI_ENABLE = self.CONFIG.getboolean('xunlei', 'enable')
        if self.XUNLEI_ENABLE:
            if username != None:
                self.USERNAME = username
            else:
                self.USERNAME = self.CONFIG.get('xunlei', 'username')
            if password != None:
                self.PASSWORD = password
            else:
                self.PASSWORD = self.CONFIG.get('xunlei', 'password')

        self.urls = self.CONFIG.items('url')
        self.filters = self.CONFIG.items('filter')

        self.destdir = os.path.join(os.path.dirname(__file__), 'cache')

        self.minsize = self.CONFIG.getint('download', 'minsize')

        self.downloadlist = {}      
        self.ignorelist = []        
        
        self.xunlei = LiXianAPI()

        if self.XUNLEI_ENABLE:
            if self.USERNAME == '' or self.PASSWORD == '':
                self.USERNAME = raw_input('Username: '******'Password: ')
            try:
                if not self.xunlei.login(self.USERNAME, self.PASSWORD):
                    print self.USERNAME, "login error"
                    key = raw_input("Press enter key to exit...")
                    sys.exit(-1)
            except:
                pass
        
        print self.info()
Example #7
0
class Common:
    
    def __init__(self,username = None,password = None):
        ConfigParser.RawConfigParser.OPTCRE = re.compile(r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$')
        self.CONFIG = ConfigParser.ConfigParser()
        self.CONFIG.read(os.path.join(os.path.dirname(__file__), __config__))

        self.LISTEN_IP = self.CONFIG.get('listen', 'ip')
        self.LISTEN_PORT = self.CONFIG.getint('listen', 'port')

        self.XUNLEI_ENABLE = self.CONFIG.getboolean('xunlei', 'enable')
        if self.XUNLEI_ENABLE:
            if username != None:
                self.USERNAME = username
            else:
                self.USERNAME = self.CONFIG.get('xunlei', 'username')
            if password != None:
                self.PASSWORD = password
            else:
                self.PASSWORD = self.CONFIG.get('xunlei', 'password')

        self.urls = self.CONFIG.items('url')
        self.filters = self.CONFIG.items('filter')

        self.destdir = os.path.join(os.path.dirname(__file__), 'cache')

        self.minsize = self.CONFIG.getint('download', 'minsize')

        self.downloadlist = {}      
        self.ignorelist = []        
        
        self.xunlei = LiXianAPI()

        if self.XUNLEI_ENABLE:
            if self.USERNAME == '' or self.PASSWORD == '':
                self.USERNAME = raw_input('Username: '******'Password: '******''
        info += '------------------------------------------------------\n'
        info += 'PSN.Proxy Version    : %s\n' % (__version__)
        info += 'Listen Address       : %s:%d\n' % (socket.gethostbyname(socket.gethostname()), self.LISTEN_PORT)
        if self.XUNLEI_ENABLE:
            info += 'Xunlei User          : %s\n' % (self.USERNAME)
            info += 'Xunlei Expired Date  : %s\n' % (xvi.get("expiredate", "unknow"))
            info += 'Xunlei Level         : %s\n' % (xvi.get("level", "0"))
        info += '------------------------------------------------------\n'
        return info

    def has_download(self, key):
        return self.downloadlist.has_key(key)
        
    def addDownloadList(self, key, value):
        self.downloadlist[key] = value

    def delDownloadList(self, key):
        if self.downloadlist.has_key(key):
            del self.downloadlist[key]
Example #8
0
class Common:
    def __init__(self, username=None, password=None):
        ConfigParser.RawConfigParser.OPTCRE = re.compile(
            r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$')
        self.CONFIG = ConfigParser.ConfigParser()
        self.CONFIG.read(os.path.join(os.path.dirname(__file__), __config__))

        self.LISTEN_IP = self.CONFIG.get('listen', 'ip')
        self.LISTEN_PORT = self.CONFIG.getint('listen', 'port')

        self.XUNLEI_ENABLE = self.CONFIG.getboolean('xunlei', 'enable')
        if self.XUNLEI_ENABLE:
            if username != None:
                self.USERNAME = username
            else:
                self.USERNAME = self.CONFIG.get('xunlei', 'username')
            if password != None:
                self.PASSWORD = password
            else:
                self.PASSWORD = self.CONFIG.get('xunlei', 'password')

        self.urls = self.CONFIG.items('url')
        self.filters = self.CONFIG.items('filter')

        self.destdir = os.path.join(os.path.dirname(__file__), 'cache')

        self.minsize = self.CONFIG.getint('download', 'minsize')

        self.downloadlist = {}
        self.ignorelist = []

        self.xunlei = LiXianAPI()

        if self.XUNLEI_ENABLE:
            if self.USERNAME == '' or self.PASSWORD == '':
                self.USERNAME = raw_input('Username: '******'Password: '******''
        info += '------------------------------------------------------\n'
        info += 'PSN.Proxy Version    : %s\n' % (__version__)
        info += 'Listen Address       : %s:%d\n' % (socket.gethostbyname(
            socket.gethostname()), self.LISTEN_PORT)
        if self.XUNLEI_ENABLE:
            info += 'Xunlei User          : %s\n' % (self.USERNAME)
            info += 'Xunlei Expired Date  : %s\n' % (xvi.get(
                "expiredate", "unknow"))
            info += 'Xunlei Level         : %s\n' % (xvi.get("level", "0"))
        info += '------------------------------------------------------\n'
        return info

    def has_download(self, key):
        return self.downloadlist.has_key(key)

    def addDownloadList(self, key, value):
        self.downloadlist[key] = value

    def delDownloadList(self, key):
        if self.downloadlist.has_key(key):
            del self.downloadlist[key]