summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/FilecryptCc.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/crypter/FilecryptCc.py')
-rw-r--r--module/plugins/crypter/FilecryptCc.py76
1 files changed, 55 insertions, 21 deletions
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py
index 475c1503f..938ceafa9 100644
--- a/module/plugins/crypter/FilecryptCc.py
+++ b/module/plugins/crypter/FilecryptCc.py
@@ -1,18 +1,22 @@
# -*- coding: utf-8 -*-
+#
+# Test links:
+# http://filecrypt.cc/Container/64E039F859.html
-import base64
import binascii
import re
from Crypto.Cipher import AES
+from urlparse import urljoin
from pyload.plugin.Crypter import Crypter
+from module.plugins.internal.CaptchaService import ReCaptcha
class FilecryptCc(Crypter):
__name__ = "FilecryptCc"
__type__ = "crypter"
- __version__ = "0.05"
+ __version__ = "0.11"
__pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+'
@@ -24,9 +28,10 @@ class FilecryptCc(Crypter):
# URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter
DLC_LINK_PATTERN = r'<button class="dlcdownload" type="button" title="Download \*.dlc" onclick="DownloadDLC\(\'(.+)\'\);"><i></i><span>dlc<'
- WEBLINK_PATTERN = r"openLink.?'([\w_-]*)',"
+ WEBLINK_PATTERN = r"openLink.?'([\w_-]*)',"
- CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"'
+ CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"'
+ CIRCLE_CAPTCHA_PATTERN = r'<input type="image" src="(.+?)"'
MIRROR_PAGE_PATTERN = r'"[\w]*" href="(http://filecrypt.cc/Container/\w+\.html\?mirror=\d+)">'
@@ -38,7 +43,7 @@ class FilecryptCc(Crypter):
def decrypt(self, pyfile):
self.html = self.load(pyfile.url, cookies=True)
- if "content not found" in self.html:
+ if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo
self.offline()
self.handlePasswordProtection()
@@ -70,24 +75,56 @@ class FilecryptCc(Crypter):
self.logInfo(_("Folder is password protected"))
- if not self.pyfile.package().password:
+ password = self.getPassword()
+
+ if not password:
self.fail(_("Please enter the password in package section and try again"))
- self.html = self.load(self.pyfile.url, post={"password": self.password}, cookies=True)
+ self.html = self.load(self.pyfile.url, post={"password": password}, cookies=True)
def handleCaptcha(self):
- m = re.search(self.CAPTCHA_PATTERN, self.html)
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
+ m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)
- if m:
+ if m: #: normal captcha
self.logDebug("Captcha-URL: %s" % m.group(1))
- captcha_code = self.decryptCaptcha("http://filecrypt.cc" + m.group(1), forceUser=True, imgtype="gif")
- self.siteWithLinks = self.load(self.pyfile.url, post={"recaptcha_response_field":captcha_code}, decode=True, cookies=True)
- else:
- self.logDebug("No captcha found")
- self.siteWithLinks = self.html
- if "recaptcha_response_field" in self.siteWithLinks:
+ captcha_code = self.decryptCaptcha(urljoin("http://filecrypt.cc", m.group(1)),
+ forceUser=True,
+ imgtype="gif")
+
+ self.siteWithLinks = self.load(self.pyfile.url,
+ post={'recaptcha_response_field': captcha_code},
+ cookies=True,
+ decode=True)
+ elif m2: #: circle captcha
+ self.logDebug("Captcha-URL: %s" % m2.group(1))
+
+ captcha_code = self.decryptCaptcha(urljoin("http://filecrypt.cc", m2.group(1)),
+ forceUser=True,
+ imgtype="gif",
+ result_type='positional')
+
+ self.siteWithLinks = self.load(self.pyfile.url,
+ post={'button.x': captcha_code[0], 'button.y': captcha_code[1]},
+ cookies=True,
+ decode=True)
+
+ else:
+ recaptcha = ReCaptcha(self)
+ captcha_key = recaptcha.detect_key()
+
+ if captcha_key:
+ response, challenge = recaptcha.challenge(captcha_key)
+ self.siteWithLinks = self.load(self.pyfile.url,
+ post={'g-recaptcha-response': response},
+ decode=True)
+ else:
+ self.logInfo(_("No captcha found"))
+ self.siteWithLinks = self.html
+
+ if "recaptcha_image" in self.siteWithLinks or "data-sitekey" in self.siteWithLinks:
self.invalidCaptcha()
self.retry()
@@ -132,17 +169,14 @@ class FilecryptCc(Crypter):
# Get key
key = binascii.unhexlify(str(jk))
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
- links = filter(lambda x: x != "",
- text.replace("\x00", "").replace("\r", "").split("\n"))
+ text = text.replace("\x00", "").replace("\r", "")
+ links = filter(bool, text.split('\n'))
return links