|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.WebBrowser.SafeBrowsing.SafeBrowsingManager</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.WebBrowser.SafeBrowsing.SafeBrowsingManager</h1> |
|
23 <p> |
|
24 Module implementing the interface for Google Safe Browsing. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#SafeBrowsingManager">SafeBrowsingManager</a></td> |
|
34 <td>Class implementing the interface for Google Safe Browsing.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="SafeBrowsingManager" ID="SafeBrowsingManager"></a> |
|
43 <h2>SafeBrowsingManager</h2> |
|
44 <p> |
|
45 Class implementing the interface for Google Safe Browsing. |
|
46 </p><h3>Signals</h3> |
|
47 <dl> |
|
48 <dt>progress(current)</dt> |
|
49 <dd> |
|
50 emitted to signal the current progress |
|
51 </dd><dt>progressMessage(message,maximum)</dt> |
|
52 <dd> |
|
53 emitted to give a message for the |
|
54 action about to be performed and the maximum value |
|
55 </dd> |
|
56 </dl> |
|
57 <h3>Derived from</h3> |
|
58 QObject |
|
59 <h3>Class Attributes</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Class Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#SafeBrowsingManager.getIgnoreSchemes">getIgnoreSchemes</a></td> |
|
67 <td>Class method to get the schemes not to be checked.</td> |
|
68 </tr> |
|
69 </table> |
|
70 <h3>Methods</h3> |
|
71 <table> |
|
72 <tr> |
|
73 <td><a href="#SafeBrowsingManager.__init__">SafeBrowsingManager</a></td> |
|
74 <td>Constructor</td> |
|
75 </tr><tr> |
|
76 <td><a href="#SafeBrowsingManager.__lookupHashes">__lookupHashes</a></td> |
|
77 <td>Private method to lookup the given hashes.</td> |
|
78 </tr><tr> |
|
79 <td><a href="#SafeBrowsingManager.__setPlatforms">__setPlatforms</a></td> |
|
80 <td>Private method to set the platforms to be checked against.</td> |
|
81 </tr><tr> |
|
82 <td><a href="#SafeBrowsingManager.__syncFullHashes">__syncFullHashes</a></td> |
|
83 <td>Private method to download full hashes matching given prefixes.</td> |
|
84 </tr><tr> |
|
85 <td><a href="#SafeBrowsingManager.__verifyThreatListChecksum">__verifyThreatListChecksum</a></td> |
|
86 <td>Private method to verify the local checksum of a threat list with the checksum of the safe browsing server.</td> |
|
87 </tr><tr> |
|
88 <td><a href="#SafeBrowsingManager.close">close</a></td> |
|
89 <td>Public method to close the safe browsing interface.</td> |
|
90 </tr><tr> |
|
91 <td><a href="#SafeBrowsingManager.configurationChanged">configurationChanged</a></td> |
|
92 <td>Public method to handle changes of the settings.</td> |
|
93 </tr><tr> |
|
94 <td><a href="#SafeBrowsingManager.fairUseDelayExpired">fairUseDelayExpired</a></td> |
|
95 <td>Public method to check, if the fair use wait period has expired.</td> |
|
96 </tr><tr> |
|
97 <td><a href="#SafeBrowsingManager.fullCacheCleanup">fullCacheCleanup</a></td> |
|
98 <td>Public method to clean up the cache completely.</td> |
|
99 </tr><tr> |
|
100 <td><a href="#SafeBrowsingManager.getPlatformString">getPlatformString</a></td> |
|
101 <td>Public method to get the platform string for a given platform type.</td> |
|
102 </tr><tr> |
|
103 <td><a href="#SafeBrowsingManager.getThreatEntryString">getThreatEntryString</a></td> |
|
104 <td>Public method to get the threat entry string.</td> |
|
105 </tr><tr> |
|
106 <td><a href="#SafeBrowsingManager.getThreatMessage">getThreatMessage</a></td> |
|
107 <td>Public method to get a warning message for the given threat type.</td> |
|
108 </tr><tr> |
|
109 <td><a href="#SafeBrowsingManager.getThreatMessages">getThreatMessages</a></td> |
|
110 <td>Public method to get threat messages for the given threats.</td> |
|
111 </tr><tr> |
|
112 <td><a href="#SafeBrowsingManager.getThreatType">getThreatType</a></td> |
|
113 <td>Public method to get a display string for a given threat type.</td> |
|
114 </tr><tr> |
|
115 <td><a href="#SafeBrowsingManager.isEnabled">isEnabled</a></td> |
|
116 <td>Public method to check, if safe browsing is enabled.</td> |
|
117 </tr><tr> |
|
118 <td><a href="#SafeBrowsingManager.lookupUrl">lookupUrl</a></td> |
|
119 <td>Public method to lookup an URL.</td> |
|
120 </tr><tr> |
|
121 <td><a href="#SafeBrowsingManager.showSafeBrowsingDialog">showSafeBrowsingDialog</a></td> |
|
122 <td>Public slot to show the safe browsing management dialog.</td> |
|
123 </tr><tr> |
|
124 <td><a href="#SafeBrowsingManager.updateHashPrefixCache">updateHashPrefixCache</a></td> |
|
125 <td>Public method to load or update the locally cached threat lists.</td> |
|
126 </tr> |
|
127 </table> |
|
128 <h3>Static Methods</h3> |
|
129 <table> |
|
130 <tr><td>None</td></tr> |
|
131 </table> |
|
132 <a NAME="SafeBrowsingManager.getIgnoreSchemes" ID="SafeBrowsingManager.getIgnoreSchemes"></a> |
|
133 <h4>SafeBrowsingManager.getIgnoreSchemes (class method)</h4> |
|
134 <b>getIgnoreSchemes</b>(<i></i>) |
|
135 <p> |
|
136 Class method to get the schemes not to be checked. |
|
137 </p><dl> |
|
138 <dt>Returns:</dt> |
|
139 <dd> |
|
140 list of schemes to be ignored |
|
141 </dd> |
|
142 </dl><dl> |
|
143 <dt>Return Type:</dt> |
|
144 <dd> |
|
145 list of str |
|
146 </dd> |
|
147 </dl><a NAME="SafeBrowsingManager.__init__" ID="SafeBrowsingManager.__init__"></a> |
|
148 <h4>SafeBrowsingManager (Constructor)</h4> |
|
149 <b>SafeBrowsingManager</b>(<i></i>) |
|
150 <p> |
|
151 Constructor |
|
152 </p><a NAME="SafeBrowsingManager.__lookupHashes" ID="SafeBrowsingManager.__lookupHashes"></a> |
|
153 <h4>SafeBrowsingManager.__lookupHashes</h4> |
|
154 <b>__lookupHashes</b>(<i>fullHashes</i>) |
|
155 <p> |
|
156 Private method to lookup the given hashes. |
|
157 </p><dl> |
|
158 <dt><i>fullHashes</i> (list of bytes)</dt> |
|
159 <dd> |
|
160 list of hashes to lookup |
|
161 </dd> |
|
162 </dl><dl> |
|
163 <dt>Returns:</dt> |
|
164 <dd> |
|
165 names of threat lists hashes were found in |
|
166 </dd> |
|
167 </dl><dl> |
|
168 <dt>Return Type:</dt> |
|
169 <dd> |
|
170 list of ThreatList |
|
171 </dd> |
|
172 </dl><a NAME="SafeBrowsingManager.__setPlatforms" ID="SafeBrowsingManager.__setPlatforms"></a> |
|
173 <h4>SafeBrowsingManager.__setPlatforms</h4> |
|
174 <b>__setPlatforms</b>(<i></i>) |
|
175 <p> |
|
176 Private method to set the platforms to be checked against. |
|
177 </p><a NAME="SafeBrowsingManager.__syncFullHashes" ID="SafeBrowsingManager.__syncFullHashes"></a> |
|
178 <h4>SafeBrowsingManager.__syncFullHashes</h4> |
|
179 <b>__syncFullHashes</b>(<i>hashPrefixes</i>) |
|
180 <p> |
|
181 Private method to download full hashes matching given prefixes. |
|
182 </p><p> |
|
183 This also updates the cache expiration timestamps. |
|
184 </p><dl> |
|
185 <dt><i>hashPrefixes</i> (list of bytes)</dt> |
|
186 <dd> |
|
187 list of hash prefixes to get full hashes for |
|
188 </dd> |
|
189 </dl><a NAME="SafeBrowsingManager.__verifyThreatListChecksum" ID="SafeBrowsingManager.__verifyThreatListChecksum"></a> |
|
190 <h4>SafeBrowsingManager.__verifyThreatListChecksum</h4> |
|
191 <b>__verifyThreatListChecksum</b>(<i>threatList, remoteChecksum</i>) |
|
192 <p> |
|
193 Private method to verify the local checksum of a threat list with the |
|
194 checksum of the safe browsing server. |
|
195 </p><dl> |
|
196 <dt><i>threatList</i> (ThreatList)</dt> |
|
197 <dd> |
|
198 threat list to calculate checksum for |
|
199 </dd><dt><i>remoteChecksum</i> (bytes)</dt> |
|
200 <dd> |
|
201 SHA256 checksum as reported by the Google server |
|
202 </dd> |
|
203 </dl><dl> |
|
204 <dt>Returns:</dt> |
|
205 <dd> |
|
206 flag indicating equality |
|
207 </dd> |
|
208 </dl><dl> |
|
209 <dt>Return Type:</dt> |
|
210 <dd> |
|
211 bool |
|
212 </dd> |
|
213 </dl><a NAME="SafeBrowsingManager.close" ID="SafeBrowsingManager.close"></a> |
|
214 <h4>SafeBrowsingManager.close</h4> |
|
215 <b>close</b>(<i></i>) |
|
216 <p> |
|
217 Public method to close the safe browsing interface. |
|
218 </p><a NAME="SafeBrowsingManager.configurationChanged" ID="SafeBrowsingManager.configurationChanged"></a> |
|
219 <h4>SafeBrowsingManager.configurationChanged</h4> |
|
220 <b>configurationChanged</b>(<i></i>) |
|
221 <p> |
|
222 Public method to handle changes of the settings. |
|
223 </p><a NAME="SafeBrowsingManager.fairUseDelayExpired" ID="SafeBrowsingManager.fairUseDelayExpired"></a> |
|
224 <h4>SafeBrowsingManager.fairUseDelayExpired</h4> |
|
225 <b>fairUseDelayExpired</b>(<i></i>) |
|
226 <p> |
|
227 Public method to check, if the fair use wait period has expired. |
|
228 </p><dl> |
|
229 <dt>Returns:</dt> |
|
230 <dd> |
|
231 flag indicating expiration |
|
232 </dd> |
|
233 </dl><dl> |
|
234 <dt>Return Type:</dt> |
|
235 <dd> |
|
236 bool |
|
237 </dd> |
|
238 </dl><a NAME="SafeBrowsingManager.fullCacheCleanup" ID="SafeBrowsingManager.fullCacheCleanup"></a> |
|
239 <h4>SafeBrowsingManager.fullCacheCleanup</h4> |
|
240 <b>fullCacheCleanup</b>(<i></i>) |
|
241 <p> |
|
242 Public method to clean up the cache completely. |
|
243 </p><a NAME="SafeBrowsingManager.getPlatformString" ID="SafeBrowsingManager.getPlatformString"></a> |
|
244 <h4>SafeBrowsingManager.getPlatformString</h4> |
|
245 <b>getPlatformString</b>(<i>platformType</i>) |
|
246 <p> |
|
247 Public method to get the platform string for a given platform type. |
|
248 </p><dl> |
|
249 <dt><i>platformType</i> (str)</dt> |
|
250 <dd> |
|
251 platform type as defined in the v4 API |
|
252 </dd> |
|
253 </dl><dl> |
|
254 <dt>Returns:</dt> |
|
255 <dd> |
|
256 platform string |
|
257 </dd> |
|
258 </dl><dl> |
|
259 <dt>Return Type:</dt> |
|
260 <dd> |
|
261 str |
|
262 </dd> |
|
263 </dl><a NAME="SafeBrowsingManager.getThreatEntryString" ID="SafeBrowsingManager.getThreatEntryString"></a> |
|
264 <h4>SafeBrowsingManager.getThreatEntryString</h4> |
|
265 <b>getThreatEntryString</b>(<i>threatEntry</i>) |
|
266 <p> |
|
267 Public method to get the threat entry string. |
|
268 </p><dl> |
|
269 <dt><i>threatEntry</i> (str)</dt> |
|
270 <dd> |
|
271 threat entry type as defined in the v4 API |
|
272 </dd> |
|
273 </dl><dl> |
|
274 <dt>Returns:</dt> |
|
275 <dd> |
|
276 threat entry string |
|
277 </dd> |
|
278 </dl><dl> |
|
279 <dt>Return Type:</dt> |
|
280 <dd> |
|
281 str |
|
282 </dd> |
|
283 </dl><a NAME="SafeBrowsingManager.getThreatMessage" ID="SafeBrowsingManager.getThreatMessage"></a> |
|
284 <h4>SafeBrowsingManager.getThreatMessage</h4> |
|
285 <b>getThreatMessage</b>(<i>threatType</i>) |
|
286 <p> |
|
287 Public method to get a warning message for the given threat type. |
|
288 </p><dl> |
|
289 <dt><i>threatType</i> (str)</dt> |
|
290 <dd> |
|
291 threat type to get the message for |
|
292 </dd> |
|
293 </dl><dl> |
|
294 <dt>Returns:</dt> |
|
295 <dd> |
|
296 threat message |
|
297 </dd> |
|
298 </dl><dl> |
|
299 <dt>Return Type:</dt> |
|
300 <dd> |
|
301 str |
|
302 </dd> |
|
303 </dl><a NAME="SafeBrowsingManager.getThreatMessages" ID="SafeBrowsingManager.getThreatMessages"></a> |
|
304 <h4>SafeBrowsingManager.getThreatMessages</h4> |
|
305 <b>getThreatMessages</b>(<i>threatLists</i>) |
|
306 <p> |
|
307 Public method to get threat messages for the given threats. |
|
308 </p><dl> |
|
309 <dt><i>threatLists</i> (list of ThreatList)</dt> |
|
310 <dd> |
|
311 list of threat lists to get a message for |
|
312 </dd> |
|
313 </dl><dl> |
|
314 <dt>Returns:</dt> |
|
315 <dd> |
|
316 list of threat messages, one per unique threat type |
|
317 </dd> |
|
318 </dl><dl> |
|
319 <dt>Return Type:</dt> |
|
320 <dd> |
|
321 list of str |
|
322 </dd> |
|
323 </dl><a NAME="SafeBrowsingManager.getThreatType" ID="SafeBrowsingManager.getThreatType"></a> |
|
324 <h4>SafeBrowsingManager.getThreatType</h4> |
|
325 <b>getThreatType</b>(<i>threatList</i>) |
|
326 <p> |
|
327 Public method to get a display string for a given threat type. |
|
328 </p><dl> |
|
329 <dt><i>threatList</i> (str)</dt> |
|
330 <dd> |
|
331 threat list to get display string for |
|
332 </dd> |
|
333 </dl><dl> |
|
334 <dt>Returns:</dt> |
|
335 <dd> |
|
336 display string |
|
337 </dd> |
|
338 </dl><dl> |
|
339 <dt>Return Type:</dt> |
|
340 <dd> |
|
341 str |
|
342 </dd> |
|
343 </dl><a NAME="SafeBrowsingManager.isEnabled" ID="SafeBrowsingManager.isEnabled"></a> |
|
344 <h4>SafeBrowsingManager.isEnabled</h4> |
|
345 <b>isEnabled</b>(<i></i>) |
|
346 <p> |
|
347 Public method to check, if safe browsing is enabled. |
|
348 </p><dl> |
|
349 <dt>Returns:</dt> |
|
350 <dd> |
|
351 flag indicating the enabled state |
|
352 </dd> |
|
353 </dl><dl> |
|
354 <dt>Return Type:</dt> |
|
355 <dd> |
|
356 bool |
|
357 </dd> |
|
358 </dl><a NAME="SafeBrowsingManager.lookupUrl" ID="SafeBrowsingManager.lookupUrl"></a> |
|
359 <h4>SafeBrowsingManager.lookupUrl</h4> |
|
360 <b>lookupUrl</b>(<i>url</i>) |
|
361 <p> |
|
362 Public method to lookup an URL. |
|
363 </p><dl> |
|
364 <dt><i>url</i> (str or QUrl)</dt> |
|
365 <dd> |
|
366 URL to be checked |
|
367 </dd> |
|
368 </dl><dl> |
|
369 <dt>Returns:</dt> |
|
370 <dd> |
|
371 list of threat lists the URL was found in |
|
372 </dd> |
|
373 </dl><dl> |
|
374 <dt>Return Type:</dt> |
|
375 <dd> |
|
376 list of ThreatList |
|
377 </dd> |
|
378 </dl><dl> |
|
379 <dt>Raises <b>ValueError</b>:</dt> |
|
380 <dd> |
|
381 raised for an invalid URL |
|
382 </dd> |
|
383 </dl><a NAME="SafeBrowsingManager.showSafeBrowsingDialog" ID="SafeBrowsingManager.showSafeBrowsingDialog"></a> |
|
384 <h4>SafeBrowsingManager.showSafeBrowsingDialog</h4> |
|
385 <b>showSafeBrowsingDialog</b>(<i></i>) |
|
386 <p> |
|
387 Public slot to show the safe browsing management dialog. |
|
388 </p><a NAME="SafeBrowsingManager.updateHashPrefixCache" ID="SafeBrowsingManager.updateHashPrefixCache"></a> |
|
389 <h4>SafeBrowsingManager.updateHashPrefixCache</h4> |
|
390 <b>updateHashPrefixCache</b>(<i></i>) |
|
391 <p> |
|
392 Public method to load or update the locally cached threat lists. |
|
393 </p><dl> |
|
394 <dt>Returns:</dt> |
|
395 <dd> |
|
396 flag indicating success and an error message |
|
397 </dd> |
|
398 </dl><dl> |
|
399 <dt>Return Type:</dt> |
|
400 <dd> |
|
401 tuple of (bool, str) |
|
402 </dd> |
|
403 </dl> |
|
404 <div align="right"><a href="#top">Up</a></div> |
|
405 <hr /> |
|
406 </body></html> |