summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/HellspyCz.py39
-rw-r--r--module/plugins/accounts/ShareRapidCom.py36
2 files changed, 54 insertions, 21 deletions
diff --git a/module/plugins/accounts/HellspyCz.py b/module/plugins/accounts/HellspyCz.py
index 10c7e3882..c07fd748a 100644
--- a/module/plugins/accounts/HellspyCz.py
+++ b/module/plugins/accounts/HellspyCz.py
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
+
@author: zoidberg
"""
@@ -28,55 +28,52 @@ class HellspyCz(Account):
__description__ = """hellspy.cz account plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
ACTION_PATTERN = r'<div id="snippet--loginBoxSn"><form[^>]*action="([^"]+user_hash=([^"]+))">'
CREDIT_LEFT_PATTERN = r'<strong class="text-credits">(\d+)</strong>'
WRONG_PASSWORD_PATTERN = r'<p class="block-error-3 marg-tb-050">\s*Wrong user or password was entered<br />'
- phpsessid = ''
+ phpsessid = ''
def loadAccountInfo(self, user, req):
cj = self.getAccountCookies(user)
- cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
-
+ cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
+
html = req.load("http://www.hellspy.com/")
-
+
found = re.search(self.CREDIT_LEFT_PATTERN, html)
if found is None:
credits = 0
else:
credits = int(found.group(1)) * 1024
-
+
return {"validuntil": -1, "trafficleft": credits}
-
- def login(self, user, data,req):
+
+ def login(self, user, data,req):
html = req.load('http://www.hellspy.com/')
found = re.search(self.ACTION_PATTERN, html)
if found is None:
- self.logError('Parse error (FORM)')
+ self.logError('Parse error (FORM)')
action, self.phpsessid = found.group(1).replace('&amp;','&'), found.group(2)
-
+
self.logDebug("PHPSESSID:" + self.phpsessid)
html = req.load("http://www.hellspy.com/--%s-" % self.phpsessid)
-
+
html = req.load(action, post={
"login": "1",
"password": data["password"],
"username": user,
"redir_url": 'http://www.hellspy.com/?do=loginBox-login',
"permanent_login": "1"
- })
-
+ })
+
cj = self.getAccountCookies(user)
cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
-
+
self.logDebug(req.lastURL)
self.logDebug(req.lastEffectiveURL)
-
- html = req.load("http://www.hellspy.com/", get = {"do":"loginBox-login"})
-
- if not re.search(self.CREDIT_LEFT_PATTERN, html):
- self.wrongPassword()
+ html = req.load("http://www.hellspy.com/", get = {"do":"loginBox-login"})
- \ No newline at end of file
+ if not re.search(self.CREDIT_LEFT_PATTERN, html):
+ self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py
new file mode 100644
index 000000000..9828b1f7e
--- /dev/null
+++ b/module/plugins/accounts/ShareRapidCom.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Account import Account
+
+class ShareRapidCom(Account):
+ __name__ = "ShareRapidCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """ShareRapid account plugin"""
+ __author_name__ = ("MikyWoW")
+
+ def loadAccountInfo(self, user, req):
+ src = req.load("http://share-rapid.com/mujucet/", cookies=True)
+ if "Kredit:" in src:
+ start = src.index('Kredit:</td><td>')
+ src = src[start+16:]
+ start = src.index('GB')
+ kredit = src[0:start-1]
+ ret = float(kredit)*1024*1024
+ tmp = {"premium": True, "trafficleft": ret, "validuntil": -1}
+ else:
+ tmp = {"premium": False, "trafficleft": None, "validuntil": None}
+ return tmp
+
+ def login(self, user, data, req):
+ htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True)
+ if "Heslo:" in htm:
+ start = htm.index('id="inp_hash" name="hash" value="')
+ htm = htm[start+33:]
+ hashes = htm[0:32]
+ html = req.load("http://share-rapid.com/prihlaseni/",
+ post={"hash": hashes,"login": user, "pass1": data["password"],"remember": 0,
+ "sbmt": "P%C5%99ihl%C3%A1sit"}, cookies=True)
+ if "Heslo:" in html:
+ self.wrongPassword() \ No newline at end of file