From d89e6a0eda653f45090c0265aa724bfd011a2ca8 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 18 Jan 2011 22:19:25 +0100 Subject: new cryptit plugin --- module/plugins/Crypter.py | 7 +++++-- module/plugins/crypter/CryptItCom.py | 40 +++++++++++++++--------------------- 2 files changed, 22 insertions(+), 25 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 0cff3bf1c..ae8fef9e4 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -60,7 +60,10 @@ class Crypter(Plugin): """ create new packages from self.packages """ for pack in self.packages: - self.log.debug(_("Parsed package %(name)s with %(len)d links") % { "name" : pack[0], "len" : len(pack[1]) } ) + self.log.debug("Parsed package %(name)s with %(len)d links" % { "name" : pack[0], "len" : len(pack[1]) } ) - self.core.server_methods.add_package(pack[0], pack[1], self.pyfile.package().queue) + pid = self.core.server_methods.add_package(pack[0], pack[1], self.pyfile.package().queue) + + if self.pyfile.package().password: + self.core.server_methods.set_package_data(pid, {"password": self.pyfile.package().password}) diff --git a/module/plugins/crypter/CryptItCom.py b/module/plugins/crypter/CryptItCom.py index 4dff06b21..6d3e8d433 100644 --- a/module/plugins/crypter/CryptItCom.py +++ b/module/plugins/crypter/CryptItCom.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- -import tempfile + import re -from os import remove -import os.path -from time import time +from random import randint + from module.plugins.Crypter import Crypter @@ -18,27 +17,22 @@ class CryptItCom(Crypter): __author_name__ = ("jeix") __author_mail__ = ("jeix@hasnomail.de") - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - def file_exists(self): - html = self.load(self.parent.url) + html = self.load(self.pyfile.url) if r'
Was ist Crypt-It
' in html: return False - return True - - def proceed(self, url, location): + return True + + def decrypt(self, pyfile): + if not self.file_exists(): + self.offline() + + # @TODO parse name and password repl_pattern = r"/(s|e|d|c)/" - url = re.sub(repl_pattern, r"/d/", url) - - # download ccf - file_name = os.path.join(tempfile.gettempdir(), "pyload_tmp_%d.ccf"%time()) - file_name = self.req.download(url, file_name) - if file_name == "redir.ccf": - remove(file_name) - raise Exception, _("File not found") - - # and it to package - self.links = [file_name] + url = re.sub(repl_pattern, r"/d/", self.pyfile.url) + + pyfile.name = "cryptit_%s_tmp.ccf" % randint(0,1000) + location = self.download(url) + + self.packages.append(["Crypt-it Package", [location], "Crypt-it Package"]) \ No newline at end of file -- cgit v1.2.3