From 4a1bcdd97d69e622bb7a7879da47781339a7434a Mon Sep 17 00:00:00 2001 From: fragonib Date: Thu, 21 Oct 2010 00:10:00 +0200 Subject: ReLinkUs plugin improvement --- module/plugins/crypter/RelinkUs.py | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index ddecaf280..daf96fd76 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -1,23 +1,20 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- +from Crypto.Cipher import AES +from module.plugins.Crypter import Crypter import base64 import binascii import re import urllib -from Crypto.Cipher import AES - -from module.plugins.Crypter import Crypter - class RelinkUs(Crypter): __name__ = "RelinkUs" - __type__ = "container" + __type__ = "crypter" __pattern__ = r"http://(www\.)?relink.us/(f|((view|go).php))" - __version__ = "2.0" - __description__ = """Relink.us Container Plugin""" + __version__ = "2.1" + __description__ = """Relink.us Crypter Plugin""" __author_name__ = ("Sleeper-", "spoob", "fragonib") - __author_mail__ = ("@nonymous", "spoob@pyload.org", "fragonib@yahoo.es") + __author_mail__ = ("@nonymous", "spoob@pyload.org", "fragonib AT yahoo DOT es") # Constants _JK_KEY_ = "jk" @@ -27,11 +24,11 @@ class RelinkUs(Crypter): # Request page self.html = self.load(pyfile.url) - if not self.file_exists(): + if not self.fileExists(): self.offline() # Get package name and folder - (package_name, folder_name) = self.getNameAndFolder() + (package_name, folder_name) = self.getPackageNameAndFolder() # Get package links (crypted, jk) = self.getCipherParams() @@ -40,11 +37,24 @@ class RelinkUs(Crypter): # Pack self.packages = [(package_name, package_links, folder_name)] - def file_exists(self): + def fileExists(self): if "sorry.png" in self.html: + self.log.debug("RelinkUs: File not found") return False return True + def getPackageNameAndFolder(self): + title_re = r'Title\|(?P.+)</i></span></td>' + m = re.search(title_re, self.html) + if m is not None: + name = folder = m.group('title') + self.log.debug("RelinkUs: Found name [%s] and folder [%s] for package" % (name, folder)) + return (name, folder) + name = self.pyfile.package().name + folder = self.pyfile.package().folder + self.log.debug("RelinkUs: Default to pyfile name [%s] and folder [%s] for package" % (name, folder)) + return (name, folder) + def getCipherParams(self): # Get vars dict @@ -60,20 +70,15 @@ class RelinkUs(Crypter): jk = urllib.unquote(vars[RelinkUs._JK_KEY_].replace("+", " ")) crypted = vars[RelinkUs._CRYPTED_KEY_] + # Log and return + self.log.debug("RelinkUs: Javascript cipher key function [%s]" % jk) return (crypted, jk) - def getNameAndFolder(self): - title_re = r'<td class="top">Title</td><td class="top">\|</td><td><span class="info_view_id"><i>(?P<title>.*)</i></span></td>' - m = re.search(title_re, self.html) - if m is not None: - title = m.group('title') - return (title, title) - return (self.pyfile.package().name, self.pyfile.package().folder) - def getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) + self.log.debug("RelinkUs: JsEngine returns value [%s]" % jreturn) key = binascii.unhexlify(jreturn) # Decode crypted @@ -90,4 +95,6 @@ class RelinkUs(Crypter): links = text.split("\n") links = filter(lambda x: x != "", links) + # Log and return + self.log.debug("RelinkUs: Package has %d links" % len(links)) return links -- cgit v1.2.3