summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/ShareLinksBiz.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-18 19:09:49 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-18 19:09:49 +0200
commit477120dfa8090f808ce17267896456c082714203 (patch)
tree6ad8d52bf354490a57d1890de3a78e37b2001f30 /module/plugins/crypter/ShareLinksBiz.py
parent[RelinkUs] Fix regex errors and str conversion (diff)
downloadpyload-477120dfa8090f808ce17267896456c082714203.tar.xz
Fixed logging issue with coords values
Diffstat (limited to 'module/plugins/crypter/ShareLinksBiz.py')
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index 9d4cfbb43..6e187ed6f 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -11,7 +11,7 @@ from module.plugins.Crypter import Crypter
class ShareLinksBiz(Crypter):
__name__ = "ShareLinksBiz"
__type__ = "crypter"
- __version__ = "1.13"
+ __version__ = "1.14"
__pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)'
@@ -27,6 +27,7 @@ class ShareLinksBiz(Crypter):
self.html = None
self.captcha = False
+
def decrypt(self, pyfile):
# Init
self.initFile(pyfile)
@@ -61,6 +62,7 @@ class ShareLinksBiz(Crypter):
# Pack
self.packages = [(package_name, package_links, package_folder)]
+
def initFile(self, pyfile):
url = pyfile.url
if 's2l.biz' in url:
@@ -69,29 +71,34 @@ class ShareLinksBiz(Crypter):
self.fileId = re.match(self.__pattern__, url).group('ID')
self.package = pyfile.package()
+
def isOnline(self):
if "No usable content was found" in self.html:
self.logDebug("File not found")
return False
return True
+
def isPasswordProtected(self):
if re.search(r'''<form.*?id="passwordForm".*?>''', self.html):
self.logDebug("Links are protected")
return True
return False
+
def isCaptchaProtected(self):
if '<map id="captchamap"' in self.html:
self.logDebug("Links are captcha protected")
return True
return False
+
def unblockServer(self):
imgs = re.findall(r"(/template/images/.*?\.gif)", self.html)
for img in imgs:
self.load(self.baseUrl + img)
+
def unlockPasswordProtection(self):
password = self.getPassword()
self.logDebug("Submitting password [%s] for protected links" % password)
@@ -99,6 +106,7 @@ class ShareLinksBiz(Crypter):
url = self.baseUrl + '/' + self.fileId
self.html = self.load(url, post=post, decode=True)
+
def unlockCaptchaProtection(self):
# Get captcha map
captchaMap = self._getCaptchaMap()
@@ -109,7 +117,7 @@ class ShareLinksBiz(Crypter):
captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2))
self.logDebug("Waiting user for correct position")
coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional')
- self.logDebug("Captcha resolved, coords [%s]" % coords)
+ self.logDebug("Captcha resolved, coords [%s]" % str(coords))
# Resolve captcha
href = self._resolveCoords(coords, captchaMap)
@@ -122,6 +130,7 @@ class ShareLinksBiz(Crypter):
url = self.baseUrl + href
self.html = self.load(url, decode=True)
+
def _getCaptchaMap(self):
mapp = {}
for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html):
@@ -130,6 +139,7 @@ class ShareLinksBiz(Crypter):
mapp[rect] = href
return mapp
+
def _resolveCoords(self, coords, captchaMap):
x, y = coords
for rect, href in captchaMap.items():
@@ -137,6 +147,7 @@ class ShareLinksBiz(Crypter):
if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
return href
+
def handleErrors(self):
if "The inserted password was wrong" in self.html:
self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry")
@@ -152,6 +163,7 @@ class ShareLinksBiz(Crypter):
else:
self.correctCaptcha()
+
def getPackageInfo(self):
name = folder = None
@@ -173,6 +185,7 @@ class ShareLinksBiz(Crypter):
# Return package info
return name, folder
+
def handleWebLinks(self):
package_links = []
self.logDebug("Handling Web links")
@@ -200,6 +213,7 @@ class ShareLinksBiz(Crypter):
self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail))
return package_links
+
def handleContainers(self):
package_links = []
self.logDebug("Handling Container links")
@@ -212,6 +226,7 @@ class ShareLinksBiz(Crypter):
package_links.append(link)
return package_links
+
def handleCNL2(self):
package_links = []
self.logDebug("Handling CNL2 links")
@@ -224,6 +239,7 @@ class ShareLinksBiz(Crypter):
self.fail("Unable to decrypt CNL2 links")
return package_links
+
def _getCipherParams(self):
# Request CNL2
code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1)
@@ -244,6 +260,7 @@ class ShareLinksBiz(Crypter):
# Log and return
return crypted, jk
+
def _getLinks(self, crypted, jk):
# Get key
jreturn = self.js.eval("%s f()" % jk)