summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter
diff options
context:
space:
mode:
authorGravatar AndroKev <neureither.kevin@gmail.com> 2014-10-18 18:58:28 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-18 18:58:28 +0200
commit089c1341de6ec7fa3a6cfc30fbf24cbef02cbfce (patch)
tree71dfe87a917bc94d3fc7d18c00ba0319198ff203 /module/plugins/crypter
parent[RapidgatorNet] Fix process routine (diff)
downloadpyload-089c1341de6ec7fa3a6cfc30fbf24cbef02cbfce.tar.xz
[RelinkUs] Fix regex errors and str conversion
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r--module/plugins/crypter/RelinkUs.py45
1 files changed, 33 insertions, 12 deletions
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index d99b7fb1a..dc97fca74 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -12,37 +12,42 @@ from module.plugins.Crypter import Crypter
class RelinkUs(Crypter):
__name__ = "RelinkUs"
__type__ = "crypter"
- __version__ = "3.0"
+ __version__ = "3.1"
__pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<id>.+)'
__description__ = """Relink.us decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")]
+ __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"),
+ ("AndroKev", "neureither.kevin@gmail.com")]
- # Constants
PREFERRED_LINK_SOURCES = ["cnl2", "dlc", "web"]
OFFLINE_TOKEN = r'<title>Tattooside'
- PASSWORD_TOKEN = r'container_password\.php'
+
+ PASSWORD_TOKEN = r'container_password.php'
PASSWORD_ERROR_ROKEN = r'You have entered an incorrect password'
- PASSWORD_SUBMIT_URL = r'http://www\.relink\.us/container_password\.php'
- CAPTCHA_TOKEN = r'container_captcha\.php'
+ PASSWORD_SUBMIT_URL = r'http://www.relink.us/container_password.php'
+
+ CAPTCHA_TOKEN = r'container_captcha.php'
CAPTCHA_ERROR_ROKEN = r'You have solved the captcha wrong'
- CAPTCHA_IMG_URL = r'http://www\.relink\.us/core/captcha/circlecaptcha\.php'
- CAPTCHA_SUBMIT_URL = r'http://www\.relink\.us/container_captcha\.php'
- FILE_TITLE_REGEX = r'<th>Title</th><td><i>(.*)</i></td></tr>'
+ CAPTCHA_IMG_URL = r'http://www.relink.us/core/captcha/circlecaptcha.php'
+ CAPTCHA_SUBMIT_URL = r'http://www.relink.us/container_captcha.php'
+
+ FILE_TITLE_REGEX = r'<th>Title</th><td>(.*)</td></tr>'
FILE_NOTITLE = r'No title'
CNL2_FORM_REGEX = r'<form id="cnl_form-(.*?)</form>'
CNL2_FORMINPUT_REGEX = r'<input.*?name="%s".*?value="(.*?)"'
CNL2_JK_KEY = "jk"
CNL2_CRYPTED_KEY = "crypted"
+
DLC_LINK_REGEX = r'<a href=".*?" class="dlc_button" target="_blank">'
- DLC_DOWNLOAD_URL = r'http://www\.relink\.us/download\.php'
+ DLC_DOWNLOAD_URL = r'http://www.relink.us/download.php'
+
WEB_FORWARD_REGEX = r'getFile\(\'(?P<link>.+)\'\)'
- WEB_FORWARD_URL = r'http://www\.relink\.us/frame\.php'
+ WEB_FORWARD_URL = r'http://www.relink.us/frame.php'
WEB_LINK_REGEX = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(?P<link>.+)"></iframe>'
@@ -53,6 +58,7 @@ class RelinkUs(Crypter):
self.html = None
self.captcha = False
+
def decrypt(self, pyfile):
# Init
self.initPackage(pyfile)
@@ -91,46 +97,54 @@ class RelinkUs(Crypter):
else:
self.fail('Could not extract any links')
+
def initPackage(self, pyfile):
self.fileid = re.match(self.__pattern__, pyfile.url).group('id')
self.package = pyfile.package()
self.password = self.getPassword()
+
def requestPackage(self):
self.html = self.load(self.pyfile.url, decode=True)
+
def isOnline(self):
if self.OFFLINE_TOKEN in self.html:
self.logDebug("File not found")
return False
return True
+
def isPasswordProtected(self):
if self.PASSWORD_TOKEN in self.html:
self.logDebug("Links are password protected")
return True
+
def isCaptchaProtected(self):
if self.CAPTCHA_TOKEN in self.html:
self.logDebug("Links are captcha protected")
return True
return False
+
def unlockPasswordProtection(self):
self.logDebug("Submitting password [%s] for protected links" % self.password)
passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid
passwd_data = {'id': self.fileid, 'password': self.password, 'pw': 'submit'}
self.html = self.load(passwd_url, post=passwd_data, decode=True)
+
def unlockCaptchaProtection(self):
self.logDebug("Request user positional captcha resolving")
captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid
coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional')
- self.logDebug("Captcha resolved, coords [%s]" % coords)
+ self.logDebug("Captcha resolved, coords [%s]" % str(coords))
captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid
captcha_post_data = {'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit'}
self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True)
+
def getPackageInfo(self):
name = folder = None
@@ -151,6 +165,7 @@ class RelinkUs(Crypter):
# Return package info
return name, folder
+
def handleErrors(self):
if self.PASSWORD_ERROR_ROKEN in self.html:
msg = "Incorrect password, please set right password on 'Edit package' form and retry"
@@ -165,6 +180,7 @@ class RelinkUs(Crypter):
else:
self.correctCaptcha()
+
def handleLinkSource(self, source):
if source == 'cnl2':
return self.handleCNL2Links()
@@ -175,6 +191,7 @@ class RelinkUs(Crypter):
else:
self.fail('Unknown source [%s] (this is probably a bug)' % source)
+
def handleCNL2Links(self):
self.logDebug("Search for CNL2 links")
package_links = []
@@ -189,6 +206,7 @@ class RelinkUs(Crypter):
self.logDebug("Unable to decrypt CNL2 links")
return package_links
+
def handleDLCLinks(self):
self.logDebug("Search for DLC links")
package_links = []
@@ -208,6 +226,7 @@ class RelinkUs(Crypter):
self.logDebug("Unable to download DLC container")
return package_links
+
def handleWEBLinks(self):
self.logDebug("Search for WEB links")
package_links = []
@@ -226,6 +245,7 @@ class RelinkUs(Crypter):
self.wait()
return package_links
+
def _getCipherParams(self, cnl2_form):
# Get jk
jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY
@@ -239,6 +259,7 @@ class RelinkUs(Crypter):
self.logDebug("Detected %d crypted blocks" % len(vcrypted))
return vcrypted, vjk
+
def _getLinks(self, crypted, jk):
# Get key
jreturn = self.js.eval("%s f()" % jk)