summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/UploadingCom.py68
-rw-r--r--module/plugins/captcha/ReCaptcha.py55
-rw-r--r--module/plugins/container/DLC.py4
-rw-r--r--module/plugins/container/RSDF.py4
-rw-r--r--module/plugins/crypter/FilecryptCc.py4
-rw-r--r--module/plugins/crypter/LinkCryptWs.py4
-rw-r--r--module/plugins/crypter/NCryptIn.py4
-rw-r--r--module/plugins/crypter/RelinkUs.py4
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py4
-rw-r--r--module/plugins/hooks/IRC.py6
-rw-r--r--module/plugins/hoster/FilejokerNet.py3
-rw-r--r--module/plugins/hoster/Ftp.py24
-rw-r--r--module/plugins/hoster/OneFichierCom.py6
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py2
-rw-r--r--module/plugins/hoster/TurbobitNet.py4
-rw-r--r--module/plugins/internal/misc.py5
16 files changed, 79 insertions, 122 deletions
diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py
deleted file mode 100644
index 777ffb6b2..000000000
--- a/module/plugins/accounts/UploadingCom.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import re
-import time
-
-from module.plugins.internal.Account import Account
-from module.plugins.internal.misc import set_cookies
-
-
-class UploadingCom(Account):
- __name__ = "UploadingCom"
- __type__ = "account"
- __version__ = "0.18"
- __status__ = "testing"
-
- __description__ = """Uploading.com account plugin"""
- __license__ = "GPLv3"
- __authors__ = [("mkaay", "mkaay@mkaay.de")]
-
-
- PREMIUM_PATTERN = r'UPGRADE TO PREMIUM'
- VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<'
-
-
- def grab_info(self, user, password, data):
- validuntil = None
- trafficleft = None
- premium = None
-
- html = self.load("http://uploading.com/")
-
- premium = False if re.search(self.PREMIUM_PATTERN, html) else True
-
- m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m is not None:
- expiredate = m.group(1).strip()
- self.log_debug("Expire date: " + expiredate)
-
- try:
- validuntil = time.mktime(time.strptime(expiredate, "%b %d, %Y"))
-
- except Exception, e:
- self.log_error(e, trace=True)
-
- else:
- if validuntil > time.mktime(time.gmtime()):
- premium = True
- else:
- premium = False
- validuntil = None
-
- return {'validuntil' : validuntil,
- 'trafficleft': trafficleft,
- 'premium' : premium}
-
-
- def signin(self, user, password, data):
- set_cookies(self.req.cj,
- [("uploading.com", "lang" , "1" ),
- ("uploading.com", "language", "1" ),
- ("uploading.com", "setlang" , "en"),
- ("uploading.com", "_lang" , "en")])
-
- self.load("http://uploading.com/")
- self.load("https://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000),
- post={'email' : user,
- 'password': password,
- 'remember': "on"})
diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py
index ae243ab67..259b80606 100644
--- a/module/plugins/captcha/ReCaptcha.py
+++ b/module/plugins/captcha/ReCaptcha.py
@@ -29,7 +29,7 @@ except ImportError:
class ReCaptcha(CaptchaService):
__name__ = 'ReCaptcha'
__type__ = 'captcha'
- __version__ = '0.24'
+ __version__ = '0.27'
__status__ = 'testing'
__description__ = 'ReCaptcha captcha service plugin'
@@ -136,14 +136,15 @@ class ReCaptcha(CaptchaService):
# points in a text font (see typography) and thus we can hereby calculate
# the biggest text height of a given font
- font_name = 'arialbd'
s = StringIO()
s.write(image)
s.seek(0)
-
+
img = Image.open(s)
draw = ImageDraw.Draw(img)
+ font_name = 'arialbd'
+
if os.name == 'nt':
font = ImageFont.truetype(font_name, 13)
else:
@@ -152,23 +153,27 @@ class ReCaptcha(CaptchaService):
tile_size = {'width': img.size[0] / 3, 'height': img.size[1] / 3}
tile_index_size = {'width': draw.textsize('0')[0], 'height': draw.textsize('0')[1]}
- for i in xrange(3):
- for j in xrange(3):
+ margin = 2
+ for x in xrange(3):
+ for y in xrange(3):
tile_index_pos = {
- 'x': i * tile_size['width'] + (tile_size['width'] / 2) - (tile_index_size['width'] / 2),
- 'y': j * tile_size['height']
+ 'x': x * tile_size['width'] + (tile_size['width'] / 2) - (tile_index_size['width'] / 2),
+ 'y': y * tile_size['height']
}
+
draw.rectangle(
[
- tile_index_pos['x'],
+ tile_index_pos['x'] - margin,
tile_index_pos['y'],
- tile_index_pos['x'] + tile_index_size['width'],
+ tile_index_pos['x'] + tile_index_size['width'] + margin,
tile_index_pos['y'] + tile_index_size['height']
],
fill='white'
)
- index_number = str(j * 3 + i + 1)
+
+ index_number = str(y * 3 + x + 1)
text_width, text_height = draw.textsize(index_number, font=font)
+
draw.text(
(
tile_index_pos['x'] + (tile_index_size['width'] / 2) - (text_width / 2),
@@ -182,30 +187,46 @@ class ReCaptcha(CaptchaService):
if os.name == 'nt':
font = ImageFont.truetype(font_name, 16)
+ _sol = 0
+ _eol = 1
+ while True:
+ # determine maximum width of line
+ while draw.textsize(challenge_msg[_sol:_eol], font=font)[0] < img.size[0] and _eol < len(challenge_msg):
+ _eol += 1
+
+ # if we've wrapped the text, then adjust the wrap to the last word
+ if _eol < len(challenge_msg):
+ _eol = challenge_msg.rfind(" ", 0, _eol)
+ if _eol > 0:
+ challenge_msg = challenge_msg[:_eol] + '\n' + challenge_msg[_eol+1:]
+ _sol = _eol+1
+ else:
+ break
+
message = challenge_msg + '\n(Type image numbers like "258")'
# the text's real height is twice as big as returned by font.getsize() since we use
# a newline character which indeed breaks the text but doesn't count as a second line
# in font.getsize().
if os.name == 'nt':
- text_height = draw.multiline_textsize(message, font=font)[1]
+ text_area_height = draw.multiline_textsize(message, font=font)[1]
else:
lines = message.split('\n')
- text_height = len(lines) * draw.textsize(dummy_text, font=font)[1]
+ text_area_height = len(lines) * draw.textsize(dummy_text, font=font)[1]
margin = 5
- text_height = text_height + margin * 2 # add some margin on top and bottom of text
+ text_area_height = text_area_height + margin * 2 # add some margin on top and bottom of text
- img2 = Image.new('RGB', (img.size[0], img.size[1] + text_height), 'white')
- img2.paste(img, (0, text_height))
+ img2 = Image.new('RGB', (img.size[0], img.size[1] + text_area_height), 'white')
+ img2.paste(img, (0, text_area_height))
draw = ImageDraw.Draw(img2)
if os.name == 'nt':
draw.text((3, margin), message, fill='black', font=font)
else:
for i in xrange(len(lines)):
- draw.text((3, i * draw.textsize(dummy_text)[1] + margin), lines[i], fill='black', font=font)
+ draw.text((3, i * draw.textsize(dummy_text, font=font)[1] + margin), lines[i], fill='black', font=font)
s.truncate(0)
img2.save(s, format='JPEG')
@@ -237,7 +258,7 @@ class ReCaptcha(CaptchaService):
except (AttributeError, IndexError):
self.fail(_("ReCaptcha challenge message not found"))
- challenge_msg = re.sub(r'</?\w+?>', "", challenge_msg, 0 , re.I)
+ challenge_msg = re.sub(r'</?\w+?>', "", challenge_msg)
image_url = urlparse.urljoin('http://www.google.com',
re.search(r'"(/recaptcha/api2/payload[^"]+)', html).group(1))
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index 91e421590..09690fdc2 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -5,7 +5,7 @@ from __future__ import with_statement
import re
import xml.dom.minidom
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Container import Container
from module.plugins.internal.misc import decode, encode
@@ -14,7 +14,7 @@ from module.plugins.internal.misc import decode, encode
class DLC(Container):
__name__ = "DLC"
__type__ = "container"
- __version__ = "0.29"
+ __version__ = "0.30"
__status__ = "testing"
__pattern__ = r'(.+\.dlc|[\w\+^_]+==[\w\+^_/]+==)$'
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py
index b26f8c916..066a02210 100644
--- a/module/plugins/container/RSDF.py
+++ b/module/plugins/container/RSDF.py
@@ -5,7 +5,7 @@ from __future__ import with_statement
import binascii
import re
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Container import Container
from module.plugins.internal.misc import encode
@@ -14,7 +14,7 @@ from module.plugins.internal.misc import encode
class RSDF(Container):
__name__ = "RSDF"
__type__ = "container"
- __version__ = "0.35"
+ __version__ = "0.36"
__status__ = "testing"
__pattern__ = r'.+\.rsdf$'
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py
index 1b1159e36..3c57e5dfc 100644
--- a/module/plugins/crypter/FilecryptCc.py
+++ b/module/plugins/crypter/FilecryptCc.py
@@ -7,7 +7,7 @@ import binascii
import re
import urlparse
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Crypter import Crypter
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -17,7 +17,7 @@ from module.plugins.captcha.SolveMedia import SolveMedia
class FilecryptCc(Crypter):
__name__ = "FilecryptCc"
__type__ = "crypter"
- __version__ = "0.24"
+ __version__ = "0.25"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+'
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index 39e7f637f..66923b192 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -3,7 +3,7 @@
import binascii
import re
-import Crypto.Cipher
+import Crypto.Cipher.AES
import pycurl
from module.plugins.internal.Crypter import Crypter
@@ -13,7 +13,7 @@ from module.plugins.internal.misc import html_unescape, set_cookie
class LinkCryptWs(Crypter):
__name__ = "LinkCryptWs"
__type__ = "crypter"
- __version__ = "0.17"
+ __version__ = "0.18"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)'
diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py
index d1a2b3bcc..e7690614d 100644
--- a/module/plugins/crypter/NCryptIn.py
+++ b/module/plugins/crypter/NCryptIn.py
@@ -3,7 +3,7 @@
import binascii
import re
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Crypter import Crypter
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -12,7 +12,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha
class NCryptIn(Crypter):
__name__ = "NCryptIn"
__type__ = "crypter"
- __version__ = "1.40"
+ __version__ = "1.41"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<TYPE>folder|link|frame)-([^/\?]+)'
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index 9462bdfce..e6f764119 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -6,7 +6,7 @@ import binascii
import os
import re
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Crypter import Crypter
from module.plugins.internal.misc import fsjoin
@@ -15,7 +15,7 @@ from module.plugins.internal.misc import fsjoin
class RelinkUs(Crypter):
__name__ = "RelinkUs"
__type__ = "crypter"
- __version__ = "3.17"
+ __version__ = "3.18"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<ID>.+)'
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index cdbb00184..1968fcf8e 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -3,7 +3,7 @@
import binascii
import re
-import Crypto.Cipher
+import Crypto.Cipher.AES
from module.plugins.internal.Crypter import Crypter
@@ -11,7 +11,7 @@ from module.plugins.internal.Crypter import Crypter
class ShareLinksBiz(Crypter):
__name__ = "ShareLinksBiz"
__type__ = "crypter"
- __version__ = "1.22"
+ __version__ = "1.23"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)'
diff --git a/module/plugins/hooks/IRC.py b/module/plugins/hooks/IRC.py
index 91f9ddf5e..308d5bf36 100644
--- a/module/plugins/hooks/IRC.py
+++ b/module/plugins/hooks/IRC.py
@@ -13,13 +13,13 @@ from threading import Thread
from module.Api import PackageDoesNotExists, FileDoesNotExists
from module.plugins.internal.Notifier import Notifier
-from module.internal.misc import formatSize
+from module.plugins.internal.misc import format_size
class IRC(Thread, Notifier):
__name__ = "IRC"
__type__ = "hook"
- __version__ = "0.20"
+ __version__ = "0.21"
__status__ = "testing"
__config__ = [("activated", "bool", "Activated" , False ),
@@ -229,7 +229,7 @@ class IRC(Thread, Notifier):
data.fid,
data.name,
data.statusmsg,
- "%s/s" % formatSize(data.speed),
+ "%s/s" % format_size(data.speed),
"%s" % data.format_eta,
temp_progress
))
diff --git a/module/plugins/hoster/FilejokerNet.py b/module/plugins/hoster/FilejokerNet.py
index 2d851c59f..e58ecfabf 100644
--- a/module/plugins/hoster/FilejokerNet.py
+++ b/module/plugins/hoster/FilejokerNet.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster
class FilejokerNet(XFSHoster):
__name__ = "FilejokerNet"
__type__ = "hoster"
- __version__ = "0.01"
+ __version__ = "0.02"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?filejoker\.net/\w{12}'
@@ -27,6 +27,7 @@ class FilejokerNet(XFSHoster):
WAIT_PATTERN = r'Please [Ww]ait (?:<span id="count" class="alert-success">)?([\w ]+?)(?:</span> seconds</p>| until the next download)'
RECAPTCHA_PATTERN = r'<div id="recaptcha_image" class="pic"></div>'
+ ERROR_PATTERN = r'Wrong Captcha'
INFO_PATTERN = r'<div class="name-size">(?P<N>.+?) <small>\((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</small></div>'
SIZE_REPLACEMENTS = [('Kb','KB'), ('Mb','MB'), ('Gb','GB')]
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index babf6c2c5..6c65e1791 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
import urlparse
-import pycurl
-
from module.plugins.internal.Hoster import Hoster
from module.plugins.internal.misc import parse_name
@@ -12,7 +11,7 @@ from module.plugins.internal.misc import parse_name
class Ftp(Hoster):
__name__ = "Ftp"
__type__ = "hoster"
- __version__ = "0.59"
+ __version__ = "0.60"
__status__ = "testing"
__pattern__ = r'(?:ftps?|sftp)://([\w\-.]+(:[\w\-.]+)?@)?[\w\-.]+(:\d+)?/.+'
@@ -37,8 +36,6 @@ class Ftp(Hoster):
pyfile.name = parse_name(p_url.path.rpartition('/')[2])
if not "@" in netloc:
- self.log_debug("Auth required")
-
#@TODO: Recheck in 0.4.10
if self.account:
servers = [x['login'] for x in self.account.getAllAccounts()]
@@ -52,24 +49,25 @@ class Ftp(Hoster):
else:
pwd = self.get_password()
if ':' in pwd:
+ self.log_debug("Logging on to %s" % netloc)
self.req.addAuth(pwd)
else:
- self.fail(_("Authorization required"))
-
- self.req.http.c.setopt(pycurl.NOBODY, 1)
+ self.log_debug(_("Using anonymous logon"))
try:
- res = self.load(pyfile.url)
+ headers = self.load(pyfile.url, just_header=True)
except pycurl.error, e:
- self.fail(_("Error %d: %s") % e.args)
+ if "530" in e.args[1]:
+ self.fail(_("Authorization required"))
+ else:
+ self.fail(_("Error %d: %s") % e.args)
self.req.http.c.setopt(pycurl.NOBODY, 0)
self.log_debug(self.req.http.header)
- m = re.search(r'Content-Length:\s*(\d+)', res)
- if m is not None:
- pyfile.size = int(m.group(1))
+ if "content-length" in headers:
+ pyfile.size = headers.get("content-length")
self.download(pyfile.url)
else:
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index b7dc3a40a..51caaa657 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -4,12 +4,13 @@ import re
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.plugins.internal.misc import format_exc
class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
- __version__ = "0.99"
+ __version__ = "1.00"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\w+\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(?:es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?\w+)?'
@@ -57,6 +58,7 @@ class OneFichierCom(SimpleHoster):
headers = dict((k.lower(), v) for k,v in re.findall(r'(?P<name>.+?): (?P<value>.+?)\r?\n', get_url(redirect, just_header=True)))
if 'location' in headers and headers['location']:
redirect = headers['location']
+
else:
if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
if "filename=" in headers.get('content-disposition'):
@@ -75,8 +77,10 @@ class OneFichierCom(SimpleHoster):
break
except Exception, e:
+ print format_exc()
info = {'status' : 8,
'error' : e.message}
+ break
else:
info = {'status' : 8,
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 270759d2d..e99891bbb 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -172,7 +172,7 @@ class ShareonlineBiz(SimpleHoster):
self.retry(wait=600, msg=errmsg)
elif errmsg == "full":
- self.retry(10, 600, _("Server is full"))
+ self.fail(_("Server is full"))
elif 'slot' in errmsg:
self.wait(3600, reconnect=True)
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 081b5579b..4df311642 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -6,7 +6,7 @@ import re
import time
import urllib
-import Crypto.Cipher
+import Crypto.Cipher.ARC4
import pycurl
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -17,7 +17,7 @@ from module.plugins.internal.misc import timestamp
class TurbobitNet(SimpleHoster):
__name__ = "TurbobitNet"
__type__ = "hoster"
- __version__ = "0.27"
+ __version__ = "0.28"
__status__ = "broken"
__pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)'
diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py
index d49896233..dc2aa4517 100644
--- a/module/plugins/internal/misc.py
+++ b/module/plugins/internal/misc.py
@@ -38,7 +38,7 @@ except ImportError:
class misc(object):
__name__ = "misc"
__type__ = "plugin"
- __version__ = "0.27"
+ __version__ = "0.30"
__status__ = "stable"
__pattern__ = r'^unmatchable$'
@@ -752,7 +752,8 @@ def parse_html_form(attr_str, html, input_names={}):
inputs = {}
action = parse_html_tag_attr_value("action", form.group('TAG'))
- for inputtag in re.finditer(r'(<(input|textarea).*?>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.I | re.S):
+ for inputtag in re.finditer(r'(<(input|textarea).*?>)([^<]*(?=</\2)|)',
+ re.sub(re.compile(r'<!--.+?-->', re.I | re.S), "", form.group('CONTENT')), re.I | re.S):
name = parse_html_tag_attr_value("name", inputtag.group(1))
if name:
value = parse_html_tag_attr_value("value", inputtag.group(1))