diff options
Diffstat (limited to 'module/plugins/accounts')
102 files changed, 2216 insertions, 1746 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 122d23447..c830f0c09 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -1,56 +1,64 @@ # -*- coding: utf-8 -*- +import re import xml.dom.minidom as dom + from time import time -import re -import urllib -from module.plugins.Account import Account from BeautifulSoup import BeautifulSoup +from module.plugins.Account import Account + class AlldebridCom(Account): - __name__ = "AlldebridCom" - __version__ = "0.22" - __type__ = "account" + __name__ = "AlldebridCom" + __type__ = "account" + __version__ = "0.23" __description__ = """AllDebrid.com account plugin""" - __author_name__ = "Andy Voigt" - __author_mail__ = "spamsales@online.de" + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/account/") - soup = BeautifulSoup(page) - #Try to parse expiration date directly from the control panel page (better accuracy) + html = req.load("http://www.alldebrid.com/account/") + soup = BeautifulSoup(html) + + #Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string + self.logDebug("Account expires in: %s" % time_text) + p = re.compile('\d+') exp_data = p.findall(time_text) exp_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) - page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, - data['password'])) - self.logDebug(page) - xml = dom.parseString(page) + 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 + account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info - def login(self, user, data, req): - urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) - page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) - if "This login doesn't exist" in page: - self.wrongPassword() - - if "The password is not valid" in page: - self.wrongPassword() + def login(self, user, data, req): + html = req.load("http://www.alldebrid.com/register/", + get={'action' : "login", + 'login_login' : user, + 'login_password': data['password']}, + decode=True) - if "Invalid captcha" in page: + if "This login doesn't exist" in html \ + or "The password is not valid" in html \ + or "Invalid captcha" in html: self.wrongPassword() diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py new file mode 100644 index 000000000..46c8d7ac5 --- /dev/null +++ b/module/plugins/accounts/BackinNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class BackinNet(XFSAccount): + __name__ = "BackinNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Backin.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "backin.net" diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py deleted file mode 100644 index 9d497ccb2..000000000 --- a/module/plugins/accounts/BayfilesCom.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - -from time import time - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - - -class BayfilesCom(Account): - __name__ = "BayfilesCom" - __version__ = "0.03" - __type__ = "account" - - __description__ = """Bayfiles.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" - - - def loadAccountInfo(self, user, req): - for _ in xrange(2): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(response) - if not response['error']: - break - self.logWarning(response['error']) - self.relogin(user) - - return {"premium": bool(response['premium']), "trafficleft": -1, - "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} - - def login(self, user, data, req): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) - self.logDebug(response) - if response['error']: - self.logError(response['error']) - self.wrongPassword() diff --git a/module/plugins/accounts/BillionuploadsCom.py b/module/plugins/accounts/BillionuploadsCom.py new file mode 100644 index 000000000..11af36591 --- /dev/null +++ b/module/plugins/accounts/BillionuploadsCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class BillionuploadsCom(XFSAccount): + __name__ = "BillionuploadsCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Billionuploads.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "billionuploads.com" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 3802b2c46..412aae534 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -1,46 +1,35 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account class BitshareCom(Account): - __name__ = "BitshareCom" - __version__ = "0.12" - __type__ = "account" + __name__ = "BitshareCom" + __type__ = "account" + __version__ = "0.13" __description__ = """Bitshare account plugin""" - __author_name__ = "Paul King" - __author_mail__ = None + __license__ = "GPLv3" + __authors__ = [("Paul King", None)] def loadAccountInfo(self, user, req): - page = req.load("http://bitshare.com/mysettings.html") + html = req.load("http://bitshare.com/mysettings.html") - if "\"http://bitshare.com/myupgrade.html\">Free" in page: + if "\"http://bitshare.com/myupgrade.html\">Free" in html: return {"validuntil": -1, "trafficleft": -1, "premium": False} - if not '<input type="checkbox" name="directdownload" checked="checked" />' in page: + if not '<input type="checkbox" name="directdownload" checked="checked" />' in html: self.logWarning(_("Activate direct Download in your Bitshare Account")) return {"validuntil": -1, "trafficleft": -1, "premium": True} + def login(self, user, data, req): - page = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) + 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: self.wrongPassword() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py new file mode 100644 index 000000000..ec4d706ae --- /dev/null +++ b/module/plugins/accounts/CatShareNet.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime + +from module.plugins.Account import Account + + +class CatShareNet(Account): + __name__ = "CatShareNet" + __type__ = "account" + __version__ = "0.05" + + __description__ = """CatShareNet account plugin""" + __license__ = "GPLv3" + __authors__ = [("prOq", None)] + + + 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 + trafficleft = -1 + + html = req.load("http://catshare.net/", decode=True) + + if re.search(self.PREMIUM_PATTERN, html): + premium = True + + try: + 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")) + + except Exception: + pass + + try: + trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + + except Exception: + pass + + return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} + + + def login(self, user, data, req): + html = req.load("http://catshare.net/login", + post={'user_email': user, + 'user_password': data['password'], + 'remindPassword': 0, + 'user[submit]': "Login"}, + decode=True) + + if not '<a href="/logout">Wyloguj</a>' in html: + self.wrongPassword() diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py new file mode 100644 index 000000000..d22d5e4b3 --- /dev/null +++ b/module/plugins/accounts/CloudzillaTo.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Account import Account + + +class CloudzillaTo(Account): + __name__ = "CloudzillaTo" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Cloudzilla.to account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + PREMIUM_PATTERN = r'<h2>account type</h2>\s*Premium Account' + + + def loadAccountInfo(self, user, req): + html = req.load("http://www.cloudzilla.to/") + + premium = True if re.search(self.PREMIUM_PATTERN, html) else False + + return {'validuntil': -1, 'trafficleft': -1, 'premium': premium} + + + def login(self, user, data, req): + html = req.load("http://www.cloudzilla.to/", + post={'lusername': user, + 'lpassword': data['password'], + 'w' : "dologin"}, + decode=True) + + if "ERROR" in html: + self.wrongPassword() diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index 9d352c967..a9e2274a2 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class CramitIn(XFSPAccount): - __name__ = "CramitIn" - __version__ = "0.01" - __type__ = "account" +class CramitIn(XFSAccount): + __name__ = "CramitIn" + __type__ = "account" + __version__ = "0.03" __description__ = """Cramit.in account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - MAIN_PAGE = "http://cramit.in/" + + HOSTER_DOMAIN = "cramit.in" diff --git a/module/plugins/accounts/CyberlockerCh.py b/module/plugins/accounts/CyberlockerCh.py deleted file mode 100644 index 297808a6e..000000000 --- a/module/plugins/accounts/CyberlockerCh.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSPAccount import XFSPAccount -from module.plugins.internal.SimpleHoster import parseHtmlForm - - -class CyberlockerCh(XFSPAccount): - __name__ = "CyberlockerCh" - __version__ = "0.01" - __type__ = "account" - - __description__ = """Cyberlocker.ch account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" - - MAIN_PAGE = "http://cyberlocker.ch/" - - - def login(self, user, data, req): - html = req.load(self.MAIN_PAGE + 'login.html', decode=True) - - action, inputs = parseHtmlForm('name="FL"', html) - if not inputs: - inputs = {"op": "login", - "redirect": self.MAIN_PAGE} - - inputs.update({"login": user, - "password": data['password']}) - - # Without this a 403 Forbidden is returned - req.http.lastURL = self.MAIN_PAGE + 'login.html' - html = req.load(self.MAIN_PAGE, post=inputs, decode=True) - - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 912b9328b..f84bc67f3 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from time import mktime, strptime import re @@ -22,15 +7,17 @@ from module.plugins.Account import Account class CzshareCom(Account): - __name__ = "CzshareCom" - __version__ = "0.14" - __type__ = "account" + __name__ = "CzshareCom" + __type__ = "account" + __version__ = "0.16" __description__ = """Czshare.com account plugin, now Sdilej.cz""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([0-9 ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' + + CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([\d ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' def loadAccountInfo(self, user, req): @@ -40,17 +27,17 @@ class CzshareCom(Account): if m is None: return {"validuntil": 0, "trafficleft": 0} else: - credits = float(m.group(1).replace(' ', '').replace(',', '.')) - credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[m.group(2)] - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) - return {"validuntil": validuntil, "trafficleft": credits} + 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} + def login(self, user, data, req): - html = req.load('https://sdilej.cz/index.php', post={ - "Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user - }) + html = req.load('https://sdilej.cz/index.php', + post={"Prihlasit": "Prihlasit", + "login-password": data['password'], + "login-name": user}, + decode=True) if '<div class="login' in html: self.wrongPassword() diff --git a/module/plugins/accounts/DdlstorageCom.py b/module/plugins/accounts/DdlstorageCom.py deleted file mode 100644 index 9d90f4dab..000000000 --- a/module/plugins/accounts/DdlstorageCom.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -from hashlib import md5 -from time import mktime, strptime - -from module.plugins.internal.XFSPAccount import XFSPAccount -from module.common.json_layer import json_loads -from module.utils import parseFileSize - -# DDLStorage API Documentation: -# http://www.ddlstorage.com/cgi-bin/api_req.cgi?req_type=doc - - -class DdlstorageCom(XFSPAccount): - __name__ = "DdlstorageCom" - __version__ = "1.00" - __type__ = "account" - - __description__ = """DDLStorage.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" - - MAIN_PAGE = "http://ddlstorage.com/" - - - def loadAccountInfo(self, user, req): - password = self.accounts[user]['password'] - api_data = req.load('http://www.ddlstorage.com/cgi-bin/api_req.cgi', - post={'req_type': 'user_info', - 'client_id': 53472, - 'user_login': user, - 'user_password': md5(password).hexdigest(), - 'sign': md5('user_info%d%s%s%s' % (53472, user, md5(password).hexdigest(), - '25JcpU2dPOKg8E2OEoRqMSRu068r0Cv3')).hexdigest()}) - api_data = api_data.replace('<pre>', '').replace('</pre>', '') - self.logDebug('Account Info API data: ' + api_data) - api_data = json_loads(api_data) - - if api_data['status'] != 'OK': # 'status' must be always OK for a working account - return {"premium": False, "valid": False} - - if api_data['account_type'] == 'REGISTERED': - premium = False - validuntil = None - else: - premium = True - validuntil = int(mktime(strptime(api_data['premium_expire'], "%Y-%m-%d %H:%M:%S"))) - - if api_data['usr_bandwidth_available'] == 'UNLIMITED': - trafficleft = -1 - else: - trafficleft = parseFileSize(api_data['usr_bandwidth_available']) / 1024 - - return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 1ee0d96c2..50f9aea27 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -1,50 +1,45 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ import re -import time + +from time import mktime, strptime from module.plugins.Account import Account class DebridItaliaCom(Account): - __name__ = "DebridItaliaCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "DebridItaliaCom" + __type__ = "account" + __version__ = "0.13" __description__ = """Debriditalia.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + - WALID_UNTIL_PATTERN = r"Premium valid till: (?P<D>[^|]+) \|" + WALID_UNTIL_PATTERN = r'Premium valid till: (.+?) \|' def loadAccountInfo(self, user, req): - if 'Account premium not activated' in self.html: - return {"premium": False, "validuntil": None, "trafficleft": None} + info = {"premium": False, "validuntil": None, "trafficleft": None} + html = req.load("http://debriditalia.com/") + + 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")) + info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} + else: + self.logError(_("Unable to retrieve account information")) + + return info - m = re.search(self.WALID_UNTIL_PATTERN, self.html) - if m: - validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M"))) - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} - else: - self.logError('Unable to retrieve account information - Plugin may be out of date') def login(self, user, data, req): - self.html = req.load("http://debriditalia.com/login.php", - get={"u": user, "p": data['password']}) - if 'NO' in self.html: + html = req.load("http://debriditalia.com/login.php", + get={'u': user, 'p': data['password']}, + decode=True) + + if 'NO' in html: self.wrongPassword() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 2037f35c4..dfe430276 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -8,25 +8,30 @@ from module.plugins.Account import Account class DepositfilesCom(Account): - __name__ = "DepositfilesCom" - __version__ = "0.3" - __type__ = "account" + __name__ = "DepositfilesCom" + __type__ = "account" + __version__ = "0.32" __description__ = """Depositfiles.com account plugin""" - __author_name__ = ("mkaay", "stickell", "Walter Purcaro") - __author_mail__ = ("mkaay@mkaay.de", "l.stickell@yahoo.it", "vuolter@gmail.com") + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] def loadAccountInfo(self, user, req): - src = req.load("https://dfiles.eu/de/gold/") - validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", src).group(1) + html = req.load("https://dfiles.eu/de/gold/") + validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) - validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) + validuntil = mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S")) return {"validuntil": validuntil, "trafficleft": -1} + def login(self, user, data, req): - src = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}) - if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src: + html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, + post={"login": user, "password": data['password']}, + decode=True) + + if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: self.wrongPassword() diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 755a4dbff..93d3e2c19 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -1,76 +1,19 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re -from time import mktime, strptime, gmtime -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm -from module.utils import parseFileSize +from module.plugins.internal.XFSAccount import XFSAccount -class EasybytezCom(Account): - __name__ = "EasybytezCom" - __version__ = "0.04" - __type__ = "account" +class EasybytezCom(XFSAccount): + __name__ = "EasybytezCom" + __type__ = "account" + __version__ = "0.12" __description__ = """EasyBytez.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" - - VALID_UNTIL_PATTERN = r'Premium account expire:</TD><TD><b>([^<]+)</b>' - TRAFFIC_LEFT_PATTERN = r'<TR><TD>Traffic available today:</TD><TD><b>(?P<S>[^<]+)</b>' - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.easybytez.com/?op=my_account", decode=True) - - validuntil = trafficleft = None - premium = False - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - try: - self.logDebug("Expire date: " + m.group(1)) - validuntil = mktime(strptime(m.group(1), "%d %B %Y")) - except Exception, e: - self.logError(e) - if validuntil > mktime(gmtime()): - premium = True - trafficleft = -1 - else: - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: - trafficleft = -1 - else: - trafficleft = parseFileSize(trafficleft) / 1024 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - def login(self, user, data, req): - html = req.load('http://www.easybytez.com/login.html', decode=True) - action, inputs = parseHtmlForm('name="FL"', html) - inputs.update({"login": user, - "password": data['password'], - "redirect": "http://www.easybytez.com/"}) + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("guidobelix", "guidobelix@hotmail.it")] - html = req.load(action, post=inputs, decode=True) - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() + HOSTER_DOMAIN = "easybytez.com" diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py deleted file mode 100644 index cd568456f..000000000 --- a/module/plugins/accounts/EgoFilesCom.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import time - -from module.plugins.Account import Account -from module.utils import parseFileSize - - -class EgoFilesCom(Account): - __name__ = "EgoFilesCom" - __version__ = "0.2" - __type__ = "account" - - __description__ = """Egofiles.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" - - PREMIUM_ACCOUNT_PATTERN = '<br/>\s*Premium: (?P<P>[^/]*) / Traffic left: (?P<T>[\d.]*) (?P<U>\w*)\s*\\n\s*<br/>' - - - def loadAccountInfo(self, user, req): - html = req.load("http://egofiles.com") - if 'You are logged as a Free User' in html: - return {"premium": False, "validuntil": None, "trafficleft": None} - - m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html) - if m: - validuntil = int(time.mktime(time.strptime(m.group('P'), "%Y-%m-%d %H:%M:%S"))) - trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024 - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - else: - self.logError('Unable to retrieve account information - Plugin may be out of date') - - def login(self, user, data, req): - # Set English language - req.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True) - - html = req.load("http://egofiles.com/ajax/register.php", - post={"log": 1, - "loginV": user, - "passV": data['password']}) - if 'Login successful' not in html: - self.wrongPassword() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index f396f9bf2..f92a4e821 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from time import mktime, strptime import re @@ -22,13 +7,13 @@ from module.plugins.Account import Account class EuroshareEu(Account): - __name__ = "EuroshareEu" - __version__ = "0.01" - __type__ = "account" + __name__ = "EuroshareEu" + __type__ = "account" + __version__ = "0.02" __description__ = """Euroshare.eu account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): @@ -44,13 +29,13 @@ class EuroshareEu(Account): return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - def login(self, user, data, req): - html = req.load('http://euroshare.eu/customer-zone/login/', post={ - "trvale": "1", - "login": user, - "password": data['password'] - }, decode=True) + def login(self, user, data, req): + html = req.load('http://euroshare.eu/customer-zone/login/', + post={"trvale": "1", + "login": user, + "password": data['password']}, + decode=True) if u">Nesprávne prihlasovacie meno alebo heslo" in html: self.wrongPassword() diff --git a/module/plugins/accounts/ExashareCom.py b/module/plugins/accounts/ExashareCom.py new file mode 100644 index 000000000..431798522 --- /dev/null +++ b/module/plugins/accounts/ExashareCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class ExashareCom(XFSAccount): + __name__ = "ExashareCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Exashare.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "exashare.com" diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 9e8d1f4fe..51be3880f 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -5,32 +5,37 @@ from module.common.json_layer import json_loads class FastixRu(Account): - __name__ = "FastixRu" - __version__ = "0.02" - __type__ = "account" + __name__ = "FastixRu" + __type__ = "account" + __version__ = "0.03" __description__ = """Fastix account plugin""" - __author_name__ = "Massimo Rosamilia" - __author_mail__ = "max@spiritix.eu" + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://fastix.ru/api_v2/?apikey=%s&sub=getaccountdetails" % (data['api'])) - page = json_loads(page) - points = page['points'] - kb = float(points) - kb = kb * 1024 ** 2 / 1000 + html = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) + + points = html['points'] + kb = float(points) * 1024 ** 2 / 1000 + if points > 0: account_info = {"validuntil": -1, "trafficleft": kb} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} return account_info + def login(self, user, data, req): - page = req.load("http://fastix.ru/api_v2/?sub=get_apikey&email=%s&password=%s" % (user, data['password'])) - api = json_loads(page) + html = req.load("http://fastix.ru/api_v2/", + get={'sub': "get_apikey", 'email': user, 'password': data['password']}) + + api = json_loads(html) api = api['apikey'] + data['api'] = api - if "error_code" in page: + + if "error_code" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index 2ac24cf39..d6e94f2e3 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -1,56 +1,52 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re + from module.plugins.Account import Account -from module.utils import parseFileSize class FastshareCz(Account): - __name__ = "FastshareCz" - __version__ = "0.03" - __type__ = "account" + __name__ = "FastshareCz" + __type__ = "account" + __version__ = "0.05" __description__ = """Fastshare.cz account plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + - CREDIT_PATTERN = r'(?:Kredit|Credit)\s*</td>\s*<td[^>]*>([\d. \w]+) ' + CREDIT_PATTERN = r'My account\s*\((.+?)\)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None + html = req.load("http://www.fastshare.cz/user", decode=True) m = re.search(self.CREDIT_PATTERN, html) if m: - trafficleft = parseFileSize(m.group(1)) / 1024 - premium = True if trafficleft else False + trafficleft = self.parseTraffic(m.group(1)) + + if trafficleft: + premium = True + validuntil = -1 else: - trafficleft = None premium = False - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): + req.cj.setCookie("fastshare.cz", "lang", "en") + req.load('http://www.fastshare.cz/login') # Do not remove or it will not login - html = req.load('http://www.fastshare.cz/sql.php', post={ - "heslo": data['password'], - "login": user - }, decode=True) - if u'>Špatné uživatelské jméno nebo heslo.<' in html: + html = req.load("http://www.fastshare.cz/sql.php", + post={'login': user, 'heslo': data['password']}, + decode=True) + + if ">Wrong username or password" in html: self.wrongPassword() diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py new file mode 100644 index 000000000..50fe1aac8 --- /dev/null +++ b/module/plugins/accounts/File4SafeCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class File4SafeCom(XFSAccount): + __name__ = "File4SafeCom" + __type__ = "account" + __version__ = "0.05" + + __description__ = """File4Safe.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + + + HOSTER_DOMAIN = "file4safe.com" + + LOGIN_FAIL_PATTERN = r'input_login' diff --git a/module/plugins/accounts/File4safeCom.py b/module/plugins/accounts/File4safeCom.py deleted file mode 100644 index 158d7be3b..000000000 --- a/module/plugins/accounts/File4safeCom.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSPAccount import XFSPAccount - - -class File4safeCom(XFSPAccount): - __name__ = "File4safeCom" - __version__ = "0.01" - __type__ = "account" - - __description__ = """File4safe.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" - - MAIN_PAGE = "http://file4safe.com/" - - LOGIN_FAIL_PATTERN = r'input_login' - PREMIUM_PATTERN = r'Extend Premium' diff --git a/module/plugins/accounts/FileParadoxIn.py b/module/plugins/accounts/FileParadoxIn.py new file mode 100644 index 000000000..c12d99d6a --- /dev/null +++ b/module/plugins/accounts/FileParadoxIn.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class FileParadoxIn(XFSAccount): + __name__ = "FileParadoxIn" + __type__ = "account" + __version__ = "0.02" + + __description__ = """FileParadox.in account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "fileparadox.in" diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index b8bad5c4c..8ca55b1bc 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,44 +1,30 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account from module.common.json_layer import json_loads class FilecloudIo(Account): - __name__ = "FilecloudIo" - __version__ = "0.02" - __type__ = "account" + __name__ = "FilecloudIo" + __type__ = "account" + __version__ = "0.04" __description__ = """FilecloudIo account plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): # It looks like the first API request always fails, so we retry 5 times, it should work on the second try - for _ in xrange(5): + for _i in xrange(5): rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.accounts[user]['password']}) + post={"username": user, "password": self.getAccountData(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': - self.logError("Wrong username or password") + self.logError(_("Wrong username or password")) return {"valid": False, "premium": False} else: return {"premium": False} @@ -50,10 +36,11 @@ class FilecloudIo(Account): rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": int(rep['premium_until']), "trafficleft": -1} + return {"validuntil": float(rep['premium_until']), "trafficleft": -1} else: return {"premium": False} + def login(self, user, data, req): req.cj.setCookie("secure.filecloud.io", "lang", "en") html = req.load('https://secure.filecloud.io/user-login.html') @@ -68,5 +55,5 @@ class FilecloudIo(Account): post=self.form_data, multipart=True) - self.logged_in = True if "you have successfully logged in - filecloud.io" in html else False - self.form_data = {} + if "you have successfully logged in" not in html: + self.wrongPassword() diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index be96d8a52..426d572db 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -1,18 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ import re from time import mktime, strptime @@ -23,15 +9,17 @@ from module.plugins.Account import Account class FilefactoryCom(Account): - __name__ = "FilefactoryCom" - __version__ = "0.14" - __type__ = "account" + __name__ = "FilefactoryCom" + __type__ = "account" + __version__ = "0.15" __description__ = """Filefactory.com account plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<d>\d{1,2})\w{1,2} (?P<m>\w{3}), (?P<y>\d{4})</strong>' + + VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<D>\d{1,2})\w{1,2} (?P<M>\w{3}), (?P<Y>\d{4})</strong>' def loadAccountInfo(self, user, req): @@ -40,7 +28,7 @@ class FilefactoryCom(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: premium = True - validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d> \g<m> \g<y>', m.group(0)) + validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<D> \g<M> \g<Y>', m.group(0)) validuntil = mktime(strptime(validuntil, "%d %b %Y")) else: premium = False @@ -48,13 +36,14 @@ class FilefactoryCom(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") - html = req.load("http://www.filefactory.com/member/signin.php", post={ - "loginEmail": user, - "loginPassword": data['password'], - "Submit": "Sign In"}) + html = req.load("http://www.filefactory.com/member/signin.php", + post={"loginEmail" : user, + "loginPassword": data['password'], + "Submit" : "Sign In"}) if req.lastEffectiveURL != "http://www.filefactory.com/account/": self.wrongPassword() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 7c894e3d6..9f7474207 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from time import mktime, strptime @@ -22,18 +7,19 @@ from module.plugins.Account import Account class FilejungleCom(Account): - __name__ = "FilejungleCom" - __version__ = "0.11" - __type__ = "account" + __name__ = "FilejungleCom" + __type__ = "account" + __version__ = "0.12" __description__ = """Filejungle.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + login_timeout = 60 URL = "http://filejungle.com/" - TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ [A-Za-z]+ \d+)<br' + TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ \w+ \d+)<br' LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' @@ -49,14 +35,16 @@ class FilejungleCom(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): - html = req.load(self.URL + "login.php", post={ - "loginUserName": user, - "loginUserPassword": data['password'], - "loginFormSubmit": "Login", - "recaptcha_challenge_field": "", - "recaptcha_response_field": "", - "recaptcha_shortencode_field": ""}) + html = req.load(self.URL + "login.php", + post={"loginUserName": user, + "loginUserPassword": data['password'], + "loginFormSubmit": "Login", + "recaptcha_challenge_field": "", + "recaptcha_response_field": "", + "recaptcha_shortencode_field": ""}, + decode=True) if re.search(self.LOGIN_FAILED_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py new file mode 100644 index 000000000..7c743f56a --- /dev/null +++ b/module/plugins/accounts/FileomCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class FileomCom(XFSAccount): + __name__ = "FileomCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Fileom.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "fileom.com" diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 0eaa8f452..4067445af 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -1,37 +1,23 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ import re import time from module.plugins.Account import Account -from module.utils import parseFileSize class FilerNet(Account): - __name__ = "FilerNet" - __version__ = "0.01" - __type__ = "account" + __name__ = "FilerNet" + __type__ = "account" + __version__ = "0.04" __description__ = """Filer.net account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' - WALID_UNTIL_PATTERN = r"Der Premium-Zugang ist gültig bis (.+)\.\s*</td>" + 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,21 +29,31 @@ class FilerNet(Account): if re.search(self.FREE_PATTERN, html): return {"premium": False, "validuntil": None, "trafficleft": None} - until = re.search(self.WALID_UNTIL_PATTERN, html) + until = re.search(self.WALID_UNTIL_PATTERN, html) traffic = re.search(self.TRAFFIC_PATTERN, html) + if until and traffic: - validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) - trafficleft = parseFileSize(traffic.group(1)) / 1024 + validuntil = time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S")) + trafficleft = self.parseTraffic(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + else: - self.logError('Unable to retrieve account information - Plugin may be out of date') + self.logError(_("Unable to retrieve account information")) return {"premium": False, "validuntil": None, "trafficleft": None} + def login(self, user, data, req): html = req.load("https://filer.net/login") + token = re.search(self.TOKEN_PATTERN, html).group(1) + html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data['password'], - "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) + post={"_username": user, + "_password": data['password'], + "_remember_me": "on", + "_csrf_token": token, + "_target_path": "https://filer.net/"}, + decode=True) + if 'Logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py index 7288930f4..4c6755293 100644 --- a/module/plugins/accounts/FilerioCom.py +++ b/module/plugins/accounts/FilerioCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class FilerioCom(XFSPAccount): - __name__ = "FilerioCom" - __version__ = "0.01" - __type__ = "account" +class FilerioCom(XFSAccount): + __name__ = "FilerioCom" + __type__ = "account" + __version__ = "0.03" __description__ = """FileRio.in account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - MAIN_PAGE = "http://filerio.in/" + + HOSTER_DOMAIN = "filerio.in" diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index a87aac8a8..15926589e 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -1,42 +1,32 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account class FilesMailRu(Account): - __name__ = "FilesMailRu" - __version__ = "0.1" - __type__ = "account" + __name__ = "FilesMailRu" + __type__ = "account" + __version__ = "0.11" __description__ = """Filesmail.ru account plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): return {"validuntil": None, "trafficleft": None} + def login(self, user, data, req): user, domain = user.split("@") - page = req.load("http://swa.mail.ru/cgi-bin/auth", None, - {"Domain": domain, "Login": user, "Password": data['password'], - "Page": "http://files.mail.ru/"}, cookies=True) + html = req.load("http://swa.mail.ru/cgi-bin/auth", + post={"Domain": domain, + "Login": user, + "Password": data['password'], + "Page": "http://files.mail.ru/"}, + cookies=True, + decode=True) - if "Неверное имя пользователя или пароль" in page: # @TODO seems not to work + if "Неверное имя пользователя или пароль" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index f91f5b703..1cf2a3a3c 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from time import mktime, strptime from module.plugins.Account import Account @@ -22,21 +7,21 @@ from module.common.json_layer import json_loads class FileserveCom(Account): - __name__ = "FileserveCom" - __version__ = "0.2" - __type__ = "account" + __name__ = "FileserveCom" + __type__ = "account" + __version__ = "0.20" __description__ = """Fileserve.com account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], + html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) - res = json_loads(page) + res = json_loads(html) if res['type'] == "premium": validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) @@ -44,15 +29,16 @@ class FileserveCom(Account): else: return {"premium": False, "trafficleft": None, "validuntil": None} + def login(self, user, data, req): - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], + html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) - res = json_loads(page) + res = json_loads(html) if not res['type']: self.wrongPassword() - #login at fileserv page + #login at fileserv html req.load("http://www.fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", "loginFormSubmit": "Login"}) diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index b8a0c33f6..2777a142a 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -1,49 +1,34 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account -from module.common.json_layer import json_loads class FourSharedCom(Account): - __name__ = "FourSharedCom" - __version__ = "0.01" - __type__ = "account" + __name__ = "FourSharedCom" + __type__ = "account" + __version__ = "0.04" __description__ = """FourShared.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): - #fixme - return {"validuntil": -1, "trafficleft": -1, "premium": False} + # Free mode only for now + return {"premium": False} + def login(self, user, data, req): - req.cj.setCookie("www.4shared.com", "4langcookie", "en") - response = req.load('http://www.4shared.com/login', - post={"login": user, - "password": data['password'], - "remember": "false", - "doNotRedirect": "true"}) - self.logDebug(response) - response = json_loads(response) - - if not "ok" in response or response['ok'] != True: - if "rejectReason" in response and response['rejectReason'] != True: - self.logError(response['rejectReason']) + req.cj.setCookie("4shared.com", "4langcookie", "en") + + res = req.load("http://www.4shared.com/web/login", + post={'login' : user, + 'password' : data['password'], + 'remember' : "on", + '_remember': "on", + 'returnTo' : "http://www.4shared.com/account/home.jsp"}, + decode=True) + + if 'Please log in to access your 4shared account' in res: self.wrongPassword() diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 2987b21eb..83f4a9a84 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -1,53 +1,53 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" import re + from time import strptime, mktime from module.plugins.Account import Account class FreakshareCom(Account): - __name__ = "FreakshareCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "FreakshareCom" + __type__ = "account" + __version__ = "0.13" __description__ = """Freakshare.com account plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): - page = req.load("http://freakshare.com/") + premium = False + validuntil = None + trafficleft = None + + html = req.load("http://freakshare.com/") + + 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 = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>" - validuntil = re.search(validuntil, page, re.MULTILINE) - validuntil = validuntil.group(1).strip() - validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M")) + except Exception: + pass - traffic = r"Traffic verbleibend:</td>\s*<td>([^<]+)" - traffic = re.search(traffic, page, re.MULTILINE) - traffic = traffic.group(1).strip() - traffic = self.parseTraffic(traffic) + try: + m = re.search(r'Traffic verbleibend:</td>\s*<td>([^<]+)', html, re.M) + trafficleft = self.parseTraffic(m.group(1)) + + except Exception: + pass + + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} - return {"validuntil": validuntil, "trafficleft": traffic} def login(self, user, data, req): - page = req.load("http://freakshare.com/login.html", None, - {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) + req.load("http://freakshare.com/index.php?language=EN") + + html = req.load("http://freakshare.com/login.html", + post={"submit": "Login", "user": user, "pass": data['password']}, + cookies=True, + decode=True) - if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page: + if ">Wrong Username or Password" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 8a7d46aa1..14b9f1e9a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -1,54 +1,36 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account from module.common.json_layer import json_loads class FreeWayMe(Account): - __name__ = "FreeWayMe" - __version__ = "0.11" - __type__ = "account" + __name__ = "FreeWayMe" + __type__ = "account" + __version__ = "0.13" __description__ = """FreeWayMe account plugin""" - __author_name__ = "Nicolas Giese" - __author_mail__ = "james@free-way.me" + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] def loadAccountInfo(self, user, req): status = self.getAccountStatus(user, req) - if not status: - return False + self.logDebug(status) account_info = {"validuntil": -1, "premium": False} if status['premium'] == "Free": - account_info['trafficleft'] = int(status['guthaben']) * 1024 + account_info['trafficleft'] = self.parseTraffic(status['guthaben'] + "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": - account_info = {"validuntil": int(status['Flatrate']), + account_info = {"validuntil": float(status['Flatrate']), "trafficleft": -1, "premium": True} return account_info - def getpw(self, user): - return self.accounts[user]['password'] def login(self, user, data, req): status = self.getAccountStatus(user, req) @@ -57,11 +39,14 @@ class FreeWayMe(Account): if not status: self.wrongPassword() + def getAccountStatus(self, user, req): answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) - self.logDebug("login: %s" % answer) + get={"id": 4, "user": user, "pass": self.getAccountData(user)['password']}) + + self.logDebug("Login: %s" % answer) + if answer == "Invalid login": self.wrongPassword() - return False + return json_loads(answer) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 5726ad410..66d912958 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -1,39 +1,26 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" +import re from time import mktime, strptime -from pycurl import REFERER -import re from module.plugins.Account import Account class FshareVn(Account): - __name__ = "FshareVn" - __version__ = "0.07" - __type__ = "account" + __name__ = "FshareVn" + __type__ = "account" + __version__ = "0.09" __description__ = """Fshare.vn account plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + 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[^>]*>([0-9.]+) ([kKMG])B</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>' @@ -57,18 +44,20 @@ class FshareVn(Account): return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - html = req.load('https://www.fshare.vn/login.php', post={ - "login_password": data['password'], - "login_useremail": user, - "url_refe": "http://www.fshare.vn/index.php" - }, referer=True, decode=True) + def login(self, user, data, req): + html = req.load("https://www.fshare.vn/login.php", + post={'LoginForm[email]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : "Login"}, + referer=True, + decode=True) if not re.search(r'<img\s+alt="VIP"', html): self.wrongPassword() + def getTrafficLeft(self): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - return float(m.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[m.group(2)] if m else 0 + return self.parseTraffic(m.group(1) + m.group(2)) if m else 0 diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index 93f161bb9..f978d2fa0 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -4,13 +4,14 @@ from module.plugins.Account import Account class Ftp(Account): - __name__ = "Ftp" + __name__ = "Ftp" + __type__ = "account" __version__ = "0.01" - __type__ = "account" __description__ = """Ftp dummy account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - login_timeout = info_threshold = 1000000 + info_threshold = 1000000 + login_timeout = 1000000 diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index d6e65a33e..e559b28e1 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re import time @@ -22,13 +7,14 @@ from module.plugins.Account import Account class HellshareCz(Account): - __name__ = "HellshareCz" - __version__ = "0.14" - __type__ = "account" + __name__ = "HellshareCz" + __type__ = "account" + __version__ = "0.16" __description__ = """Hellshare.cz account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' @@ -55,35 +41,39 @@ class HellshareCz(Account): trafficleft = -1 else: #Traffic-based account - trafficleft = int(credit) * 1024 + trafficleft = self.parseTraffic(credit + "MB") validuntil = -1 except Exception, e: - self.logError('Unable to parse credit info', e) + self.logError(_("Unable to parse credit info"), e) validuntil = -1 trafficleft = -1 return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): - html = req.load('http://www.hellshare.com/') + html = req.load('http://www.hellshare.com/', decode=True) if req.lastEffectiveURL != 'http://www.hellshare.com/': #Switch to English - self.logDebug('Switch lang - URL: %s' % req.lastEffectiveURL) + self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) + json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) - hash = re.search(r"(--[0-9a-f]+-)", json).group(1) - self.logDebug('Switch lang - HASH: %s' % hash) - html = req.load('http://www.hellshare.com/%s/' % hash) + hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) + + self.logDebug("Switch lang - HASH: %s" % hash) + + html = req.load('http://www.hellshare.com/%s/' % hash, decode=True) if re.search(self.CREDIT_LEFT_PATTERN, html): - self.logDebug('Already logged in') + self.logDebug("Already logged in") return - html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ - "login": "Log in", - "password": data['password'], - "username": user, - "perm_login": "on" - }) + html = req.load('http://www.hellshare.com/login?do=loginForm-submit', + post={"login": "Log in", + "password": data['password'], + "username": user, + "perm_login": "on"}, + decode=True) if "<p>You input a wrong user name or wrong password</p>" in html: self.wrongPassword() diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py deleted file mode 100644 index 515517be4..000000000 --- a/module/plugins/accounts/HotfileCom.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - -from time import strptime, mktime -import hashlib - -from module.plugins.Account import Account - - -class HotfileCom(Account): - __name__ = "HotfileCom" - __version__ = "0.2" - __type__ = "account" - - __description__ = """Hotfile.com account plugin""" - __author_name__ = ("mkaay", "JoKoT3") - __author_mail__ = ("mkaay@mkaay.de", "jokot3@gmail.com") - - - def loadAccountInfo(self, user, req): - resp = self.apiCall("getuserinfo", user=user) - if resp.startswith("."): - self.core.debug("HotfileCom API Error: %s" % resp) - raise Exception - info = {} - for p in resp.split("&"): - key, value = p.split("=") - info[key] = value - - if info['is_premium'] == '1': - info['premium_until'] = info['premium_until'].replace("T", " ") - zone = info['premium_until'][19:] - info['premium_until'] = info['premium_until'][:19] - zone = int(zone[:3]) - - validuntil = int(mktime(strptime(info['premium_until'], "%Y-%m-%d %H:%M:%S"))) + (zone * 60 * 60) - tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": True} - - elif info['is_premium'] == '0': - tmp = {"premium": False} - - return tmp - - def apiCall(self, method, post={}, user=None): - if user: - data = self.getAccountData(user) - else: - user, data = self.selectAccount() - - req = self.getAccountRequest(user) - - digest = req.load("http://api.hotfile.com/", post={"action": "getdigest"}) - h = hashlib.md5() - h.update(data['password']) - hp = h.hexdigest() - h = hashlib.md5() - h.update(hp) - h.update(digest) - pwhash = h.hexdigest() - - post.update({"action": method}) - post.update({"username": user, "passwordmd5dig": pwhash, "digest": digest}) - resp = req.load("http://api.hotfile.com/", post=post) - req.close() - return resp - - def login(self, user, data, req): - cj = self.getAccountCookies(user) - cj.setCookie("hotfile.com", "lang", "en") - req.load("http://hotfile.com/", cookies=True) - page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data['password']}, - cookies=True) - - if "Bad username/password" in page: - self.wrongPassword() diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index b79a78c99..07e46eb07 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -4,13 +4,14 @@ from module.plugins.Account import Account class Http(Account): - __name__ = "Http" + __name__ = "Http" + __type__ = "account" __version__ = "0.01" - __type__ = "account" __description__ = """Http dummy account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - login_timeout = info_threshold = 1000000 + info_threshold = 1000000 + login_timeout = 1000000 diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py new file mode 100644 index 000000000..5da3bbc37 --- /dev/null +++ b/module/plugins/accounts/HugefilesNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class HugefilesNet(XFSAccount): + __name__ = "HugefilesNet" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Hugefiles.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "hugefiles.net" diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py new file mode 100644 index 000000000..319a3feee --- /dev/null +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class HundredEightyUploadCom(XFSAccount): + __name__ = "HundredEightyUploadCom" + __type__ = "account" + __version__ = "0.03" + + __description__ = """180upload.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "180upload.com" 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/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py new file mode 100644 index 000000000..b0fc160f3 --- /dev/null +++ b/module/plugins/accounts/JunocloudMe.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class JunocloudMe(XFSAccount): + __name__ = "JunocloudMe" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Junocloud.me account plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "junocloud.me" diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py new file mode 100644 index 000000000..9f28799a2 --- /dev/null +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class Keep2ShareCc(Account): + __name__ = "Keep2ShareCc" + __type__ = "account" + __version__ = "0.05" + + __description__ = """Keep2Share.cc account plugin""" + __license__ = "GPLv3" + __authors__ = [("aeronaut", "aeronaut@pianoguy.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + 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' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = False + + html = req.load("http://keep2share.cc/site/profile.html", decode=True) + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + if expiredate == "LifeTime": + premium = True + validuntil = -1 + else: + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + + except Exception, e: + self.logError(e) + + else: + premium = True if validuntil > mktime(gmtime()) else False + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(m.group(1)) + + except Exception, e: + self.logError(e) + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + + + def login(self, user, data, req): + req.cj.setCookie("keep2share.cc", "lang", "en") + + html = req.load("http://keep2share.cc/login.html", + post={'LoginForm[username]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : ""}, + decode=True) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.wrongPassword() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 3bd096d55..7f973d2d3 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -1,39 +1,25 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ from module.plugins.Account import Account # from module.common.json_layer import json_loads, json_dumps class LetitbitNet(Account): - __name__ = "LetitbitNet" - __version__ = "0.01" - __type__ = "account" + __name__ = "LetitbitNet" + __type__ = "account" + __version__ = "0.02" __description__ = """Letitbit.net account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.accounts[user]['password'] + # api_key = self.getAccountData(user)['password'] # json_data = [api_key, ['key/info']] # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - # self.logDebug('API Key Info: ' + api_rep) + # self.logDebug("API Key Info: " + api_rep) # api_rep = json_loads(api_rep) # # if api_rep['status'] == 'FAIL': @@ -42,6 +28,7 @@ class LetitbitNet(Account): return {"premium": True} + def login(self, user, data, req): # API_KEY is the username and the PREMIUM_KEY is the password - self.logInfo('You must use your API KEY as username and the PREMIUM KEY as password.') + self.logInfo(_("You must use your API KEY as username and the PREMIUM KEY as password")) diff --git a/module/plugins/accounts/LinestorageCom.py b/module/plugins/accounts/LinestorageCom.py new file mode 100644 index 000000000..a48d5beb9 --- /dev/null +++ b/module/plugins/accounts/LinestorageCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class LinestorageCom(XFSAccount): + __name__ = "LinestorageCom" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Linestorage.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "linestorage.com" + HOSTER_URL = "http://linestorage.com/" diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 109478bde..dff28a055 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -7,43 +7,52 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): - __name__ = "LinksnappyCom" - __version__ = "0.02" - __type__ = "account" + __name__ = "LinksnappyCom" + __type__ = "account" + __version__ = "0.04" __description__ = """Linksnappy.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] 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()}) + self.logDebug("JSON data: " + r) + j = json_loads(r) if j['error']: return {"premium": False} validuntil = j['return']['expire'] + if validuntil == 'lifetime': validuntil = -1 + elif validuntil == 'expired': return {"premium": False} + else: validuntil = float(validuntil) if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = int(j['return']['trafficleft']) * 1024 + trafficleft = self.parseTraffic(float(j['return']['trafficleft'] + "MB") return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + def login(self, user, data, req): - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + r = req.load("http://gen.linksnappy.com/lseAPI.php", + get={'act' : 'USERDETAILS', + 'username': user, + 'password': md5(data['password']).hexdigest()}, + decode=True) if 'Invalid Account Details' in r: self.wrongPassword() diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 769b6161b..a082b97af 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -1,31 +1,18 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ from module.plugins.Account import Account from module.common.json_layer import json_loads class MegaDebridEu(Account): - __name__ = "MegaDebridEu" - __version__ = "0.2" - __type__ = "account" + __name__ = "MegaDebridEu" + __type__ = "account" + __version__ = "0.20" __description__ = """mega-debrid.eu account plugin""" - __author_name__ = "D.Ducatel" - __author_mail__ = "dducatel@je-geek.fr" + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + # Define the base URL of MegaDebrid api API_URL = "https://www.mega-debrid.eu/api.php" @@ -35,17 +22,18 @@ class MegaDebridEu(Account): data = self.getAccountData(user) jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - return {"premium": True, "validuntil": float(response['vip_end']), "status": True} + if res['response_code'] == "ok": + return {"premium": True, "validuntil": float(res['vip_end']), "status": True} else: - self.logError(response) + self.logError(res) return {"status": False, "premium": False} + def login(self, user, data, req): jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) - if response['response_code'] != "ok": + res = json_loads(jsonResponse) + if res['response_code'] != "ok": self.wrongPassword() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py new file mode 100644 index 000000000..b229fe47d --- /dev/null +++ b/module/plugins/accounts/MegaRapidCz.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime +from module.plugins.Account import Account + + +class MegaRapidCz(Account): + __name__ = "MegaRapidCz" + __type__ = "account" + __version__ = "0.35" + + __description__ = """MegaRapid.cz account plugin""" + __license__ = "GPLv3" + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + login_timeout = 60 + + LIMITDL_PATTERN = ur'<td>Max. počet paralelních stahování: </td><td>(\d+)' + VALID_UNTIL_PATTERN = ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>' + TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' + + + def loadAccountInfo(self, user, req): + htmll = req.load("http://megarapid.cz/mujucet/", decode=True) + + m = re.search(self.LIMITDL_PATTERN, htmll) + if m: + data = self.getAccountData(user) + data['options']['limitDL'] = [int(m.group(1))] + + m = re.search(self.VALID_UNTIL_PATTERN, htmll) + if m: + validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) + return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + + m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) + if m: + trafficleft = float(m.group(1)) * (1 << 20) + return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} + + return {"premium": False, "trafficleft": None, "validuntil": None} + + + def login(self, user, data, req): + html = req.load("http://megarapid.cz/prihlaseni/", decode=True) + + if "Heslo:" in html: + start = html.index('id="inp_hash" name="hash" value="') + html = html[start + 33:] + hashes = html[0:32] + html = req.load("http://megarapid.cz/prihlaseni/", + post={"hash": hashes, + "login": user, + "pass1": data['password'], + "remember": 0, + "sbmt": u"Přihlásit"}) diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 125a21699..127ebadc8 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -7,13 +7,14 @@ from module.plugins.Account import Account class MegasharesCom(Account): - __name__ = "MegasharesCom" - __version__ = "0.02" - __type__ = "account" + __name__ = "MegasharesCom" + __type__ = "account" + __version__ = "0.03" __description__ = """Megashares.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' @@ -34,13 +35,14 @@ class MegasharesCom(Account): return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + def login(self, user, data, req): - html = req.load('http://d01.megashares.com/myms_login.php', post={ - "httpref": "", - "myms_login": "Login", - "mymslogin_name": user, - "mymspassword": data['password'] - }, decode=True) + html = req.load('http://d01.megashares.com/myms_login.php', + post={"httpref" : "", + "myms_login" : "Login", + "mymslogin_name": user, + "mymspassword" : data['password']}, + decode=True) if not '<span class="b ml">%s</span>' % user in html: self.wrongPassword() diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py index 3ded0d960..6128cddc8 100644 --- a/module/plugins/accounts/MovReelCom.py +++ b/module/plugins/accounts/MovReelCom.py @@ -1,21 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class MovReelCom(XFSPAccount): - __name__ = "MovReelCom" - __version__ = "0.01" - __type__ = "account" +class MovReelCom(XFSAccount): + __name__ = "MovReelCom" + __type__ = "account" + __version__ = "0.03" __description__ = """Movreel.com account plugin""" - __author_name__ = "t4skforce" - __author_mail__ = "t4skforce1337[AT]gmail[DOT]com" + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + login_timeout = 60 info_threshold = 30 - MAIN_PAGE = "http://movreel.com/" - - TRAFFIC_LEFT_PATTERN = r'Traffic.*?<b>([^<]+)</b>' - LOGIN_FAIL_PATTERN = r'<b[^>]*>Incorrect Login or Password</b><br>' + HOSTER_DOMAIN = "movreel.com" diff --git a/module/plugins/accounts/MultiDebridCom.py b/module/plugins/accounts/MultiDebridCom.py deleted file mode 100644 index 405dc60ac..000000000 --- a/module/plugins/accounts/MultiDebridCom.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ - -from time import time - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - - -class MultiDebridCom(Account): - __name__ = "MultiDebridCom" - __version__ = "0.01" - __type__ = "account" - - __description__ = """Multi-debrid.com account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" - - - def loadAccountInfo(self, user, req): - if 'days_left' in self.json_data: - validuntil = int(time() + self.json_data['days_left'] * 24 * 60 * 60) - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} - else: - self.logError('Unable to get account information') - - def login(self, user, data, req): - # Password to use is the API-Password written in http://multi-debrid.com/myaccount - html = req.load("http://multi-debrid.com/api.php", - get={"user": user, "pass": data['password']}) - self.logDebug('JSON data: ' + html) - self.json_data = json_loads(html) - if self.json_data['status'] != 'ok': - self.logError('Invalid login. The password to use is the API-Password you find in your "My Account" page') - self.wrongPassword() diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py new file mode 100644 index 000000000..e98f17b2d --- /dev/null +++ b/module/plugins/accounts/MultihostersCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.accounts.ZeveraCom import ZeveraCom + + +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Multihosters.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] + + + HOSTER_DOMAIN = "multihosters.com" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 3d8852955..0ac764ee1 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -1,37 +1,21 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" +import re from module.plugins.Account import Account -#from time import mktime, strptime -#from pycurl import REFERER -import re -from module.utils import parseFileSize class MultishareCz(Account): - __name__ = "MultishareCz" - __version__ = "0.02" - __type__ = "account" + __name__ = "MultishareCz" + __type__ = "account" + __version__ = "0.05" __description__ = """Multishare.cz account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + - TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[0-9,]+) (?P<U>\w+)</strong>' + 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="([^"]+)">' @@ -40,7 +24,7 @@ class MultishareCz(Account): html = req.load("http://www.multishare.cz/profil/", decode=True) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = parseFileSize(m.group('S'), m.group('U')) / 1024 if m else 0 + trafficleft = self.parseTraffic(m.group('S') + m.group('U')) if m else 0 self.premium = True if trafficleft else False html = req.load("http://www.multishare.cz/", decode=True) @@ -48,12 +32,13 @@ class MultishareCz(Account): return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft}) + def login(self, user, data, req): - html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={ - "akce": "Přihlásit", - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', + post={"akce" : "Přihlásit", + "heslo": data['password'], + "jmeno": user}, + decode=True) if '<div class="akce-chyba akce">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py new file mode 100644 index 000000000..4c75b27f0 --- /dev/null +++ b/module/plugins/accounts/MyfastfileCom.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +from time import time + +from module.common.json_layer import json_loads +from module.plugins.Account import Account + + +class MyfastfileCom(Account): + __name__ = "MyfastfileCom" + __type__ = "account" + __version__ = "0.04" + + __description__ = """Myfastfile.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + + + def loadAccountInfo(self, user, req): + if 'days_left' in self.json_data: + validuntil = time() + self.json_data['days_left'] * 24 * 60 * 60 + return {"premium": True, "validuntil": validuntil, "trafficleft": -1} + else: + self.logError(_("Unable to get account information")) + + + def login(self, user, data, req): + # Password to use is the API-Password written in http://myfastfile.com/myaccount + html = req.load("http://myfastfile.com/api.php", + get={"user": user, "pass": data['password']}) + + self.logDebug("JSON data: " + html) + + self.json_data = json_loads(html) + if self.json_data['status'] != 'ok': + self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) + self.wrongPassword() diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 7c5ea69f8..1abd7fa84 100755..100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from time import time @@ -22,19 +7,20 @@ from module.plugins.Account import Account class NetloadIn(Account): - __name__ = "NetloadIn" - __version__ = "0.22" - __type__ = "account" + __name__ = "NetloadIn" + __type__ = "account" + __version__ = "0.23" __description__ = """Netload.in account plugin""" - __author_name__ = ("RaNaN", "CryNickSystems") - __author_mail__ = ("RaNaN@pyload.org", "webmaster@pcProfil.de") + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("CryNickSystems", "webmaster@pcProfil.de")] def loadAccountInfo(self, user, req): - page = req.load("http://netload.in/index.php?id=2&lang=de") - left = r">(\d+) (Tag|Tage), (\d+) Stunden<" - left = re.search(left, page) + 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 @@ -45,9 +31,14 @@ class NetloadIn(Account): trafficleft = None return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): - page = req.load("http://netload.in/index.php", None, - {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True) - if "password or it might be invalid!" in page: + 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/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py new file mode 100644 index 000000000..a36b114eb --- /dev/null +++ b/module/plugins/accounts/NoPremiumPl.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +from datetime import datetime +import hashlib + +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" + __version__ = "0.01" + __type__ = "account" + __description__ = "NoPremium.pl account plugin" + __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" + } + + _req = None + _usr = None + _pwd = None + + def loadAccountInfo(self, name, req): + self._req = req + try: + result = 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()) + traffic_left = result["balance"] * 1024 + + return ({ + "validuntil": valid_untill, + "trafficleft": traffic_left, + "premium": premium + }) + + def login(self, user, data, req): + self._usr = user + self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest() + self._req = req + + try: + response = 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["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 diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py new file mode 100644 index 000000000..e523ee2f4 --- /dev/null +++ b/module/plugins/accounts/NosuploadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class NosuploadCom(XFSAccount): + __name__ = "NosuploadCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Nosupload.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "nosupload.com" diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py new file mode 100644 index 000000000..ab61bf0fc --- /dev/null +++ b/module/plugins/accounts/NovafileCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class NovafileCom(XFSAccount): + __name__ = "NovafileCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Novafile.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "novafile.com" diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py new file mode 100644 index 000000000..f44ae3865 --- /dev/null +++ b/module/plugins/accounts/NowVideoSx.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class NowVideoSx(Account): + __name__ = "NowVideoSx" + __type__ = "account" + __version__ = "0.03" + + __description__ = """NowVideo.at account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = None + + html = req.load("http://www.nowvideo.sx/premium.php") + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = -1 + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + + + def login(self, user, data, req): + html = req.load("http://www.nowvideo.sx/login.php", + post={'user': user, 'pass': data['password']}, + decode=True) + + if re.search(r'>Log In<', html): + self.wrongPassword() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 97f7e930a..0acacbb2a 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -2,51 +2,64 @@ import time -from module.plugins.Account import Account -from module.lib.beaker.crypto.pbkdf2 import PBKDF2 +from beaker.crypto.pbkdf2 import PBKDF2 + from module.common.json_layer import json_loads +from module.plugins.Account import Account class OboomCom(Account): - __name__ = "OboomCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "OboomCom" + __type__ = "account" + __version__ = "0.23" __description__ = """Oboom.com account plugin""" - __author_name__ = "stanley" - __author_mail__ = "stanley.foerster@gmail.com" + __license__ = "GPLv3" + __authors__ = [("stanley", "stanley.foerster@gmail.com")] def loadAccountData(self, user, req): passwd = self.getAccountData(user)['password'] - salt = passwd[::-1] + salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) - result = json_loads(req.load("https://www.oboom.com/1.0/login", get={"auth": user, "pass": pbkdf2})) + + result = json_loads(req.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2})) + if not result[0] == 200: - self.logWarning("Failed to log in: %s" % result[1]) + self.logWarning(_("Failed to log in: %s") % result[1]) self.wrongPassword() + return result[1] + def loadAccountInfo(self, name, req): accountData = self.loadAccountData(name, req) + userData = accountData['user'] - if "premium_unix" in userData: - validUntilUtc = int(userData['premium_unix']) - if validUntilUtc > int(time.time()): - premium = True - validUntil = validUntilUtc - traffic = userData['traffic'] - trafficLeft = traffic['current'] - maxTraffic = traffic['max'] - session = accountData['session'] - return {"premium": premium, - "validuntil": validUntil, - "trafficleft": trafficLeft / 1024, - "maxtraffic": maxTraffic / 1024, - "session": session - } - return {"premium": False, "validuntil": -1} + if userData['premium'] == "null": + premium = False + else: + premium = True + + if userData['premium_unix'] == "null": + validUntil = -1 + else: + validUntil = float(userData['premium_unix']) + + traffic = userData['traffic'] + + trafficLeft = traffic['current'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + session = accountData['session'] + + return {'premium' : premium, + 'validuntil' : validUntil, + 'trafficleft': trafficLeft, + 'maxtraffic' : maxTraffic, + 'session' : session} + def login(self, user, data, req): self.loadAccountData(user, req) diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index be79423ef..1fc8d994d 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -1,48 +1,60 @@ # -*- coding: utf-8 -*- import re + from time import strptime, mktime + from pycurl import REFERER from module.plugins.Account import Account class OneFichierCom(Account): - __name__ = "OneFichierCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "OneFichierCom" + __type__ = "account" + __version__ = "0.12" __description__ = """1fichier.com account plugin""" - __author_name__ = "Elrick69" - __author_mail__ = "elrick69[AT]rocketmail[DOT]com" + __license__ = "GPLv3" + __authors__ = [("Elrick69", "elrick69[AT]rocketmail[DOT]com"), + ("Walter Purcaro", "vuolter@gmail.com")] - VALID_UNTIL_PATTERN = r'You are a premium user until (?P<d>\d{2})/(?P<m>\d{2})/(?P<y>\d{4})' + + VALID_UNTIL_PATTERN = r'Your Premium Status will end the (\d+/\d+/\d+)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = None - html = req.load("http://1fichier.com/console/abo.pl") + html = req.load("https://1fichier.com/console/abo.pl") m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - premium = True - validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d>/\g<m>/\g<y>', m.group(0)) - validuntil = int(mktime(strptime(validuntil, "%d/%m/%Y"))) - else: - premium = False - validuntil = -1 + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + try: + validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) + except Exception, e: + self.logError(e) + else: + premium = True + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} - def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://1fichier.com/login.pl?lg=en") + def login(self, user, data, req): + req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") - html = req.load("http://1fichier.com/login.pl?lg=en", post={ - "mail": user, - "pass": data['password'], - "Login": "Login"}) + html = req.load("https://1fichier.com/login.pl?lg=en", + post={'mail' : user, + 'pass' : data['password'], + 'It' : "on", + 'purge' : "off", + 'valider': "Send"}, + decode=True) - if r'<div class="error_message">Invalid username or password.</div>' in html: + if '>Invalid email address' in html or '>Invalid password' in html: self.wrongPassword() diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 129074a0f..d59944e63 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -5,30 +5,38 @@ from module.common.json_layer import json_loads class OverLoadMe(Account): - __name__ = "OverLoadMe" - __version__ = "0.01" - __type__ = "account" + __name__ = "OverLoadMe" + __type__ = "account" + __version__ = "0.04" __description__ = """Over-Load.me account plugin""" - __author_name__ = "marley" - __author_mail__ = "marley@over-load.me" + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() - data = json_loads(page) + 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, + 'auth': data['password']}).strip() + + data = json_loads(html) + self.logDebug(data) # Check for premium if data['membership'] == "Free": - return {"premium": False} + return {'premium': False, 'validuntil': None, 'trafficleft': None} + else: + return {'premium': True, 'validuntil': data['expirationunix'], 'trafficleft': -1} - account_info = {"validuntil": data['expirationunix'], "trafficleft": -1} - return account_info def login(self, user, data, req): - jsondata = req.load("https://api.over-load.me/account.php", - get={"user": user, "auth": data['password']}).strip() + 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() + data = json_loads(jsondata) if data['err'] == 1: diff --git a/module/plugins/accounts/Premium4Me.py b/module/plugins/accounts/Premium4Me.py deleted file mode 100644 index 9eab6f81f..000000000 --- a/module/plugins/accounts/Premium4Me.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.Account import Account - - -class Premium4Me(Account): - __name__ = "Premium4Me" - __version__ = "0.03" - __type__ = "account" - - __description__ = """Premium.to account plugin""" - __author_name__ = ("RaNaN", "zoidberg", "stickell") - __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it") - - - def loadAccountInfo(self, user, req): - traffic = req.load("http://premium.to/api/traffic.php?authcode=%s" % self.authcode) - - account_info = {"trafficleft": int(traffic) / 1024, - "validuntil": -1} - - return account_info - - def login(self, user, data, req): - self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % ( - user, data['password'])).strip() - - if "wrong username" in self.authcode: - self.wrongPassword() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py new file mode 100644 index 000000000..c8ea2fa26 --- /dev/null +++ b/module/plugins/accounts/PremiumTo.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + + +class PremiumTo(Account): + __name__ = "PremiumTo" + __type__ = "account" + __version__ = "0.08" + + __description__ = """Premium.to account plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + def loadAccountInfo(self, user, req): + traffic = req.load("http://premium.to/api/straffic.php", + get={'username': self.username, 'password': self.password}) + + if "wrong username" not in traffic: + trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} + else: + return {'premium': False, 'trafficleft': None, 'validuntil': None} + + + def login(self, user, data, req): + self.username = user + self.password = data['password'] + authcode = req.load("http://premium.to/api/getauthcode.php", + get={'username': user, 'password': self.password}, + decode=True) + + if "wrong username" in authcode: + self.wrongPassword() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 83eade048..7d061ec2d 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -6,13 +6,13 @@ from module.common.json_layer import json_loads class PremiumizeMe(Account): - __name__ = "PremiumizeMe" - __version__ = "0.11" - __type__ = "account" + __name__ = "PremiumizeMe" + __type__ = "account" + __version__ = "0.13" __description__ = """Premiumize.me account plugin""" - __author_name__ = "Florian Franzen" - __author_mail__ = "FlorianFranzen@gmail.com" + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] def loadAccountInfo(self, user, req): @@ -22,13 +22,14 @@ class PremiumizeMe(Account): # Parse account info account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} + "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 if status['result']['type'] == 'free': account_info['premium'] = False return account_info + def login(self, user, data, req): # Get user data from premiumize.me status = self.getAccountStatus(user, req) @@ -37,10 +38,12 @@ class PremiumizeMe(Account): if status['status'] != 200: self.wrongPassword() + 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?method=accountstatus¶ms[login]=%s¶ms[pass]=%s" % ( - user, self.accounts[user]['password'])) + answer = req.load("https://api.premiumize.me/pm-api/v1.php", + get={'method' : "accountstatus", + 'params[login]': user, + 'params[pass]' : self.getAccountData(user)['password']}) return json_loads(answer) diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py new file mode 100644 index 000000000..4f2fadbcc --- /dev/null +++ b/module/plugins/accounts/PutdriveCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.accounts.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Putdrive.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "putdrive.com" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 34a3a971a..16141d63e 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -1,41 +1,29 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re + from module.plugins.Account import Account -from module.utils import parseFileSize class QuickshareCz(Account): - __name__ = "QuickshareCz" - __version__ = "0.01" - __type__ = "account" + __name__ = "QuickshareCz" + __type__ = "account" + __version__ = "0.03" __description__ = """Quickshare.cz account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' def loadAccountInfo(self, user, req): html = req.load("http://www.quickshare.cz/premium", decode=True) - m = re.search(r'Stav kreditu: <strong>(.+?)</strong>', html) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: - trafficleft = parseFileSize(m.group(1)) / 1024 + trafficleft = self.parseTraffic(m.group(1)) premium = True if trafficleft else False else: trafficleft = None @@ -43,12 +31,13 @@ class QuickshareCz(Account): return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): - html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={ - "akce": u'Přihlásit', - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', + post={"akce": u'Přihlásit', + "heslo": data['password'], + "jmeno": user}, + decode=True) if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: self.wrongPassword() diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 08bedda7d..829e54a46 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -5,22 +5,22 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): - __name__ = "RPNetBiz" - __version__ = "0.1" - __type__ = "account" + __name__ = "RPNetBiz" + __type__ = "account" + __version__ = "0.12" __description__ = """RPNet.biz account plugin""" - __author_name__ = "Dman" - __author_mail__ = "dmanugm@gmail.com" + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] def loadAccountInfo(self, user, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) try: - if response['accountInfo']['isPremium']: + if res['accountInfo']['isPremium']: # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(response['accountInfo']['premiumExpiry']), + account_info = {"validuntil": float(res['accountInfo']['premiumExpiry']), "trafficleft": -1, "premium": True} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} @@ -31,19 +31,21 @@ class RPNetBiz(Account): return account_info + def login(self, user, data, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) - # If we have an error in the response, we have wrong login information - if 'error' in response: + # If we have an error in the res, we have wrong login information + if 'error' in res: self.wrongPassword() + def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account - response = req.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": self.accounts[user]['password'], + res = req.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, "password": self.getAccountData(user)['password'], "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % response) + self.logDebug("JSON data: %s" % res) - return json_loads(response) + return json_loads(res) diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py new file mode 100644 index 000000000..426c680a6 --- /dev/null +++ b/module/plugins/accounts/RapideoPl.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +from datetime import datetime +import hashlib + +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" + __version__ = "0.01" + __type__ = "account" + __description__ = "Rapideo.pl account plugin" + __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" + } + + _req = None + _usr = None + _pwd = None + + def loadAccountInfo(self, name, req): + self._req = req + try: + result = 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()) + + traffic_left = result["balance"] + + 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 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["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 diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py new file mode 100644 index 000000000..c0dd7eaee --- /dev/null +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class RapidfileshareNet(XFSAccount): + __name__ = "RapidfileshareNet" + __type__ = "account" + __version__ = "0.05" + + __description__ = """Rapidfileshare.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "rapidfileshare.net" + + TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+))?' diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 05d31e6a0..a7aa6ce09 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -1,39 +1,30 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - from module.plugins.Account import Account from module.common.json_layer import json_loads class RapidgatorNet(Account): - __name__ = "RapidgatorNet" - __version__ = "0.04" - __type__ = "account" + __name__ = "RapidgatorNet" + __type__ = "account" + __version__ = "0.07" __description__ = """Rapidgator.net account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + 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') assert sid json = req.load("%s/info?sid=%s" % (self.API_URL, sid)) @@ -44,27 +35,35 @@ class RapidgatorNet(Account): if "reset_in" in json['response']: self.scheduleRefresh(user, json['response']['reset_in']) - return {"validuntil": json['response']['expire_date'], - "trafficleft": int(json['response']['traffic_left']) / 1024, - "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']}) + self.logDebug("API:LOGIN", json) + json = json_loads(json) 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']) + except Exception, e: self.logError(e) diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py deleted file mode 100644 index 6745813d9..000000000 --- a/module/plugins/accounts/RapidshareCom.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - -from module.plugins.Account import Account - - -class RapidshareCom(Account): - __name__ = "RapidshareCom" - __version__ = "0.22" - __type__ = "account" - - __description__ = """Rapidshare.com account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" - api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, - "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src) - fields = src.split("\n") - info = {} - for t in fields: - if not t.strip(): - continue - k, v = t.split("=") - info[k] = v - - validuntil = int(info['billeduntil']) - premium = True if validuntil else False - - tmp = {"premium": premium, "validuntil": validuntil, "trafficleft": -1, "maxtraffic": -1} - - return tmp - - def login(self, user, data, req): - api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" - api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, - "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src + "### Note you have to use your account number for login, instead of name.") - fields = src.split("\n") - info = {} - for t in fields: - if not t.strip(): - continue - k, v = t.split("=") - info[k] = v - cj = self.getAccountCookies(user) - cj.setCookie("rapidshare.com", "enc", info['cookie']) diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py new file mode 100644 index 000000000..8da698c57 --- /dev/null +++ b/module/plugins/accounts/RapiduNet.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +import re + +from time import time + +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class RapiduNet(Account): + __name__ = "RapiduNet" + __type__ = "account" + __version__ = "0.05" + + __description__ = """Rapidu.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("prOq", None), + ("Walter Purcaro", "vuolter@gmail.com")] + + + PREMIUM_PATTERN = r'>Account: <b>Premium' + + VALID_UNTIL_PATTERN = r'>Account: <b>\w+ \((\d+)' + + TRAFFIC_LEFT_PATTERN = r'class="tipsyS"><b>(.+?)<' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = False + + html = req.load("https://rapidu.net/", decode=True) + + if re.search(self.PREMIUM_PATTERN, html): + premium = True + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + validuntil = time() + (86400 * int(m.group(1))) + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = self.parseTraffic(m.group(1)) + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + + + def login(self, user, data, req): + req.load("https://rapidu.net/ajax.php", + get={'a': "getChangeLang"}, + post={'_go' : "", + 'lang': "en"}) + + json = json_loads(req.load("https://rapidu.net/ajax.php", + get={'a': "getUserLogin"}, + post={'_go' : "", + 'login' : user, + 'pass' : data['password'], + 'remember': "1"})) + + self.logDebug(json) + + if not json['message'] == "success": + self.wrongPassword() diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py index 2424eaff5..577a6c8f6 100644 --- a/module/plugins/accounts/RarefileNet.py +++ b/module/plugins/accounts/RarefileNet.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class RarefileNet(XFSPAccount): - __name__ = "RarefileNet" - __version__ = "0.02" - __type__ = "account" +class RarefileNet(XFSAccount): + __name__ = "RarefileNet" + __type__ = "account" + __version__ = "0.04" __description__ = """RareFile.net account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - MAIN_PAGE = "http://rarefile.net/" + + HOSTER_DOMAIN = "rarefile.net" diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 8ca4112e9..41d8a0975 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -6,30 +6,35 @@ from module.plugins.Account import Account class RealdebridCom(Account): - __name__ = "RealdebridCom" - __version__ = "0.43" - __type__ = "account" + __name__ = "RealdebridCom" + __type__ = "account" + __version__ = "0.45" __description__ = """Real-Debrid.com account plugin""" - __author_name__ = "Devirex Hazzard" - __author_mail__ = "naibaf_11@yahoo.de" + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] def loadAccountInfo(self, user, req): if self.pin_code: return {"premium": False} - page = req.load("https://real-debrid.com/api/account.php") - xml = dom.parseString(page) - account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), + html = req.load("https://real-debrid.com/api/account.php") + xml = dom.parseString(html) + account_info = {"validuntil": float(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), "trafficleft": -1} return account_info + def login(self, user, data, req): self.pin_code = False - page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) - if "Your login informations are incorrect" in page: + html = req.load("https://real-debrid.com/ajax/login.php", + get={"user": user, "pass": data['password']}, + decode=True) + + if "Your login informations are incorrect" in html: self.wrongPassword() - elif "PIN Code required" in page: - self.logWarning('PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com.') + + elif "PIN Code required" in html: + self.logWarning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) self.pin_code = True diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 7a6263ab3..04e71c9ad 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -4,34 +4,51 @@ from module.plugins.Account import Account class RehostTo(Account): - __name__ = "RehostTo" - __version__ = "0.1" - __type__ = "account" + __name__ = "RehostTo" + __type__ = "account" + __version__ = "0.16" __description__ = """Rehost.to account plugin""" - __author_name__ = "RaNaN" - __author_mail__ = "RaNaN@pyload.org" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data['password'])) - data = [x.split("=") for x in page.split(",")] - ses = data[0][1] - long_ses = data[1][1] + premium = False + trafficleft = None + validuntil = -1 + session = "" - page = req.load("http://rehost.to/api.php?cmd=get_premium_credits&long_ses=%s" % long_ses) - traffic, valid = page.split(",") + 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] - account_info = {"trafficleft": int(traffic) * 1024, - "validuntil": int(valid), - "long_ses": long_ses, - "ses": ses} + html = req.load("http://rehost.to/api.php", + get={'cmd': "get_premium_credits", 'long_ses': session}) + + if html.strip() == "0,0" or "ERROR" in html: + self.logDebug(html) + else: + traffic, valid = html.split(",") + + premium = True + trafficleft = self.parseTraffic(traffic + "MB") + validuntil = float(valid) + + finally: + return {'premium' : premium, + 'trafficleft': trafficleft, + 'validuntil' : validuntil, + 'session' : session} - return account_info def login(self, user, data, req): - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data['password'])) + html = req.load("http://rehost.to/api.php", + get={'cmd': "login", 'user': user, 'pass': data['password']}, + decode=True) - if "Login failed." in page: + if "ERROR" in html: + self.logDebug(html) self.wrongPassword() diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index fc092f82a..8c56ff20f 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -1,23 +1,16 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class RyushareCom(XFSPAccount): - __name__ = "RyushareCom" - __version__ = "0.03" - __type__ = "account" +class RyushareCom(XFSAccount): + __name__ = "RyushareCom" + __type__ = "account" + __version__ = "0.06" __description__ = """Ryushare.com account plugin""" - __author_name__ = ("zoidberg", "trance4us") - __author_mail__ = ("zoidberg@mujmail.cz", "") + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - MAIN_PAGE = "http://ryushare.com/" - - def login(self, user, data, req): - req.lastURL = "http://ryushare.com/login.python" - html = req.load("http://ryushare.com/login.python", - post={"login": user, "password": data['password'], "op": "login"}) - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() + HOSTER_DOMAIN = "ryushare.com" diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py new file mode 100644 index 000000000..2e58d33b3 --- /dev/null +++ b/module/plugins/accounts/SafesharingEu.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class SafesharingEu(XFSAccount): + __name__ = "SafesharingEu" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Safesharing.eu account plugin""" + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "safesharing.eu" diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py new file mode 100644 index 000000000..b335c94da --- /dev/null +++ b/module/plugins/accounts/SecureUploadEu.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class SecureUploadEu(XFSAccount): + __name__ = "SecureUploadEu" + __type__ = "account" + __version__ = "0.02" + + __description__ = """SecureUpload.eu account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "secureupload.eu" diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py new file mode 100644 index 000000000..4fcbe0b7a --- /dev/null +++ b/module/plugins/accounts/SendmywayCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class SendmywayCom(XFSAccount): + __name__ = "SendmywayCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Sendmyway.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "sendmyway.com" diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py deleted file mode 100644 index a1cb40130..000000000 --- a/module/plugins/accounts/ShareRapidCom.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import mktime, strptime -from module.plugins.Account import Account - - -class ShareRapidCom(Account): - __name__ = "ShareRapidCom" - __version__ = "0.34" - __type__ = "account" - - __description__ = """MegaRapid.cz account plugin""" - __author_name__ = ("MikyWoW", "zoidberg") - __author_mail__ = ("mikywow@seznam.cz", "zoidberg@mujmail.cz") - - login_timeout = 60 - - - def loadAccountInfo(self, user, req): - src = req.load("http://megarapid.cz/mujucet/", decode=True) - - m = re.search(ur'<td>Max. počet paralelních stahování: </td><td>(\d+)', src) - if m: - data = self.getAccountData(user) - data['options']['limitDL'] = [int(m.group(1))] - - m = re.search(ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>', src) - if m: - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) - return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - - m = re.search(r'<tr><td>Kredit</td><td>(.*?) GiB', src) - if m: - trafficleft = float(m.group(1)) * (1 << 20) - return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} - - return {"premium": False, "trafficleft": None, "validuntil": None} - - def login(self, user, data, req): - htm = req.load("http://megarapid.cz/prihlaseni/", cookies=True) - if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start + 33:] - hashes = htm[0:32] - htm = req.load("http://megarapid.cz/prihlaseni/", - post={"hash": hashes, - "login": user, - "pass1": data['password'], - "remember": 0, - "sbmt": u"Přihlásit"}, cookies=True) diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 9f706d186..7e05e2e76 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -1,57 +1,65 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" +import re from module.plugins.Account import Account class ShareonlineBiz(Account): - __name__ = "ShareonlineBiz" - __version__ = "0.24" - __type__ = "account" + __name__ = "ShareonlineBiz" + __type__ = "account" + __version__ = "0.31" __description__ = """Share-online.biz account plugin""" - __author_name__ = ("mkaay", "zoidberg") - __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + def api_response(self, user, req): + return req.load("http://api.share-online.biz/cgi-bin", + get={'q' : "userdetails", + 'aux' : "traffic", + 'username': user, + 'password': self.getAccountData(user)['password']}) - def getUserAPI(self, user, req): - return req.load("http://api.share-online.biz/account.php", - {"username": user, "password": self.accounts[user]['password'], "act": "userDetails"}) def loadAccountInfo(self, user, req): - src = self.getUserAPI(user, req) + premium = False + validuntil = None + trafficleft = -1 + maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB - info = {} - for line in src.splitlines(): + api = {} + for line in self.api_response(user, req).splitlines(): if "=" in line: key, value = line.split("=") - info[key] = value - self.logDebug(info) + api[key] = value + + self.logDebug(api) + + if api['a'].lower() != "not_available": + req.cj.setCookie("share-online.biz", 'a', api['a']) + + premium = api['group'] in ("Premium", "PrePaid") + + validuntil = float(api['expire_date']) + + traffic = float(api['traffic_1d'].split(";")[0]) + maxtraffic = max(maxtraffic, traffic) + trafficleft = maxtraffic - traffic + + maxtraffic /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 - if "dl" in info and info['dl'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info['dl']) - if "a" in info and info['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info['a']) + return {'premium' : premium, + 'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'maxtraffic' : maxtraffic} - return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, - "trafficleft": -1, - "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} def login(self, user, data, req): - src = self.getUserAPI(user, req) - if "EXCEPTION" in src: + html = self.api_response(user, req) + err = re.search(r'\*\*(.+?)\*\*', html) + if err: + self.logError(err.group(1)) self.wrongPassword() diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 6eace8838..8caf600f9 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,59 +1,48 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ from module.common.json_layer import json_loads from module.plugins.Account import Account class SimplyPremiumCom(Account): - __name__ = "SimplyPremiumCom" - __version__ = "0.01" - __type__ = "account" + __name__ = "SimplyPremiumCom" + __type__ = "account" + __version__ = "0.05" __description__ = """Simply-Premium.com account plugin""" - __author_name__ = "EvolutionClip" - __author_mail__ = "evolutionclip@live.de" + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] 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 - #Time package - validuntil = float(json_data['result']['timeend']) - #Traffic package - # {"trafficleft": int(traffic) / 1024, "validuntil": -1} - #trafficleft = int(json_data['result']['traffic'] / 1024) + if 'timeend' in json_data['result'] and json_data['result']['timeend']: + validuntil = float(json_data['result']['timeend']) + + 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": premium, "validuntil": validuntil, "trafficleft": trafficleft} - #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - return {"premium": True, "validuntil": validuntil} 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) + 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 a3803b088..29be2f73d 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -6,28 +6,30 @@ from module.plugins.Account import Account class SimplydebridCom(Account): - __name__ = "SimplydebridCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "SimplydebridCom" + __type__ = "account" + __version__ = "0.11" __description__ = """Simply-Debrid.com account plugin""" - __author_name__ = "Kagenoshin" - __author_mail__ = "kagenoshin@gmx.ch" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] def loadAccountInfo(self, user, req): get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - data = [x.strip() for x in response.split(";")] + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + data = [x.strip() for x in res.split(";")] if str(data[0]) != "1": return {"premium": False} else: return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} + def login(self, user, data, req): self.loginname = user - self.password = data['password'] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - if response != "02: loggin success": + self.password = data['password'] + get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + if res != "02: loggin success": self.wrongPassword() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py new file mode 100644 index 000000000..e6c25752b --- /dev/null +++ b/module/plugins/accounts/SmoozedCom.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import hashlib + +from beaker.crypto.pbkdf2 import PBKDF2 +from time import time + +from module.common.json_layer import json_loads +from module.plugins.Account import Account + + +class SmoozedCom(Account): + __name__ = "SmoozedCom" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Smoozed.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def loadAccountInfo(self, user, req): + # Get user data from premiumize.me + status = self.getAccountStatus(user, req) + + self.logDebug(status) + + if status['state'] != 'ok': + info = {'validuntil' : None, + 'trafficleft': None, + 'premium' : False} + else: + # Parse account info + info = {'validuntil' : float(status["data"]["user"]["user_premium"]), + 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), + 'session' : status["data"]["session_key"], + 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + + if info['validuntil'] < time(): + info['premium'] = False + else: + info['premium'] = True + + return info + + + def login(self, user, data, req): + # Get user data from premiumize.me + status = self.getAccountStatus(user, req) + + # Check if user and password are valid + if status['state'] != 'ok': + self.wrongPassword() + + + def getAccountStatus(self, user, req): + password = self.getAccountData(user)['password'] + salt = hashlib.sha256(password).hexdigest() + encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) + + return json_loads(req.load("http://www2.smoozed.com/api/login", + get={'auth': user, 'password': encrypted})) diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index e22030cdf..882dbd2c3 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -1,49 +1,35 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from module.plugins.Account import Account -from module.utils import parseFileSize class StahnuTo(Account): - __name__ = "StahnuTo" - __version__ = "0.02" - __type__ = "account" + __name__ = "StahnuTo" + __type__ = "account" + __version__ = "0.05" __description__ = """StahnuTo account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): html = req.load("http://www.stahnu.to/") m = re.search(r'>VIP: (\d+.*)<', html) - trafficleft = parseFileSize(m.group(1)) * 1024 if m else 0 + trafficleft = self.parseTraffic(m.group(1)) if m else 0 + + return {"premium": trafficleft > 512, "trafficleft": trafficleft, "validuntil": -1} - return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1} def login(self, user, data, req): - html = req.load("http://www.stahnu.to/login.php", post={ - "username": user, - "password": data['password'], - "submit": "Login"}) + html = req.load("http://www.stahnu.to/login.php", + post={"username": user, + "password": data['password'], + "submit": "Login"}, + decode=True) if not '<a href="logout.php">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py new file mode 100644 index 000000000..aa1eafcbd --- /dev/null +++ b/module/plugins/accounts/StreamcloudEu.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class StreamcloudEu(XFSAccount): + __name__ = "StreamcloudEu" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Streamcloud.eu account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "streamcloud.eu" diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index 7e0f8b8a7..a857649eb 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from time import mktime, strptime @@ -22,19 +7,19 @@ from module.plugins.Account import Account class TurbobitNet(Account): - __name__ = "TurbobitNet" - __version__ = "0.01" - __type__ = "account" + __name__ = "TurbobitNet" + __type__ = "account" + __version__ = "0.02" __description__ = """TurbobitNet account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): html = req.load("http://turbobit.net") - m = re.search(r'<u>Turbo Access</u> to ([0-9.]+)', html) + m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) if m: premium = True validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) @@ -44,13 +29,15 @@ class TurbobitNet(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): req.cj.setCookie("turbobit.net", "user_lang", "en") - html = req.load("http://turbobit.net/user/login", post={ - "user[login]": user, - "user[pass]": data['password'], - "user[submit]": "Login"}) + html = req.load("http://turbobit.net/user/login", + post={"user[login]": user, + "user[pass]": data['password'], + "user[submit]": "Login"}, + decode=True) if not '<div class="menu-item user-name">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py new file mode 100644 index 000000000..279dfd00a --- /dev/null +++ b/module/plugins/accounts/TusfilesNet.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime, gmtime + +from module.plugins.internal.XFSAccount import XFSAccount + + +class TusfilesNet(XFSAccount): + __name__ = "TusfilesNet" + __type__ = "account" + __version__ = "0.06" + + __description__ = """ Tusfile.net account plugin """ + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + + + HOSTER_DOMAIN = "tusfiles.net" + + VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>' + TRAFFIC_LEFT_PATTERN = r'<td><img src="//www\.tusfiles\.net/i/icon/meter\.png" alt=""/></td>\n<td> (?P<S>[\d.,]+)' diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 689ad0a9a..7236a4fa8 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -2,44 +2,49 @@ import re +from urlparse import urljoin + from module.plugins.Account import Account class UlozTo(Account): - __name__ = "UlozTo" - __version__ = "0.06" - __type__ = "account" + __name__ = "UlozTo" + __type__ = "account" + __version__ = "0.10" __description__ = """Uloz.to account plugin""" - __author_name__ = ("zoidberg", "pulpe") - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("pulpe", None)] + - TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit" title="[^"]*?GB = ([0-9.]+) MB"' + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title="[^"]*?GB = ([\d.]+) MB"' def loadAccountInfo(self, user, req): - #this cookie gets lost somehow after each request - self.phpsessid = req.cj.getCookie("ULOSESSID") html = req.load("http://www.ulozto.net/", decode=True) - req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = int(float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048) if m else 0 - self.premium = True if trafficleft else False - return {"validuntil": -1, "trafficleft": trafficleft} + trafficleft = float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048 if m else 0 + premium = True if trafficleft else False + + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} + def login(self, user, data, req): login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True) - action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') - token = re.search('_token_" value="(.+?)"', login_page).group(1) - - html = req.load('http://www.ulozto.net'+action, post={ - "_token_": token, - "login": "Submit", - "password": data['password'], - "username": user - }, decode=True) + 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), + post={'_token_' : token, + 'do' : "loginForm-submit", + 'login' : u"Přihlásit", + 'password': data['password'], + 'username': user, + 'remember': "on"}, + decode=True) if '<div class="flash error">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index 94452b966..6a8187234 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -1,31 +1,17 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) 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 Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -############################################################################ from module.plugins.Account import Account from module.common.json_layer import json_loads class UnrestrictLi(Account): - __name__ = "UnrestrictLi" - __version__ = "0.03" - __type__ = "account" + __name__ = "UnrestrictLi" + __type__ = "account" + __version__ = "0.05" __description__ = """Unrestrict.li account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): @@ -37,21 +23,22 @@ class UnrestrictLi(Account): return {"premium": False} validuntil = json_data['result']['expires'] - trafficleft = int(json_data['result']['traffic'] / 1024) + 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") + 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") + 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) + 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/UploadableCh.py b/module/plugins/accounts/UploadableCh.py new file mode 100644 index 000000000..86ae5dd17 --- /dev/null +++ b/module/plugins/accounts/UploadableCh.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + + +class UploadableCh(Account): + __name__ = "UploadableCh" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Uploadable.ch account plugin""" + __license__ = "GPLv3" + __authors__ = [("Sasch", "gsasch@gmail.com")] + + + def loadAccountInfo(self, user, req): + html = req.load("http://www.uploadable.ch/login.php") + + premium = '<a href="/logout.php"' in html + trafficleft = -1 if premium else None + + return {'validuntil': None, 'trafficleft': trafficleft, 'premium': premium} #@TODO: validuntil + + + def login(self, user, data, req): + html = req.load("http://www.uploadable.ch/login.php", + post={'userName' : user, + 'userPassword' : data["password"], + 'autoLogin' : "1", + 'action__login': "normalLogin"}, + decode=True) + + if "Login failed" in html: + self.wrongPassword() diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py new file mode 100644 index 000000000..d1e1a2ead --- /dev/null +++ b/module/plugins/accounts/UploadcCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class UploadcCom(XFSAccount): + __name__ = "UploadcCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Uploadc.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "uploadc.com" diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index bde76be9f..1b6df97fb 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from time import time @@ -22,47 +7,63 @@ from module.plugins.Account import Account class UploadedTo(Account): - __name__ = "UploadedTo" - __version__ = "0.26" - __type__ = "account" + __name__ = "UploadedTo" + __type__ = "account" + __version__ = "0.30" __description__ = """Uploaded.to account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + PREMIUM_PATTERN = r'<em>Premium</em>' + VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>(.+?)<' + TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None - req.load("http://uploaded.net/language/en") html = req.load("http://uploaded.net/me") - premium = '<a href="register"><em>Premium</em>' in html or '<em>Premium</em></th>' in html + premium = True if re.search(self.PREMIUM_PATTERN, html) else False - if premium: - raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1).replace('.', '') - raw_valid = re.search(r"<td>Duration:</td>\s*<th>([^<]+)", html, re.MULTILINE).group(1).strip() + m = re.search(self.VALID_UNTIL_PATTERN, html, re.M) + if m: + expiredate = m.group(1).lower().strip() - traffic = int(self.parseTraffic(raw_traffic)) - - if raw_valid == "unlimited": + if expiredate == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"(\d+) (Week|weeks|days|day|hours|hour)", raw_valid) - validuntil = time() - for n, u in raw_valid: - validuntil += int(n) * 60 * 60 * {"Week": 168, "weeks": 168, "days": 24, - "day": 24, "hours": 1, "hour": 1}[u] + m = re.findall(r'(\d+) (week|day|hour)', expiredate) + if m: + validuntil = time() + for n, u in m: + validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u] + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + traffic = m.groupdict() + size = traffic['S'].replace('.', '') + unit = traffic['U'].lower() + + if unit.startswith('t'): #@NOTE: Remove in 0.4.10 + trafficleft = float(size.replace(',', '.')) / 1024 + trafficleft *= 1 << 40 + else: + trafficleft = self.parseTraffic(size + unit) - return {"validuntil": validuntil, "trafficleft": traffic, "maxtraffic": 50 * 1024 * 1024} - else: - return {"premium": False, "validuntil": -1} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - req.load("http://uploaded.net/language/en") - req.cj.setCookie("uploaded.net", "lang", "en") + def login(self, user, data, req): + # req.cj.setCookie("uploaded.net", "lang", "en") - page = req.load("http://uploaded.net/io/login", post={"id": user, "pw": data['password'], "_": ""}) + html = req.load("http://uploaded.net/io/login", + post={'id': user, 'pw': data['password'], '_': ""}, + decode=True) - if "User and password do not match!" in page: + if '"err"' in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 681ef6f6a..714f5b0a6 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -8,23 +8,23 @@ from module.plugins.Account import Account class UploadheroCom(Account): - __name__ = "UploadheroCom" - __version__ = "0.2" - __type__ = "account" + __name__ = "UploadheroCom" + __type__ = "account" + __version__ = "0.21" __description__ = """Uploadhero.co account plugin""" - __author_name__ = "mcmyst" - __author_mail__ = "mcmyst@hotmail.fr" + __license__ = "GPLv3" + __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] def loadAccountInfo(self, user, req): - premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.') + premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') data = self.getAccountData(user) - page = req.load("http://uploadhero.co/my-account") + html = req.load("http://uploadhero.co/my-account") - if premium_pattern.search(page): - end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1))) + if premium_pattern.search(html): + end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(html).group(1))) end_date = time.mktime(future.timetuple()) account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True} else: @@ -32,9 +32,11 @@ class UploadheroCom(Account): return account_info + def login(self, user, data, req): - page = req.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, "password_login": data['password']}) + html = req.load("http://uploadhero.co/lib/connexion.php", + post={"pseudo_login": user, "password_login": data['password']}, + decode=True) - if "mot de passe invalide" in page: + if "mot de passe invalide" in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index f07c2941a..c70d2ec11 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -1,55 +1,63 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" +import re from time import time, strptime, mktime -import re from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import set_cookies class UploadingCom(Account): - __name__ = "UploadingCom" - __version__ = "0.1" - __type__ = "account" + __name__ = "UploadingCom" + __type__ = "account" + __version__ = "0.11" __description__ = """Uploading.com account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] + + + PREMIUM_PATTERN = r'UPGRADE TO PREMIUM' + VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' def loadAccountInfo(self, user, req): - src = req.load("http://uploading.com/") - premium = True - if "UPGRADE TO PREMIUM" in src: - return {"validuntil": -1, "trafficleft": -1, "premium": False} + validuntil = None + trafficleft = None + premium = None + + html = req.load("http://uploading.com/") - m = re.search("Valid Until:(.*?)<", src) + premium = False if re.search(self.PREMIUM_PATTERN, html) else True + + m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - validuntil = int(mktime(strptime(m.group(1).strip(), "%b %d, %Y"))) - else: - validuntil = -1 + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%b %d, %Y")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - return {"validuntil": validuntil, "trafficleft": -1, "premium": True} def login(self, user, data, req): - req.cj.setCookie("uploading.com", "lang", "1") - req.cj.setCookie("uploading.com", "language", "1") - req.cj.setCookie("uploading.com", "setlang", "en") - req.cj.setCookie("uploading.com", "_lang", "en") + set_cookies([("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), - post={"email": user, "password": data['password'], "remember": "on"}) + post={'email': user, 'password': data['password'], 'remember': "on"}) diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index 16016f41d..299a0acc2 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class UptoboxCom(XFSPAccount): - __name__ = "UptoboxCom" - __version__ = "0.02" - __type__ = "account" +class UptoboxCom(XFSAccount): + __name__ = "UptoboxCom" + __type__ = "account" + __version__ = "0.07" __description__ = """DDLStorage.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - MAIN_PAGE = "http://uptobox.com/" - VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire: ([^<]+)</strong>' + HOSTER_DOMAIN = "uptobox.com" + HOSTER_URL = "https://uptobox.com/" diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py new file mode 100644 index 000000000..5bfc24963 --- /dev/null +++ b/module/plugins/accounts/VidPlayNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class VidPlayNet(XFSAccount): + __name__ = "VidPlayNet" + __type__ = "account" + __version__ = "0.02" + + __description__ = """VidPlay.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "vidplay.net" diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py new file mode 100644 index 000000000..f8e3eeb73 --- /dev/null +++ b/module/plugins/accounts/WebshareCz.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +import re + +from hashlib import md5, sha1 +from passlib.hash import md5_crypt +from time import mktime, strptime, time + +from module.plugins.Account import Account + + +class WebshareCz(Account): + __name__ = "WebshareCz" + __type__ = "account" + __version__ = "0.07" + + __description__ = """Webshare.cz account plugin""" + __license__ = "GPLv3" + __authors__ = [("rush", "radek.senfeld@gmail.com")] + + + VALID_UNTIL_PATTERN = r'<vip_until>(.+)</vip_until>' + + TRAFFIC_LEFT_PATTERN = r'<bytes>(.+)</bytes>' + + + def loadAccountInfo(self, user, req): + html = req.load("https://webshare.cz/api/user_data/", + post={'wst': self.infos['wst']}, + decode=True) + + self.logDebug("Response: " + html) + + 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")) + trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + premium = validuntil > time() + + return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} + + + def login(self, user, data, req): + salt = req.load("https://webshare.cz/api/salt/", + post={'username_or_email': user, + 'wst' : ""}, + decode=True) + + if "<status>OK</status>" not in salt: + 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() + + login = req.load("https://webshare.cz/api/login/", + post={'digest' : digest, + 'keep_logged_in' : 1, + 'password' : password, + 'username_or_email': user, + 'wst' : ""}, + decode=True) + + if "<status>OK</status>" not in login: + self.wrongPassword() + + self.infos['wst'] = re.search('<token>(.+)</token>', login).group(1) diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py new file mode 100644 index 000000000..8dc7f3a30 --- /dev/null +++ b/module/plugins/accounts/XFileSharingPro.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class XFileSharingPro(XFSAccount): + __name__ = "XFileSharingPro" + __type__ = "account" + __version__ = "0.06" + + __description__ = """XFileSharingPro multi-purpose account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = None + + + def init(self): + if self.HOSTER_DOMAIN: + return super(XFileSharingPro, self).init() + + + def loadAccountInfo(self, user, req): + return super(XFileSharingPro if self.HOSTER_DOMAIN else XFSAccount, self).loadAccountInfo(user, req) + + + def login(self, user, data, req): + if self.HOSTER_DOMAIN: + try: + return super(XFileSharingPro, self).login(user, data, req) + except Exception: + self.HOSTER_URL = self.HOSTER_URL.replace("www.", "") + return super(XFileSharingPro, self).login(user, data, req) diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 1894258a3..863588495 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -1,33 +1,19 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) 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 this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re from module.plugins.Account import Account class YibaishiwuCom(Account): - __name__ = "YibaishiwuCom" - __version__ = "0.01" - __type__ = "account" + __name__ = "YibaishiwuCom" + __type__ = "account" + __version__ = "0.02" __description__ = """115.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' @@ -41,13 +27,14 @@ class YibaishiwuCom(Account): validuntil = trafficleft = (-1 if m else 0) return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + def login(self, user, data, req): - html = req.load('http://passport.115.com/?ac=login', post={ - "back": "http://www.115.com/", - "goto": "http://115.com/", - "login[account]": user, - "login[passwd]": data['password'] - }, decode=True) + html = req.load("http://passport.115.com/?ac=login", + post={"back": "http://www.115.com/", + "goto": "http://115.com/", + "login[account]": user, + "login[passwd]": data['password']}, + decode=True) if not 'var USER_PERMISSION = {' in html: self.wrongPassword() diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 11a224039..15b6d9379 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -6,49 +6,73 @@ from module.plugins.Account import Account class ZeveraCom(Account): - __name__ = "ZeveraCom" - __version__ = "0.21" - __type__ = "account" + __name__ = "ZeveraCom" + __type__ = "account" + __version__ = "0.25" __description__ = """Zevera.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "zevera.com" + + + def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 + self.init() + return super(ZeveraCom, self).__init__(manager, accounts) + + + def init(self): + if not self.HOSTER_DOMAIN: + self.logError(_("Missing HOSTER_DOMAIN")) + + if not hasattr(self, "API_URL"): + self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") def loadAccountInfo(self, user, req): - data = self.getAPIData(req) - if data == "No traffic": - account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} - else: - account_info = { - "trafficleft": int(data['availabletodaytraffic']) * 1024, - "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), - "premium": True - } - return account_info + validuntil = None + trafficleft = None + premium = False + + api = self.api_response(req) + + if "No trafic" not in api or "Expired" not in api: + validuntil = mktime(strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) + trafficleft = float(api['availabletodaytraffic']) * 1024 if api['orondaytrafficlimit'] != '0' else -1 + premium = True + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + def login(self, user, data, req): - self.loginname = user + self.user = user self.password = data['password'] - if self.getAPIData(req) == "No traffic": + + if self.api_response(req) == "No trafic": self.wrongPassword() - def getAPIData(self, req, just_header=False, **kwargs): - get_data = { - 'cmd': 'accountinfo', - 'login': self.loginname, - 'pass': self.password - } + + def api_response(self, req, just_header=False, **kwargs): + get_data = {'cmd' : "accountinfo", + 'login': self.user, + 'pass' : self.password} + get_data.update(kwargs) - response = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, - decode=True, just_header=just_header) - self.logDebug(response) + res = req.load(self.API_URL, + get=get_data, + just_header=just_header, + decode=True) + + self.logDebug(res) - if ':' in response: + if ':' in res: if not just_header: - response = response.replace(',', '\n') + res = res.replace(',', '\n') return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in response.splitlines() if ':' in x]) + [x.split(':', 1) for x in res.splitlines() if ':' in x]) else: - return response + return res |