diff options
Diffstat (limited to 'module/plugins/accounts')
53 files changed, 496 insertions, 369 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 1f2371e28..d09086907 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- import re -import xml.dom.minidom as dom - -from time import time +import time +import xml.dom.minidom from BeautifulSoup import BeautifulSoup @@ -33,19 +32,19 @@ class AlldebridCom(Account): p = re.compile('\d+') exp_data = p.findall(time_text) - exp_time = time() + int(exp_data[0]) * 24 * 60 * 60 + int( + exp_time = time.time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 #Get expiration date from API - except: + except Exception: data = self.getAccountData(user) html = req.load("http://www.alldebrid.com/api.php", get={'action': "info_user", 'login': user, 'pw': data['password']}) self.logDebug(html) - xml = dom.parseString(html) - exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 + xml = xml.dom.minidom.parseString(html) + exp_time = time.time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 412aae534..00e546f6d 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -28,7 +28,6 @@ class BitshareCom(Account): def login(self, user, data, req): html = req.load("http://bitshare.com/login.html", post={"user": user, "password": data['password'], "submit": "Login"}, - cookies=True, decode=True) if "login" in req.lastEffectiveURL: diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index bcb14bee3..3ddadca8e 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -10,39 +9,44 @@ from module.plugins.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.05" - __description__ = """CatShareNet account plugin""" + __description__ = """Catshare.net account plugin""" __license__ = "GPLv3" __authors__ = [("prOq", None)] - PREMIUM_PATTERN = r'class="nav-collapse collapse pull-right">[\s\w<>=-."/:]*\sz.</a></li>\s*<li><a href="/premium">.*\s*<span style="color: red">(.*?)</span>[\s\w<>/]*href="/logout"' - VALID_UNTIL_PATTERN = r'<div class="span6 pull-right">[\s\w<>=-":;]*<span style="font-size:13px;">.*?<strong>(.*?)</strong></span>' + PREMIUM_PATTERN = r'<a href="/premium">Konto:[\s\n]*Premium' + VALID_UNTIL_PATTERN = r'>Konto premium.*?<strong>(.*?)</strong></span>' + TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' def loadAccountInfo(self, user, req): - premium = False - validuntil = -1 + premium = False + validuntil = -1 + trafficleft = -1 html = req.load("http://catshare.net/", decode=True) + if re.search(self.PREMIUM_PATTERN, html): + premium = True + try: - m = re.search(self.PREMIUM_PATTERN, html) - if "Premium" in m.group(1): - premium = True - except: + expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) + self.logDebug("Expire date: " + expiredate) + + validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) + + except Exception: pass try: - m = re.search(self.VALID_UNTIL_PATTERN, html) - expiredate = m.group(1) - if "-" not in expiredate: - validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) - except: + trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + + except Exception: pass - return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} + return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} def login(self, user, data, req): diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index f84bc67f3..300943828 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime import re +import time from module.plugins.Account import Account @@ -9,7 +9,7 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.18" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -21,15 +21,26 @@ class CzshareCom(Account): def loadAccountInfo(self, user, req): + premium = False + validuntil = None + trafficleft = None + html = req.load("http://sdilej.cz/prehled_kreditu/") - m = re.search(self.CREDIT_LEFT_PATTERN, html) - if m is None: - return {"validuntil": 0, "trafficleft": 0} + try: + m = re.search(self.CREDIT_LEFT_PATTERN, html) + trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2) + validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M')) + + except Exception, e: + self.logError(e) + else: - trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)] - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) - return {"validuntil": validuntil, "trafficleft": trafficleft} + premium = True + + return {'premium' : premium, + 'validuntil' : validuntil, + 'trafficleft': trafficleft} def login(self, user, data, req): diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 50f9aea27..3df99101a 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -28,7 +27,7 @@ class DebridItaliaCom(Account): if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: - validuntil = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d/%m/%Y %H:%M")) info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: self.logError(_("Unable to retrieve account information")) diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index dfe430276..a0bd6a37c 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime +import time from module.plugins.Account import Account @@ -23,7 +22,7 @@ class DepositfilesCom(Account): html = req.load("https://dfiles.eu/de/gold/") validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) - validuntil = mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(validuntil, "%Y-%m-%d %H:%M:%S")) return {"validuntil": validuntil, "trafficleft": -1} diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index f92a4e821..db4539e2e 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime import re +import time from module.plugins.Account import Account @@ -25,7 +25,7 @@ class EuroshareEu(Account): premium, validuntil = False, -1 else: premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y %H:%M")) return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} diff --git a/module/plugins/accounts/BillionuploadsCom.py b/module/plugins/accounts/ExashareCom.py index 11af36591..431798522 100644 --- a/module/plugins/accounts/BillionuploadsCom.py +++ b/module/plugins/accounts/ExashareCom.py @@ -3,14 +3,14 @@ from module.plugins.internal.XFSAccount import XFSAccount -class BillionuploadsCom(XFSAccount): - __name__ = "BillionuploadsCom" +class ExashareCom(XFSAccount): + __name__ = "ExashareCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.01" - __description__ = """Billionuploads.com account plugin""" + __description__ = """Exashare.com account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "billionuploads.com" + HOSTER_DOMAIN = "exashare.com" diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index d6e94f2e3..b946e29ba 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class FastshareCz(Account): __name__ = "FastshareCz" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Fastshare.cz account plugin""" __license__ = "GPLv3" @@ -16,13 +16,13 @@ class FastshareCz(Account): ("stickell", "l.stickell@yahoo.it")] - CREDIT_PATTERN = r'My account\s*\((.+?)\)' + CREDIT_PATTERN = r'Credit\s*:\s*</td>\s*<td>(.+?)\s*<' def loadAccountInfo(self, user, req): - validuntil = None + validuntil = -1 trafficleft = None - premium = None + premium = False html = req.load("http://www.fastshare.cz/user", decode=True) @@ -30,13 +30,11 @@ class FastshareCz(Account): if m: trafficleft = self.parseTraffic(m.group(1)) - if trafficleft: - premium = True - validuntil = -1 - else: - premium = False + premium = bool(trafficleft) - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): diff --git a/module/plugins/accounts/File4safeCom.py b/module/plugins/accounts/File4SafeCom.py index 50fe1aac8..50fe1aac8 100644 --- a/module/plugins/accounts/File4safeCom.py +++ b/module/plugins/accounts/File4SafeCom.py diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 426d572db..37b6f97a8 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from time import mktime, strptime - -from pycurl import REFERER +import time from module.plugins.Account import Account @@ -29,7 +28,7 @@ class FilefactoryCom(Account): if m: premium = True validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<D> \g<M> \g<Y>', m.group(0)) - validuntil = mktime(strptime(validuntil, "%d %b %Y")) + validuntil = time.mktime(time.strptime(validuntil, "%d %b %Y")) else: premium = False validuntil = -1 @@ -38,7 +37,7 @@ class FilefactoryCom(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") + req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") html = req.load("http://www.filefactory.com/member/signin.php", post={"loginEmail" : user, diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 9f7474207..b92a371a5 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -28,7 +28,7 @@ class FilejungleCom(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: premium = True - validuntil = mktime(strptime(m.group(1), "%d %b %Y")) + validuntil = time.mktime(time.strptime(m.group(1), "%d %b %Y")) else: premium = False validuntil = -1 diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 4067445af..149ff7d89 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,14 +9,14 @@ from module.plugins.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' + TOKEN_PATTERN = r'name="_csrf_token" value="(.+?)"' WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gültig bis (.+)\.\s*</td>' TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>' FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' @@ -43,15 +43,15 @@ class FilerNet(Account): def login(self, user, data, req): - html = req.load("https://filer.net/login") + html = req.load("https://filer.net/login", decode=True) token = re.search(self.TOKEN_PATTERN, html).group(1) html = req.load("https://filer.net/login_check", - post={"_username": user, - "_password": data['password'], + post={"_username" : user, + "_password" : data['password'], "_remember_me": "on", - "_csrf_token": token, + "_csrf_token" : token, "_target_path": "https://filer.net/"}, decode=True) diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index 15926589e..ee309c425 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -25,7 +25,6 @@ class FilesMailRu(Account): "Login": user, "Password": data['password'], "Page": "http://files.mail.ru/"}, - cookies=True, decode=True) if "Неверное имя пользователя или пароль" in html: diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 1cf2a3a3c..5eb6b844c 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from module.plugins.Account import Account from module.common.json_layer import json_loads @@ -24,7 +24,7 @@ class FileserveCom(Account): res = json_loads(html) if res['type'] == "premium": - validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) return {"trafficleft": res['traffic'], "validuntil": validuntil} else: return {"premium": False, "trafficleft": None, "validuntil": None} diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 83f4a9a84..ca3602a2c 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime +import time from module.plugins.Account import Account @@ -26,7 +25,7 @@ class FreakshareCom(Account): try: m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M) - validuntil = mktime(strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M")) except Exception: pass @@ -46,7 +45,6 @@ class FreakshareCom(Account): html = req.load("http://freakshare.com/login.html", post={"submit": "Login", "user": user, "pass": data['password']}, - cookies=True, decode=True) if ">Wrong Username or Password" in html: diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 66d912958..7fcf88f20 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -19,8 +18,8 @@ class FshareVn(Account): VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' - LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>[^<]+</dd>' - TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([\d.]+) ([kKMG])B</dd>' + LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>.+?</dd>' + TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd.*?>([\d.]+) ([kKMG])B</dd>' DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>' @@ -35,7 +34,7 @@ class FshareVn(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: premium = True - validuntil = mktime(strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) + validuntil = time.mktime(time.strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) trafficleft = self.getTrafficLeft() else: premium = False diff --git a/module/plugins/accounts/JunkyvideoCom.py b/module/plugins/accounts/JunkyvideoCom.py new file mode 100644 index 000000000..8275ff176 --- /dev/null +++ b/module/plugins/accounts/JunkyvideoCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class JunkyvideoCom(XFSAccount): + __name__ = "JunkyvideoCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Junkyvideo.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "junkyvideo.com" diff --git a/module/plugins/accounts/Keep2shareCc.py b/module/plugins/accounts/Keep2ShareCc.py index e855fb977..d2ba1d237 100644 --- a/module/plugins/accounts/Keep2shareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import gmtime, mktime, strptime +import time from module.plugins.Account import Account @@ -10,14 +9,15 @@ from module.plugins.Account import Account class Keep2ShareCc(Account): __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Keep2Share.cc account plugin""" __license__ = "GPLv3" - __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] + __authors__ = [("aeronaut", "aeronaut@pianoguy.de"), + ("Walter Purcaro", "vuolter@gmail.com")] - VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>' + VALID_UNTIL_PATTERN = r'Premium expires:\s*<b>(.+?)<' TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):\s*<b><a href="/user/statistic.html">(.+?)<' LOGIN_FAIL_PATTERN = r'Please fix the following input errors' @@ -25,8 +25,8 @@ class Keep2ShareCc(Account): def loadAccountInfo(self, user, req): validuntil = None - trafficleft = None - premium = None + trafficleft = -1 + premium = False html = req.load("http://keep2share.cc/site/profile.html", decode=True) @@ -40,25 +40,21 @@ class Keep2ShareCc(Account): validuntil = -1 else: try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + validuntil = time.mktime(time.strptime(expiredate, "%Y.%m.%d")) except Exception, e: self.logError(e) else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = None + premium = True if validuntil > time.mktime(time.gmtime()) else False - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - try: - trafficleft = self.parseTraffic(m.group(1)) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(m.group(1)) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index dff28a055..34571d374 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from hashlib import md5 +import hashlib from module.plugins.Account import Account from module.common.json_layer import json_loads @@ -9,8 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.04" - + __version__ = "0.05" __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -19,7 +18,7 @@ class LinksnappyCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password']).hexdigest()}) self.logDebug("JSON data: " + r) @@ -42,7 +41,7 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = self.parseTraffic(float(j['return']['trafficleft'] + "MB") + trafficleft = self.parseTraffic("%d MB" % j['return']['trafficleft']) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} @@ -51,7 +50,7 @@ class LinksnappyCom(Account): r = req.load("http://gen.linksnappy.com/lseAPI.php", get={'act' : 'USERDETAILS', 'username': user, - 'password': md5(data['password']).hexdigest()}, + 'password': hashlib.md5(data['password']).hexdigest()}, decode=True) if 'Invalid Account Details' in r: diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index b229fe47d..262d5a818 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import mktime, strptime from module.plugins.Account import Account @@ -34,7 +34,7 @@ class MegaRapidCz(Account): m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M")) return {"premium": True, "trafficleft": -1, "validuntil": validuntil} m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py new file mode 100644 index 000000000..d061d02bc --- /dev/null +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.Account import Account + + +class MegaRapidoNet(Account): + __name__ = "MegaRapidoNet" + __type__ = "account" + __version__ = "0.02" + + __description__ = """MegaRapido.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + VALID_UNTIL_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"].*?>[^<]*?<[^>]*?b.*?>\s*?TEMPO\s*?PREMIUM.*?<[^>]*?/b.*?>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS' + USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = False + + html = req.load("http://megarapido.net/gerador", decode=True) + + validuntil = re.search(self.VALID_UNTIL_PATTERN, html) + if validuntil: + #hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) + validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4)) + trafficleft = -1 + premium = True + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} + + + def login(self, user, data, req): + req.load("http://megarapido.net/login") + req.load("http://megarapido.net/painel_user/ajax/logar.php", + post={'login': user, 'senha': data['password']}, + decode=True) + + html = req.load("http://megarapido.net/gerador") + + if "sair" not in html.lower(): + self.wrongPassword() + else: + m = re.search(self.USER_ID_PATTERN, html) + if m: + data['uid'] = m.group(1) + else: + self.fail("Couldn't find the user ID") diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 127ebadc8..3d7ddbe46 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -29,7 +29,7 @@ class MegasharesCom(Account): try: timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) self.logDebug(timestr) - validuntil = mktime(strptime(timestr, "%b %d, %Y")) + validuntil = time.mktime(time.strptime(timestr, "%b %d, %Y")) except Exception, e: self.logError(e) diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 0ac764ee1..3488e3288 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -16,7 +16,7 @@ class MultishareCz(Account): TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' - ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name="[^"]*" value="([^"]+)">' + ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name=".+?" value="(.+?)">' def loadAccountInfo(self, user, req): diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 4c75b27f0..9a13e2e42 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import time +import time from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -18,7 +18,7 @@ class MyfastfileCom(Account): def loadAccountInfo(self, user, req): if 'days_left' in self.json_data: - validuntil = time() + self.json_data['days_left'] * 24 * 60 * 60 + validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60 return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: self.logError(_("Unable to get account information")) diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py deleted file mode 100755 index 1abd7fa84..000000000 --- a/module/plugins/accounts/NetloadIn.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import time - -from module.plugins.Account import Account - - -class NetloadIn(Account): - __name__ = "NetloadIn" - __type__ = "account" - __version__ = "0.23" - - __description__ = """Netload.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("CryNickSystems", "webmaster@pcProfil.de")] - - - def loadAccountInfo(self, user, req): - html = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) - left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' - left = re.search(left, html) - if left: - validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 - trafficleft = -1 - premium = True - else: - validuntil = None - premium = False - trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load("http://netload.in/index.php", - post={"txtuser" : user, - "txtpass" : data['password'], - "txtcheck": "login", - "txtlogin": "Login"}, - cookies=True, - decode=True) - if "password or it might be invalid!" in html: - self.wrongPassword() diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py new file mode 100644 index 000000000..57f2b9ae8 --- /dev/null +++ b/module/plugins/accounts/NitroflareCom.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.Account import Account + + +class NitroflareCom(Account): + __name__ = "NitroflareCom" + __type__ = "account" + __version__ = "0.04" + + __description__ = """Nitroflare.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] + + + VALID_UNTIL_PATTERN = r'>Time Left</label><strong>(.+?)</' + TRAFFIC_LEFT_PATTERN = r'>Daily Limit</label><strong>([\d.,]+)' + LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' + + TOKEN_PATTERN = r'name="token" value="(.+?)"' + + + def loadAccountInfo(self, user, req): + validuntil = -1 + trafficleft = None + premium = False + + html = req.load("https://nitroflare.com/member", + get={'s': "premium"}, + decode=True) + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Time Left: " + expiredate) + + try: + validuntil = sum(int(v) * {'day': 24 * 3600, 'hour': 3600, 'minute': 60}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(day|hour|minute)', expiredate, re.I)) + except Exception, e: + self.logError(e) + + else: + self.logDebug("Valid until: %s" % validuntil) + + if validuntil: + validuntil += time.time() + premium = True + else: + validuntil = -1 + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(str(max(0, 50 - float(m.group(1)))) + " GB") + + except Exception, e: + self.logError(e) + else: + self.logDebug("TRAFFIC_LEFT_PATTERN not found") + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} + + + def login(self, user, data, req): + html = req.load("https://nitroflare.com/login", decode=True) + + token = re.search(self.TOKEN_PATTERN, html).group(1) + + html = req.load("https://nitroflare.com/login", + post={'login' : "", + 'email' : user, + 'password': data['password'], + 'token' : token}, + decode=True) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.wrongPassword() diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index f2223b7d9..6c034b31f 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -1,41 +1,41 @@ # -*- coding: utf-8 -*- -from datetime import datetime +import datetime import hashlib +import time +from module.common.json_layer import json_loads from module.plugins.Account import Account -from time import mktime -from module.common.json_layer import json_loads as loads class NoPremiumPl(Account): - __name__ = "NoPremiumPl" + __name__ = "NoPremiumPl" + __type__ = "account" __version__ = "0.01" - __type__ = "account" + __description__ = "NoPremium.pl account plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] - _api_url = "http://crypt.nopremium.pl" - _api_query = { - "site": "nopremium", - "username": "", - "password": "", - "output": "json", - "loc": "1", - "info": "1" - } + API_URL = "http://crypt.nopremium.pl" + API_QUERY = {'site' : "nopremium", + 'username': "" , + 'password': "" , + 'output' : "json" , + 'loc' : "1" , + 'info' : "1" } _req = None _usr = None _pwd = None + def loadAccountInfo(self, name, req): self._req = req try: - result = loads(self.runAuthQuery()) - except: + result = json_loads(self.runAuthQuery()) + except Exception: # todo: return or let it be thrown? return @@ -44,14 +44,14 @@ class NoPremiumPl(Account): if "expire" in result.keys() and result["expire"]: premium = True - valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + traffic_left = result["balance"] * 1024 - return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + return {'validuntil' : valid_untill, + 'trafficleft': traffic_left, + 'premium' : premium } + def login(self, user, data, req): self._usr = user @@ -59,23 +59,23 @@ class NoPremiumPl(Account): self._req = req try: - response = loads(self.runAuthQuery()) - except: + response = json_loads(self.runAuthQuery()) + except Exception: self.wrongPassword() if "errno" in response.keys(): self.wrongPassword() + data['usr'] = self._usr data['pwd'] = self._pwd + def createAuthQuery(self): - query = self._api_query + query = self.API_QUERY query["username"] = self._usr query["password"] = self._pwd - return query - def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) - return data
\ No newline at end of file + def runAuthQuery(self): + return self._req.load(self.API_URL, post=self.createAuthQuery()) diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index f44ae3865..2f7b033bd 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import gmtime, mktime, strptime +import time from module.plugins.Account import Account @@ -33,13 +32,13 @@ class NowVideoSx(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + validuntil = time.mktime(time.strptime(expiredate, "%Y-%b-%d")) except Exception, e: self.logError(e) else: - if validuntil > mktime(gmtime()): + if validuntil > time.mktime(time.gmtime()): premium = True else: premium = False diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 0acacbb2a..020a45ba7 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -1,8 +1,20 @@ # -*- coding: utf-8 -*- -import time +try: + from beaker.crypto.pbkdf2 import PBKDF2 -from beaker.crypto.pbkdf2 import PBKDF2 +except ImportError: + from beaker.crypto.pbkdf2 import pbkdf2 + from binascii import b2a_hex + + class PBKDF2(object): + def __init__(self, passphrase, salt, iterations=1000): + self.passphrase = passphrase + self.salt = salt + self.iterations = iterations + + def hexread(self, octets): + return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -11,7 +23,7 @@ from module.plugins.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 1fc8d994d..b19e2bc69 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re - -from time import strptime, mktime - -from pycurl import REFERER +import time from module.plugins.Account import Account @@ -36,7 +34,7 @@ class OneFichierCom(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) + validuntil = time.mktime(time.strptime(expiredate, "%d/%m/%Y")) except Exception, e: self.logError(e) else: @@ -46,7 +44,7 @@ class OneFichierCom(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") + req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") html = req.load("https://1fichier.com/login.pl?lg=en", post={'mail' : user, diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index d59944e63..64d04aded 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -15,7 +15,7 @@ class OverLoadMe(Account): def loadAccountInfo(self, user, req): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" data = self.getAccountData(user) html = req.load(https + "://api.over-load.me/account.php", get={'user': user, @@ -32,7 +32,7 @@ class OverLoadMe(Account): def login(self, user, data, req): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" jsondata = req.load(https + "://api.over-load.me/account.php", get={'user': user, 'auth': data['password']}).strip() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 7d061ec2d..da31d93ee 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -1,14 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account - from module.common.json_layer import json_loads +from module.plugins.Account import Account class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.13" + __version__ = "0.16" __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" @@ -42,7 +41,7 @@ class PremiumizeMe(Account): def getAccountStatus(self, user, req): # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) # to retrieve account info and return the parsed json answer - answer = req.load("https://api.premiumize.me/pm-api/v1.php", + answer = req.load("http://api.premiumize.me/pm-api/v1.php", get={'method' : "accountstatus", 'params[login]': user, 'params[pass]' : self.getAccountData(user)['password']}) diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 438ce7ad3..92736cba0 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -1,80 +1,81 @@ # -*- coding: utf-8 -*- -from datetime import datetime +import datetime import hashlib +import time +from module.common.json_layer import json_loads from module.plugins.Account import Account -from time import mktime -from module.common.json_layer import json_loads as loads class RapideoPl(Account): - __name__ = "RapideoPl" + __name__ = "RapideoPl" + __type__ = "account" __version__ = "0.01" - __type__ = "account" + __description__ = "Rapideo.pl account plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] - _api_url = "http://enc.rapideo.pl" - _api_query = { - "site": "newrd", - "username": "", - "password": "", - "output": "json", - "loc": "1", - "info": "1" - } + API_URL = "http://enc.rapideo.pl" + API_QUERY = {'site' : "newrd", + 'username': "" , + 'password': "" , + 'output' : "json" , + 'loc' : "1" , + 'info' : "1" } _req = None _usr = None _pwd = None + def loadAccountInfo(self, name, req): self._req = req try: - result = loads(self.runAuthQuery()) - except: + result = json_loads(self.runAuthQuery()) + except Exception: # todo: return or let it be thrown? return premium = False valid_untill = -1 + if "expire" in result.keys() and result["expire"]: premium = True - valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] - return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + return {'validuntil' : valid_untill, + 'trafficleft': traffic_left, + 'premium' : premium } + def login(self, user, data, req): self._usr = user self._pwd = hashlib.md5(data["password"]).hexdigest() self._req = req + try: - response = loads(self.runAuthQuery()) - except: + response = json_loads(self.runAuthQuery()) + except Exception: self.wrongPassword() if "errno" in response.keys(): self.wrongPassword() + data['usr'] = self._usr data['pwd'] = self._pwd + def createAuthQuery(self): - query = self._api_query + query = self.API_QUERY query["username"] = self._usr query["password"] = self._pwd - return query - def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) - return data
\ No newline at end of file + def runAuthQuery(self): + return self._req.load(self.API_URL, post=self.createAuthQuery()) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index b29d94228..5ff30e061 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -7,50 +7,61 @@ from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.06" + __version__ = "0.09" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - API_URL = 'http://rapidgator.net/api/user' + API_URL = "http://rapidgator.net/api/user" def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = False + sid = None + try: - sid = self.getAccountData(user).get('SID') + sid = self.getAccountData(user).get('sid', None) assert sid - json = req.load("%s/info?sid=%s" % (self.API_URL, sid)) - self.logDebug("API:USERINFO", json) - json = json_loads(json) + html = req.load("%s/info" % self.API_URL, get={'sid': sid}) + + self.logDebug("API:USERINFO", html) + + json = json_loads(html) if json['response_status'] == 200: if "reset_in" in json['response']: self.scheduleRefresh(user, json['response']['reset_in']) - return {"validuntil": json['response']['expire_date'], - "trafficleft": float(json['response']['traffic_left']) / 1024, #@TODO: Remove `/ 1024` in 0.4.10 - "premium": True} + validuntil = json['response']['expire_date'] + trafficleft = float(json['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + premium = True else: self.logError(json['response_details']) + except Exception, e: self.logError(e) - return {"validuntil": None, "trafficleft": None, "premium": False} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium, + 'sid' : sid} def login(self, user, data, req): try: - json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) + html = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) - self.logDebug("API:LOGIN", json) + self.logDebug("API:LOGIN", html) - json = json_loads(json) + json = json_loads(html) if json['response_status'] == 200: - data['SID'] = str(json['response']['session_id']) + data['sid'] = str(json['response']['session_id']) return else: self.logError(json['response_details']) diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 8da698c57..70f47b673 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from module.plugins.Account import Account from module.common.json_layer import json_loads @@ -38,7 +37,7 @@ class RapiduNet(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - validuntil = time() + (86400 * int(m.group(1))) + validuntil = time.time() + (86400 * int(m.group(1))) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 41d8a0975..ad2975aa9 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import xml.dom.minidom as dom +import xml.dom.minidom from module.plugins.Account import Account @@ -19,7 +19,7 @@ class RealdebridCom(Account): if self.pin_code: return {"premium": False} html = req.load("https://real-debrid.com/api/account.php") - xml = dom.parseString(html) + xml = xml.dom.minidom.parseString(html) account_info = {"validuntil": float(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), "trafficleft": -1} diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 897f888b0..04e71c9ad 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -18,13 +18,13 @@ class RehostTo(Account): trafficleft = None validuntil = -1 session = "" - + html = req.load("http://rehost.to/api.php", get={'cmd' : "login", 'user': user, 'pass': self.getAccountData(user)['password']}) try: session = html.split(",")[1].split("=")[1] - + html = req.load("http://rehost.to/api.php", get={'cmd': "get_premium_credits", 'long_ses': session}) @@ -32,11 +32,11 @@ class RehostTo(Account): self.logDebug(html) else: traffic, valid = html.split(",") - + premium = True trafficleft = self.parseTraffic(traffic + "MB") validuntil = float(valid) - + finally: return {'premium' : premium, 'trafficleft': trafficleft, diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 3ee6e04af..4214b4401 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.30" + __version__ = "0.33" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" @@ -40,18 +40,24 @@ class ShareonlineBiz(Account): if api['a'].lower() != "not_available": req.cj.setCookie("share-online.biz", 'a', api['a']) - premium = api['group'] == "Premium" + premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium") validuntil = float(api['expire_date']) traffic = float(api['traffic_1d'].split(";")[0]) - maxtraffic = max(maxtraffic, traffic) - trafficleft = maxtraffic - traffic + + if maxtraffic > traffic: + trafficleft = maxtraffic - traffic + else: + trafficleft = -1 maxtraffic /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 trafficleft /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft, 'maxtraffic': maxtraffic} + return {'premium' : premium, + 'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'maxtraffic' : maxtraffic} def login(self, user, data, req): diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 79daf245e..8caf600f9 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -15,15 +15,18 @@ class SimplyPremiumCom(Account): def loadAccountInfo(self, user, req): + premium = False validuntil = -1 trafficleft = None json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') - self.logDebug("JSON data: " + json_data) + + self.logDebug("JSON data: %s" % json_data) + json_data = json_loads(json_data) - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} + if 'vip' in json_data['result'] and json_data['result']['vip']: + premium = True if 'timeend' in json_data['result'] and json_data['result']['timeend']: validuntil = float(json_data['result']['timeend']) @@ -31,18 +34,15 @@ class SimplyPremiumCom(Account): if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): req.cj.setCookie("simply-premium.com", "lang", "EN") - if data['password'] == '' or data['password'] == '0': - post_data = {"key": user} - else: - post_data = {"login_name": user, "login_pass": data['password']} - - html = req.load("http://www.simply-premium.com/login.php", post=post_data, decode=True) + html = req.load("http://www.simply-premium.com/login.php", + post={'key': user} if not data['password'] else {'login_name': user, 'login_pass': data['password']}, + decode=True) if 'logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 29be2f73d..24108eb0b 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -22,7 +22,7 @@ class SimplydebridCom(Account): if str(data[0]) != "1": return {"premium": False} else: - return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} + return {"trafficleft": -1, "validuntil": time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} def login(self, user, data, req): diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index e6c25752b..1c303331b 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -1,9 +1,23 @@ # -*- coding: utf-8 -*- import hashlib +import time -from beaker.crypto.pbkdf2 import PBKDF2 -from time import time +try: + from beaker.crypto.pbkdf2 import PBKDF2 + +except ImportError: + from beaker.crypto.pbkdf2 import pbkdf2 + from binascii import b2a_hex + + class PBKDF2(object): + def __init__(self, passphrase, salt, iterations=1000): + self.passphrase = passphrase + self.salt = salt + self.iterations = iterations + + def hexread(self, octets): + return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -12,7 +26,7 @@ from module.plugins.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" __description__ = """Smoozed.com account plugin""" __license__ = "GPLv3" @@ -20,7 +34,6 @@ class SmoozedCom(Account): def loadAccountInfo(self, user, req): - # Get user data from premiumize.me status = self.getAccountStatus(user, req) self.logDebug(status) @@ -36,8 +49,11 @@ class SmoozedCom(Account): 'session' : status["data"]["session_key"], 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} - if info['validuntil'] < time(): - info['premium'] = False + if info['validuntil'] < time.time(): + if float(status["data"]["user"].get("user_trial", 0)) > time.time(): + info['premium'] = True + else: + info['premium'] = False else: info['premium'] = True diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index a857649eb..010fbc270 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -22,7 +22,7 @@ class TurbobitNet(Account): m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) if m: premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y")) else: premium = False validuntil = -1 diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 279dfd00a..d06ba0583 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime, gmtime +import time from module.plugins.internal.XFSAccount import XFSAccount diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 7236a4fa8..f95c8834b 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.Account import Account @@ -18,7 +17,7 @@ class UlozTo(Account): ("pulpe", None)] - TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title="[^"]*?GB = ([\d.]+) MB"' + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"' def loadAccountInfo(self, user, req): @@ -37,7 +36,7 @@ class UlozTo(Account): action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) - html = req.load(urljoin("http://www.ulozto.net/", action), + html = req.load(urlparse.urljoin("http://www.ulozto.net/", action), post={'_token_' : token, 'do' : "loginForm-submit", 'login' : u"Přihlásit", diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py deleted file mode 100644 index 6a8187234..000000000 --- a/module/plugins/accounts/UnrestrictLi.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - - -class UnrestrictLi(Account): - __name__ = "UnrestrictLi" - __type__ = "account" - __version__ = "0.05" - - __description__ = """Unrestrict.li account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json') - self.logDebug("JSON data: " + json_data) - json_data = json_loads(json_data) - - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} - - validuntil = json_data['result']['expires'] - trafficleft = float(json_data['result']['traffic'] / 1024) #@TODO: Remove `/ 1024` in 0.4.10 - - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - - - def login(self, user, data, req): - req.cj.setCookie("unrestrict.li", "lang", "EN") - html = req.load("https://unrestrict.li/sign_in", decode=True) - - if 'solvemedia' in html: - self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) - return - - post_data = {"username": user, "password": data['password'], - "remember_me": "remember", "signin": "Sign in"} - html = req.load("https://unrestrict.li/sign_in", post=post_data, decode=True) - - if 'sign_out' not in html: - self.wrongPassword() diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 1b6df97fb..d1556b6db 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import time +import time from module.plugins.Account import Account @@ -39,7 +39,7 @@ class UploadedTo(Account): else: m = re.findall(r'(\d+) (week|day|hour)', expiredate) if m: - validuntil = time() + validuntil = time.time() for n, u in m: validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u] @@ -55,7 +55,9 @@ class UploadedTo(Account): else: trafficleft = self.parseTraffic(size + unit) - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index c70d2ec11..a20c44535 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time, strptime, mktime +import time from module.plugins.Account import Account from module.plugins.internal.SimpleHoster import set_cookies @@ -11,7 +10,7 @@ from module.plugins.internal.SimpleHoster import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Uploading.com account plugin""" __license__ = "GPLv3" @@ -37,27 +36,30 @@ class UploadingCom(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%b %d, %Y")) + validuntil = time.mktime(time.strptime(expiredate, "%b %d, %Y")) except Exception, e: self.logError(e) else: - if validuntil > mktime(gmtime()): - premium = True + if validuntil > time.mktime(time.gmtime()): + premium = True else: - premium = False + premium = False validuntil = None - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): - set_cookies([("uploading.com", "lang", "1"), - ("uploading.com", "language", "1"), - ("uploading.com", "setlang", "en"), - ("uploading.com", "_lang", "en")] + set_cookies(req.cj, + [("uploading.com", "lang" , "1" ), + ("uploading.com", "language", "1" ), + ("uploading.com", "setlang" , "en"), + ("uploading.com", "_lang" , "en")]) req.load("http://uploading.com/") - req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), + req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000), post={'email': user, 'password': data['password'], 'remember': "on"}) diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index 299a0acc2..c40dbd6e6 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): __name__ = "UptoboxCom" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __description__ = """DDLStorage.com account plugin""" __license__ = "GPLv3" @@ -15,3 +15,4 @@ class UptoboxCom(XFSAccount): HOSTER_DOMAIN = "uptobox.com" HOSTER_URL = "https://uptobox.com/" + LOGIN_URL = "https://login.uptobox.com/" diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index f8e3eeb73..8c53dd41e 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -1,10 +1,10 @@ # -*- 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 @@ -12,7 +12,7 @@ from module.plugins.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __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) diff --git a/module/plugins/accounts/WorldbytezCom.py b/module/plugins/accounts/WorldbytezCom.py new file mode 100644 index 000000000..a90dbea56 --- /dev/null +++ b/module/plugins/accounts/WorldbytezCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class WorldbytezCom(XFSAccount): + __name__ = "WorldbytezCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Worldbytez.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "worldbytez.com" diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 863588495..33602a2fe 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -23,7 +23,7 @@ class YibaishiwuCom(Account): html = req.load("http://115.com/", decode=True) m = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) - premium = True if (m and 'is_vip: 1' in m.group(1)) else False + premium = True if m and 'is_vip: 1' in m.group(1) else False validuntil = trafficleft = (-1 if m else 0) return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 6c69a974f..9bc6d0487 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from module.plugins.Account import Account @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.24" + __version__ = "0.26" __description__ = """Zevera.com account plugin""" __license__ = "GPLv3" @@ -39,8 +39,8 @@ class ZeveraCom(Account): api = self.api_response(req) - if api != "No trafic": - validuntil = mktime(strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) + if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!": + validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) trafficleft = float(api['availabletodaytraffic']) * 1024 if api['orondaytrafficlimit'] != '0' else -1 premium = True |