summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/Vipleech4uCom.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/module/plugins/accounts/Vipleech4uCom.py b/module/plugins/accounts/Vipleech4uCom.py
new file mode 100644
index 000000000..1e8463456
--- /dev/null
+++ b/module/plugins/accounts/Vipleech4uCom.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class Vipleech4uCom(Account):
+ __name__ = "Vipleech4uCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Vipleech4u.com account plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ STATUS_PATTERN = re.compile(r'status.*?<\s*?strong\s*?>[^<]*?vip[^<]*?<', re.I)
+ VALIDUNTIL_PATTERN = re.compile(r'valid\s*?until.*?<\s*?strong\s*?>([^<]*?)<', re.I)
+
+ def loadAccountInfo(self, user, req):
+ response = req.load("http://vipleech4u.com", decode=True)
+ status = self.STATUS_PATTERN.search(response)
+
+ validuntil = self.VALIDUNTIL_PATTERN.search(response)
+ if validuntil:
+ validuntil = validuntil.group(1)
+
+ if status and validuntil:
+ print status
+ print validuntil
+ return {"trafficleft": -1, "validuntil": mktime(strptime("%s 23:59" % validuntil, "%d-%m-%Y %H:%M"))}
+ else:
+ return {"premium": False}
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ post_data = {'action': 'login', 'user': self.loginname, 'pass': self.password}
+ req.load("http://vipleech4u.com/login.php")
+ response = req.load("http://vipleech4u.com/login.php", post=post_data, decode=True)
+ if 'Username or Password are incorrect' in response:
+ self.wrongPassword()