diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/crypter/LinkdecrypterCom.py | 35 | ||||
| -rw-r--r-- | module/plugins/hooks/LinkdecrypterCom.py | 64 | 
2 files changed, 32 insertions, 67 deletions
| diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 91318eadf..7eb5d3096 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -7,13 +7,13 @@ from module.plugins.Crypter import Crypter  class LinkdecrypterCom(Crypter):      __name__    = "LinkdecrypterCom"      __type__    = "crypter" -    __version__ = "0.27" +    __version__ = "0.28"      __pattern__ = r'^unmatchable$'      __config__  = [("use_subfolder", "bool", "Save package to subfolder", True),                     ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] -    __description__ = """Linkdecrypter.com""" +    __description__ = """Linkdecrypter.com decrypter plugin"""      __license__     = "GPLv3"      __authors__     = [("zoidberg", "zoidberg@mujmail.cz"),                         ("flowlee", None)] @@ -21,13 +21,16 @@ class LinkdecrypterCom(Crypter):      TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>'      PASSWORD_PATTERN = r'<input type="text" name="password"' -    CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>' -    REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' +    CAPTCHA_PATTERN  = r'<img class="captcha" src="(.+?)"(.*?)>' +    REDIR_PATTERN    = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' -    def decrypt(self, pyfile): -        self.passwords = self.getPassword().splitlines() +    def setup(self): +        self.password = self.getPassword() +        self.req.setOption("timeout", 300) + +    def decrypt(self, pyfile):          # API not working anymore          self.urls = self.decryptHTML() @@ -39,10 +42,11 @@ class LinkdecrypterCom(Crypter):              return self.html.splitlines()          if self.html == 'INTERRUPTION(PASSWORD)': -            for get_dict['pass'] in self.passwords: -                self.html = self.load('http://linkdecrypter.com/api', get=get_dict) -                if self.html.startswith('http://'): -                    return self.html.splitlines() +            get_dict['pass'] = self.password + +            self.html = self.load('http://linkdecrypter.com/api', get=get_dict) +            if self.html.startswith('http://'): +                return self.html.splitlines()          self.logError("API", self.html)          if self.html == 'INTERRUPTION(PASSWORD)': @@ -57,7 +61,7 @@ class LinkdecrypterCom(Crypter):          post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"}          self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) -        while self.passwords or retries: +        while retries:              m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S)              if m:                  return [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] @@ -78,12 +82,11 @@ class LinkdecrypterCom(Crypter):                  retries -= 1              elif self.PASSWORD_PATTERN in self.html: -                if self.passwords: -                    password = self.passwords.pop(0) -                    self.logInfo(_("Password protected link, trying ") + password) -                    self.html = self.load('http://linkdecrypter.com/', post={'password': password}, decode=True) +                if self.password: +                    self.logInfo(_("Password protected link")) +                    self.html = self.load('http://linkdecrypter.com/', post={'password': self.password}, decode=True)                  else: -                    self.fail(_("No or incorrect password")) +                    self.fail(_("Missing password"))              else:                  retries -= 1 diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index b0ce335d0..8592efd3d 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -2,64 +2,26 @@  import re -from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook -from module.utils import remove_chars +from module.plugins.internal.MultiHook import MultiHook -class LinkdecrypterCom(Hook): +class LinkdecrypterCom(MultiHook):      __name__    = "LinkdecrypterCom"      __type__    = "hook" -    __version__ = "0.21" +    __version__ = "1.00" + +    __config__ = [("mode"        , "all;listed;unlisted", "Use for crypters (if supported)"              , "all"), +                  ("pluginlist"  , "str"                , "Crypter list (comma separated)"               , ""   ), +                  ("interval"    , "int"                , "Reload interval in hours (0 to disable)"      , 12   )]      __description__ = """Linkdecrypter.com hook plugin"""      __license__     = "GPLv3" -    __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] - +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    #@TODO: Remove in 0.4.10 -    def initPeriodical(self): -        pass - -    def coreReady(self): +    def getCrypters(self):          try: -            self.loadPatterns() -        except Exception, e: -            self.logError(e) - - -    def loadPatterns(self): -        html = getURL("http://linkdecrypter.com/") - -        m = re.search(r'<title>', html) -        if m is None: -            self.logError(_("Linkdecrypter site is down")) -            return - -        m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', html) -        if m is None: -            self.logError(_("Crypter list not found")) -            return - -        builtin = [name.lower() for name in self.core.pluginManager.crypterPlugins.keys()] -        builtin.append("downloadserienjunkiesorg") - -        crypter_pattern = re.compile("(\w[\w.-]+)") -        online = [] -        for crypter in m.group(1).split(', '): -            m = re.match(crypter_pattern, crypter) -            if m and remove_chars(m.group(1), "-.") not in builtin: -                online.append(m.group(1).replace(".", "\\.")) - -        if not online: -            self.logError(_("Crypter list is empty")) -            return - -        regexp = r'https?://([^.]+\.)*?(%s)/.*' % '|'.join(online) - -        dict = self.core.pluginManager.crypterPlugins[self.__name__] -        dict['pattern'] = regexp -        dict['re'] = re.compile(regexp) - -        self.logDebug("Loaded pattern: %s" % regexp) +            html = self.getURL("http://linkdecrypter.com/") +            return re.search(r'>Supported\(\d+\)</b>: <i>(.+?) \+ RSDF', html).group(1).split(', ') +        except Exception: +            return list() | 
