Skip to content

Commit b1a2e19

Browse files
author
Paul King
committed
fix pyload#349 add captcha support
1 parent 0c1a92d commit b1a2e19

1 file changed

Lines changed: 44 additions & 17 deletions

File tree

module/plugins/crypter/LixIn.py

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,54 @@
88
class LixIn(Crypter):
99
__name__ = "LixIn"
1010
__type__ = "container"
11-
__pattern__ = r"http://(www.)?lix.in/"
12-
__version__ = "0.1"
11+
__pattern__ = r"http://(www.)?lix.in/(?P<id>.*)"
12+
__version__ = "0.2"
1313
__description__ = """Lix.in Container Plugin"""
1414
__author_name__ = ("spoob")
1515
__author_mail__ = ("spoob@pyload.org")
16+
17+
CAPTCHA_PATTERN='<img src="(?P<image>captcha_img.php\?PHPSESSID=.*?)"'
18+
SUBMIT_PATTERN=r"value='continue .*?'"
19+
LINK_PATTERN=r'name="ifram" src="(?P<link>.*?)"'
20+
1621

17-
def __init__(self, parent):
18-
Crypter.__init__(self, parent)
19-
self.parent = parent
20-
self.html = None
22+
def decrypt(self, pyfile):
23+
url = pyfile.url
24+
25+
matches = re.search(self.__pattern__,url)
26+
if not matches:
27+
self.fail("couldn't identify file id")
28+
29+
id = matches.group("id")
30+
self.logDebug("File id is %s" % id)
31+
32+
self.html = self.req.load(url, decode=True)
33+
34+
matches = re.search(self.SUBMIT_PATTERN,self.html)
35+
if not matches:
36+
self.fail("link doesn't seem valid")
2137

22-
def file_exists(self):
23-
""" returns True or False
24-
"""
25-
return True
38+
matches = re.search(self.CAPTCHA_PATTERN, self.html)
39+
if matches:
40+
for i in range(5):
41+
matches = re.search(self.CAPTCHA_PATTERN, self.html)
42+
if matches:
43+
self.logDebug("trying captcha")
44+
captcharesult = self.decryptCaptcha("http://lix.in/"+matches.group("image"))
45+
self.html = self.req.load(url, decode=True, post={"capt" : captcharesult, "submit":"submit","tiny":id})
46+
else:
47+
self.logDebug("no captcha/captcha solved")
48+
break
49+
else:
50+
self.html = self.req.load(url, decode=True, post={"submit" : "submit",
51+
"tiny" : id})
52+
53+
matches = re.search(self.LINK_PATTERN, self.html)
54+
if not matches:
55+
self.fail("can't find destination url")
2656

27-
def proceed(self, url, location):
28-
url = self.parent.url
29-
self.html = self.req.load(url)
30-
new_link = ""
31-
if not re.search("captcha_img.php", self.html):
32-
new_link = re.search(r".*<iframe name=\"ifram\" src=\"(.*)\" marginwidth=\"0\".*", self.req.load(url, post={"submit" : "continue"})).group(1)
57+
new_link = matches.group("link")
58+
self.logDebug("Found link %s, adding to package" % new_link)
3359

34-
self.links = [new_link]
60+
self.packages.append((self.pyfile.package().name, [new_link], self.pyfile.package().name))
61+

0 commit comments

Comments
 (0)