diff options
Diffstat (limited to 'module/plugins/crypter')
| -rw-r--r-- | module/plugins/crypter/RelinkUs.py | 98 | 
1 files changed, 60 insertions, 38 deletions
| diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 7cf4bf3cf..9100cae9c 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -9,6 +9,7 @@ import re  import Crypto.Cipher.AES  from module.plugins.internal.Captcha import Captcha +from module.plugins.captcha.SolveMedia import SolveMedia  from module.plugins.internal.Crypter import Crypter  from module.plugins.internal.misc import fsjoin, replace_patterns @@ -16,7 +17,7 @@ from module.plugins.internal.misc import fsjoin, replace_patterns  class RelinkUs(Crypter):      __name__    = "RelinkUs"      __type__    = "crypter" -    __version__ = "3.19" +    __version__ = "3.20"      __status__  = "testing"      __pattern__ = r'http://(?:www\.)?relink\.(?:us|to)/(f/|((view|go)\.php\?id=))(?P<ID>.+)' @@ -30,7 +31,7 @@ class RelinkUs(Crypter):                         ("AndroKev", "neureither.kevin@gmail.com")] -    URL_REPLACEMENTS = [(__pattern__ + '.*', r'http://www.relink.to/f/\g<ID>')] +    URL_REPLACEMENTS = [(__pattern__ + '.*', r'http://relink.to/f/\g<ID>')]      PREFERRED_LINK_SOURCES = ["cnl2", "dlc", "web"] @@ -38,28 +39,28 @@ class RelinkUs(Crypter):      PASSWORD_TOKEN = r'container_password.php'      PASSWORD_ERROR_ROKEN = r'You have entered an incorrect password' -    PASSWORD_SUBMIT_URL = r'http://www.relink.to/container_password.php' +    PASSWORD_SUBMIT_URL  = r'http://relink.to/container_password.php' -    CAPTCHA_TOKEN = r'container_captcha.php' -    CAPTCHA_ID_PATTERN = r'id="captcha_id" value="(\w+?)"' -    CAPTCHA_ERROR_ROKEN = r'You have solved the captcha wrong' -    CAPTCHA_IMG_URL = r'http://www.relink.to/core/captcha/circlecaptcha.php' -    CAPTCHA_SUBMIT_URL = r'http://www.relink.to/container_captcha.php' +    CAPTCHA_TOKEN          = r'container_captcha.php' +    CIRCLE_CAPTCHA_PATTERN = r'id="captcha_id" value="(\w+?)"' +    CAPTCHA_ERROR_ROKEN    = r'You have solved the captcha wrong' +    CIRCLE_CAPTCHA_IMG_URL = r'http://relink.to/core/captcha/circlecaptcha.php' +    CAPTCHA_SUBMIT_URL     = r'http://relink.to/container_captcha.php'      FILE_TITLE_PATTERN = r'<th>Title</th><td>(.*)</td></tr>' -    FILE_NOTITLE = r'No title' +    FILE_NOTITLE       = r'No title' -    CNL2_FORM_PATTERN = r'<form id="cnl_form-(.*?)</form>' +    CNL2_FORM_PATTERN      = r'<form id="cnl_form-(.*?)</form>'      CNL2_FORMINPUT_PATTERN = r'<input.*?name="%s".*?value="(.*?)"' -    CNL2_JK_KEY = "jk" -    CNL2_CRYPTED_KEY = "crypted" +    CNL2_JK_KEY            = "jk" +    CNL2_CRYPTED_KEY       = "crypted"      DLC_LINK_PATTERN = r'<a href=".*?" class="dlc_button" target="_blank">' -    DLC_DOWNLOAD_URL = r'http://www.relink.to/download.php' +    DLC_DOWNLOAD_URL = r'http://relink.to/download.php'      WEB_FORWARD_PATTERN = r'getFile\(\'(.+)\'\)' -    WEB_FORWARD_URL = r'http://www.relink.to/frame.php' -    WEB_LINK_PATTERN = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(.+)"></iframe>' +    WEB_FORWARD_URL     = r'http://relink.to/frame.php' +    WEB_LINK_PATTERN    = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(.+)"></iframe>'      def setup(self): @@ -146,20 +147,41 @@ class RelinkUs(Crypter):      def unlock_captcha_protection(self): -        self.log_debug("Request user positional captcha resolving") -        captcha_id = re.search(self.CAPTCHA_ID_PATTERN, self.data).group(1) +        m = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.data) +        if m: +            self.log_debug("Request circle captcha resolving") +            captcha_id = m.group(1) -        coords = self.captcha.decrypt(self.CAPTCHA_IMG_URL, get={'id': captcha_id}, input_type="png", output_type='positional')  # , ocr="CircleCaptcha") -        self.log_debug("Captcha resolved, coords (%s,%s)" % (coords[0], coords[1])) +            coords = self.captcha.decrypt(self.CIRCLE_CAPTCHA_IMG_URL, get={'id': captcha_id}, input_type="png", output_type='positional')  # , ocr="CircleCaptcha") +            self.log_debug("Captcha resolved, coords (%s,%s)" % (coords[0], coords[1])) + +            post_data = {'button.x'    : coords[0], +                         'button.y'    : coords[1], +                         'captcha_id'  : captcha_id, +                         'captcha_type': "RelinkCircle", +                         'captcha'     : "submit"} + +        else: +            solvemedia = SolveMedia(self.pyfile) +            captcha_key = solvemedia.detect_key() +            if captcha_key: +                self.log_debug(_("Request SolveMedia captcha resolving")) +                response, challenge = solvemedia.challenge() + +                post_data = {'adcopy_response' : response, +                             'adcopy_challenge': challenge, +                             'captcha_type'    : "Solvemedia", +                             'submit'          : "Continue", +                             'captcha'         : "submit"} + +            else: +                self.log_error(_("Unknown captcha type detected")) +                self.fail(_("Unknown captcha type"))          self.data = self.load(self.CAPTCHA_SUBMIT_URL, -                              # ref=self.CAPTCHA_SUBMIT_URL + "&id=" + self.file_id, +                              ref=False,# ref=self.CAPTCHA_SUBMIT_URL + "&id=" + self.file_id,                                get={'id': self.file_id}, -                              post={'button.x'    : coords[0], -                                    'button.y'    : coords[1], -                                    'captcha_id'  : captcha_id, -                                    'captcha_type':	"RelinkCircle", -                                    'captcha'     : "submit"}) +                              post=post_data)      def get_package_info(self): @@ -172,13 +194,13 @@ class RelinkUs(Crypter):              title = m.group(1).strip()              if not self.FILE_NOTITLE in title:                  name = folder = title -                self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder)) +                self.log_debug(_("Found name [%s] and folder [%s] in package info") % (name, folder))          #: Fallback to defaults          if not name or not folder:              name = self.package.name              folder = self.package.folder -            self.log_debug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) +            self.log_debug(_("Package info not found, defaulting to pyfile name [%s] and folder [%s]") % (name, folder))          #: Return package info          return name, folder @@ -207,7 +229,7 @@ class RelinkUs(Crypter):      def handle_CNL2Links(self): -        self.log_debug("Search for CNL2 links") +        self.log_debug(_("Search for CNL2 links"))          pack_links = []          m = re.search(self.CNL2_FORM_PATTERN, self.data, re.S)          if m is not None: @@ -218,18 +240,18 @@ class RelinkUs(Crypter):                      pack_links.extend(self._get_links(crypted, jk))              except Exception: -                self.log_debug("Unable to decrypt CNL2 links", trace=True) +                self.log_debug(_("Unable to decrypt CNL2 links", trace=True))          return pack_links      def handle_DLC_links(self): -        self.log_debug("Search for DLC links") +        self.log_debug(_("Search for DLC links"))          pack_links = []          m = re.search(self.DLC_LINK_PATTERN, self.data)          if m is not None:              container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.file_id -            self.log_debug("Downloading DLC container link [%s]" % container_url) +            self.log_debug(_("Downloading DLC container link [%s]") % container_url)              try:                  dlc = self.load(container_url)                  dlc_filename = self.file_id + ".dlc" @@ -245,18 +267,18 @@ class RelinkUs(Crypter):      def handle_WEB_links(self): -        self.log_debug("Search for WEB links") +        self.log_debug(_("Search for WEB links"))          pack_links = []          params        = re.findall(self.WEB_FORWARD_PATTERN, self.data) -        self.log_debug("Decrypting %d Web links" % len(params)) +        self.log_debug(_("Decrypting %d Web links") % len(params))          for index, param in enumerate(params):              try:                  url = self.WEB_FORWARD_URL + "?%s" % param -                self.log_debug("Decrypting Web link %d, %s" % (index + 1, url)) +                self.log_debug(_("Decrypting Web link %d, %s") % (index + 1, url))                  res  = self.load(url)                  link = re.search(self.WEB_LINK_PATTERN, res).group(1) @@ -264,7 +286,7 @@ class RelinkUs(Crypter):                  pack_links.append(link)              except Exception, detail: -                self.log_debug("Error decrypting Web link %s, %s" % (index, detail)) +                self.log_debug(_("Error decrypting Web link %s, %s") % (index, detail))              self.wait(4) @@ -281,14 +303,14 @@ class RelinkUs(Crypter):          vcrypted = re.findall(crypted_re, cnl2_form, re.I)          #: Log and return -        self.log_debug("Detected %d crypted blocks" % len(vcrypted)) +        self.log_debug(_("Detected %d crypted blocks") % len(vcrypted))          return vcrypted, vjk      def _get_links(self, crypted, jk):          #: Get key          jreturn = self.js.eval("%s f()" % jk) -        self.log_debug("JsEngine returns value [%s]" % jreturn) +        self.log_debug(_("JsEngine returns value [%s]") % jreturn)          key = binascii.unhexlify(jreturn)          #: Decrypt @@ -302,5 +324,5 @@ class RelinkUs(Crypter):          links = filter(bool, text.split('\n'))          #: Log and return -        self.log_debug("Package has %d links" % len(links)) +        self.log_debug(_("Package has %d links") % len(links))          return links | 
