forked from pyload/pyload
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSafelinkingNet.py
More file actions
80 lines (66 loc) · 2.95 KB
/
Copy pathSafelinkingNet.py
File metadata and controls
80 lines (66 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# -*- coding: utf-8 -*-
import re
from pycurl import FOLLOWLOCATION
from module.common.json_layer import json_loads
from module.plugins.Crypter import Crypter
from module.plugins.internal.CaptchaService import SolveMedia
from module.lib.BeautifulSoup import BeautifulSoup
class SafelinkingNet(Crypter):
__name__ = 'SafelinkingNet'
__type__ = 'crypter'
__pattern__ = r'https?://safelinking.net/([pd])/\w+'
__version__ = '0.1'
__description__ = 'Safelinking.net Crypter Plugin'
__author_name__ = 'quareevo'
__Solvemedia_pattern__ = "solvemediaApiKey = '([\w\.\-_]+)';"
def decrypt(self, pyfile):
url = pyfile.url
if re.search(self.__pattern__, url).group(1) == "d":
self.req.http.c.setopt(FOLLOWLOCATION, 0)
self.load(url)
m = re.search("^Location: (.+)$", self.req.http.header, re.MULTILINE)
if m:
self.core.files.addLinks([m.group(1)], self.pyfile.package().id)
else:
self.fail("Couldn't find forwarded Link")
else:
password = ""
packageLinks = []
postData = {"post-protect": "1"}
self.html = self.load(url)
if "link-password" in self.html:
password = pyfile.package().password
postData["link-password"] = password
if "altcaptcha" in self.html:
for i in xrange(5):
m = re.search(self.__Solvemedia_pattern__, self.html)
if m:
captchaKey = m.group(1)
captcha = SolveMedia(self)
captchaProvider = "Solvmedia"
else:
self.fail("Error parsing captcha")
challenge, response = captcha.challenge(captchaKey)
postData["adcopy_challenge"] = challenge
postData["adcopy_response"] = response
self.html = self.load(url, post=postData)
if "The password you entered was incorrect" in self.html:
self.fail("Incorrect Password")
if not "The CAPTCHA code you entered was wrong" in self.html:
break
pyfile.package().password = ""
soup = BeautifulSoup(self.html)
scripts = soup.findAll("script")
for s in scripts:
if "d_links" in s.text:
break
m = re.search('d_links":(\[.*?\])', s.text)
if m:
linkDict = json_loads(m.group(1))
for link in linkDict:
if not "http://" in link["full"]:
packageLinks.append("https://safelinking.net/d/" + link["full"])
else:
packageLinks.append(link["full"])
self.core.files.addLinks(packageLinks, self.pyfile.package().id)