MCPcopy Index your code
hub / github.com/pyload/pyload / decrypt

Method decrypt

module/plugins/crypter/SafelinkingNet.py:52–126  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

50 return res
51
52 def decrypt(self, pyfile):
53 # Process direct links
54 if self.info['pattern']['TYPE'] == "d/":
55 header = self.load(pyfile.url, just_header=True)
56
57 if 'location' in header:
58 self.links = [header.get('location')]
59
60 else:
61 self.error(_("Couldn't find forwarded Link"))
62
63 else: # Process protected links
64 self.package_password = self.get_password()
65
66 post_data = {'hash': self.info['pattern']['ID']}
67
68 link_info = self.api_response(
69 "http://safelinking.net/v1/protected", post_data)
70
71 if "messsage" in link_info:
72 self.log_error(link_info['messsage'])
73 self.fail(link_info['messsage'])
74
75 # Response: Links
76 elif "links" in link_info:
77 for link in link_info['links']:
78 self.links.append(link['url'])
79 return
80
81 if link_info['security'].get('usePassword', False):
82 if self.package_password:
83 self.log_debug("Using package password")
84 post_data['password'] = self.package_password
85
86 else:
87 self.fail(_("Password required"))
88
89 if link_info['security'].get('useCaptcha', False):
90 self.captcha = SolveMedia(pyfile)
91 response, challenge = self.captcha.challenge(
92 self.SOLVEMEDIA_KEY)
93
94 post_data['answer'] = response
95 post_data['challengeId'] = challenge
96 post_data['type'] = "0"
97
98 json_res = self.api_response(
99 "https://safelinking.net/v1/captcha", post_data)
100
101 # Evaluate response
102 if json_res is None:
103 self.fail(_("Invalid JSON response"))
104
105 # Response: Wrong password
106 elif "passwordFail" in json_res:
107 self.log_error(
108 _('Wrong password: "%s"') %
109 self.package_password)

Callers

nothing calls this directly

Calls 14

api_responseMethod · 0.95
SolveMediaClass · 0.90
get_passwordMethod · 0.80
log_errorMethod · 0.80
log_debugMethod · 0.80
_Function · 0.50
loadMethod · 0.45
getMethod · 0.45
errorMethod · 0.45
failMethod · 0.45
appendMethod · 0.45
challengeMethod · 0.45

Tested by

no test coverage detected