diff options
Diffstat (limited to 'module/plugins/accounts/WebshareCz.py')
-rw-r--r-- | module/plugins/accounts/WebshareCz.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index f8e3eeb73..c88e86aba 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- +import hashlib import re +import time -from hashlib import md5, sha1 from passlib.hash import md5_crypt -from time import mktime, strptime, time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.07" + __version__ = "0.09" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" @@ -26,7 +26,7 @@ class WebshareCz(Account): def loadAccountInfo(self, user, req): html = req.load("https://webshare.cz/api/user_data/", - post={'wst': self.infos['wst']}, + post={'wst': self.getAccountData(user).get('wst', None)}, decode=True) self.logDebug("Response: " + html) @@ -34,9 +34,9 @@ class WebshareCz(Account): expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) self.logDebug("Expire date: " + expiredate) - validuntil = mktime(strptime(expiredate, "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) - premium = validuntil > time() + premium = validuntil > time.time() return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} @@ -51,8 +51,8 @@ class WebshareCz(Account): self.wrongPassword() salt = re.search('<salt>(.+)</salt>', salt).group(1) - password = sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() - digest = md5(user + ":Webshare:" + password).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() + digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = req.load("https://webshare.cz/api/login/", post={'digest' : digest, @@ -65,4 +65,4 @@ class WebshareCz(Account): if "<status>OK</status>" not in login: self.wrongPassword() - self.infos['wst'] = re.search('<token>(.+)</token>', login).group(1) + data['wst'] = re.search('<token>(.+)</token>', login).group(1) |