summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/DuckCryptInfo.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/crypter/DuckCryptInfo.py')
-rw-r--r--module/plugins/crypter/DuckCryptInfo.py64
1 files changed, 33 insertions, 31 deletions
diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py
index f44bac2e9..07cc5cdc4 100644
--- a/module/plugins/crypter/DuckCryptInfo.py
+++ b/module/plugins/crypter/DuckCryptInfo.py
@@ -1,57 +1,59 @@
# -*- coding: utf-8 -*-
import re
-from module.lib.BeautifulSoup import BeautifulSoup
+
+from BeautifulSoup import BeautifulSoup
+
from module.plugins.Crypter import Crypter
class DuckCryptInfo(Crypter):
- __name__ = "DuckCryptInfo"
- __type__ = "crypter"
- __pattern__ = r'http://(?:www\.)?duckcrypt.info/(folder|wait|link)/(\w+)/?(\w*)'
+ __name__ = "DuckCryptInfo"
+ __type__ = "crypter"
__version__ = "0.02"
+
+ __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)'
+ __config__ = [("use_subfolder", "bool", "Save package to subfolder", True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
+
__description__ = """DuckCrypt.info decrypter plugin"""
- __author_name__ = "godofdream"
- __author_mail__ = "soilfiction@gmail.com"
+ __license__ = "GPLv3"
+ __authors__ = [("godofdream", "soilfiction@gmail.com")]
+
TIMER_PATTERN = r'<span id="timer">(.*)</span>'
+
def decrypt(self, pyfile):
url = pyfile.url
- # seems we don't need to wait
- #src = self.req.load(str(url))
- #found = re.search(self.TIMER_PATTERN, src)
- #if found:
- # self.logDebug("Sleeping for" % found.group(1))
- # self.setWait(int(found.group(1)) ,False)
- found = re.match(self.__pattern__, url)
- if not found:
- self.fail('Weird error in link')
- if str(found.group(1)) == "link":
+
+ m = re.match(self.__pattern__, url)
+ if m is None:
+ self.fail(_("Weird error in link"))
+ if str(m.group(1)) == "link":
self.handleLink(url)
else:
- self.handleFolder(found)
+ self.handleFolder(m)
- def handleFolder(self, found):
- src = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(found.group(2)))
- found = re.match(self.__pattern__, src)
- self.logDebug("Redirectet to " + str(found.group(0)))
- src = self.load(str(found.group(0)))
- soup = BeautifulSoup(src)
+ def handleFolder(self, m):
+ html = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2)))
+ m = re.match(self.__pattern__, html)
+ self.logDebug("Redirectet to " + str(m.group(0)))
+ html = self.load(str(m.group(0)))
+ soup = BeautifulSoup(html)
cryptlinks = soup.findAll("div", attrs={"class": "folderbox"})
self.logDebug("Redirectet to " + str(cryptlinks))
if not cryptlinks:
- self.fail('no links found - (Plugin out of date?)')
+ self.error(_("No link found"))
for clink in cryptlinks:
if clink.find("a"):
self.handleLink(clink.find("a")['href'])
+
def handleLink(self, url):
- src = self.load(url)
- soup = BeautifulSoup(src)
- link = soup.find("iframe")["src"]
- if not link:
- self.logDebug('no links found - (Plugin out of date?)')
- else:
- self.core.files.addLinks([link], self.pyfile.package().id)
+ html = self.load(url)
+ soup = BeautifulSoup(html)
+ self.urls = [soup.find("iframe")['src']]
+ if not self.urls:
+ self.logInfo(_("No link found"))