eric7/Documentation/Source/eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.WebBrowser.SafeBrowsing.SafeBrowsingManager</h1>
24
25 <p>
26 Module implementing the interface for Google Safe Browsing.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#SafeBrowsingManager">SafeBrowsingManager</a></td>
39 <td>Class implementing the interface for Google Safe Browsing.</td>
40 </tr>
41 </table>
42 <h3>Functions</h3>
43
44 <table>
45 <tr><td>None</td></tr>
46 </table>
47 <hr />
48 <hr />
49 <a NAME="SafeBrowsingManager" ID="SafeBrowsingManager"></a>
50 <h2>SafeBrowsingManager</h2>
51
52 <p>
53 Class implementing the interface for Google Safe Browsing.
54 </p>
55 <h3>Signals</h3>
56 <dl>
57
58 <dt>progress(current)</dt>
59 <dd>
60 emitted to signal the current progress
61 </dd>
62 <dt>progressMessage(message,maximum)</dt>
63 <dd>
64 emitted to give a message for the
65 action about to be performed and the maximum value
66 </dd>
67 </dl>
68 <h3>Derived from</h3>
69 QObject
70 <h3>Class Attributes</h3>
71
72 <table>
73 <tr><td>enabled</td></tr>
74 </table>
75 <h3>Class Methods</h3>
76
77 <table>
78
79 <tr>
80 <td><a href="#SafeBrowsingManager.getIgnoreSchemes">getIgnoreSchemes</a></td>
81 <td>Class method to get the schemes not to be checked.</td>
82 </tr>
83 <tr>
84 <td><a href="#SafeBrowsingManager.isEnabled">isEnabled</a></td>
85 <td>Class method to check, if safe browsing is enabled.</td>
86 </tr>
87 </table>
88 <h3>Methods</h3>
89
90 <table>
91
92 <tr>
93 <td><a href="#SafeBrowsingManager.__init__">SafeBrowsingManager</a></td>
94 <td>Constructor</td>
95 </tr>
96 <tr>
97 <td><a href="#SafeBrowsingManager.__lookupHashes">__lookupHashes</a></td>
98 <td>Private method to lookup the given hashes.</td>
99 </tr>
100 <tr>
101 <td><a href="#SafeBrowsingManager.__setAutoUpdateThreatLists">__setAutoUpdateThreatLists</a></td>
102 <td>Private method to set auto update for the threat lists.</td>
103 </tr>
104 <tr>
105 <td><a href="#SafeBrowsingManager.__setLookupMethod">__setLookupMethod</a></td>
106 <td>Private method to set the lookup method (Update API or Lookup API).</td>
107 </tr>
108 <tr>
109 <td><a href="#SafeBrowsingManager.__setPlatforms">__setPlatforms</a></td>
110 <td>Private method to set the platforms to be checked against.</td>
111 </tr>
112 <tr>
113 <td><a href="#SafeBrowsingManager.__showNotificationMessage">__showNotificationMessage</a></td>
114 <td>Private method to show some message in a notification widget.</td>
115 </tr>
116 <tr>
117 <td><a href="#SafeBrowsingManager.__syncFullHashes">__syncFullHashes</a></td>
118 <td>Private method to download full hashes matching given prefixes.</td>
119 </tr>
120 <tr>
121 <td><a href="#SafeBrowsingManager.__threatListsUpdateTimerTimeout">__threatListsUpdateTimerTimeout</a></td>
122 <td>Private slot to perform the auto update of the threat lists.</td>
123 </tr>
124 <tr>
125 <td><a href="#SafeBrowsingManager.__verifyThreatListChecksum">__verifyThreatListChecksum</a></td>
126 <td>Private method to verify the local checksum of a threat list with the checksum of the safe browsing server.</td>
127 </tr>
128 <tr>
129 <td><a href="#SafeBrowsingManager.close">close</a></td>
130 <td>Public method to close the safe browsing interface.</td>
131 </tr>
132 <tr>
133 <td><a href="#SafeBrowsingManager.configurationChanged">configurationChanged</a></td>
134 <td>Public method to handle changes of the settings.</td>
135 </tr>
136 <tr>
137 <td><a href="#SafeBrowsingManager.fairUseDelayExpired">fairUseDelayExpired</a></td>
138 <td>Public method to check, if the fair use wait period has expired.</td>
139 </tr>
140 <tr>
141 <td><a href="#SafeBrowsingManager.fullCacheCleanup">fullCacheCleanup</a></td>
142 <td>Public method to clean up the cache completely.</td>
143 </tr>
144 <tr>
145 <td><a href="#SafeBrowsingManager.getPlatformString">getPlatformString</a></td>
146 <td>Public method to get the platform string for a given platform type.</td>
147 </tr>
148 <tr>
149 <td><a href="#SafeBrowsingManager.getThreatEntryString">getThreatEntryString</a></td>
150 <td>Public method to get the threat entry string.</td>
151 </tr>
152 <tr>
153 <td><a href="#SafeBrowsingManager.getThreatMessage">getThreatMessage</a></td>
154 <td>Public method to get a warning message for the given threat type.</td>
155 </tr>
156 <tr>
157 <td><a href="#SafeBrowsingManager.getThreatMessages">getThreatMessages</a></td>
158 <td>Public method to get threat messages for the given threats.</td>
159 </tr>
160 <tr>
161 <td><a href="#SafeBrowsingManager.getThreatType">getThreatType</a></td>
162 <td>Public method to get a display string for a given threat type.</td>
163 </tr>
164 <tr>
165 <td><a href="#SafeBrowsingManager.isUpdatingThreatLists">isUpdatingThreatLists</a></td>
166 <td>Public method to check, if we are in the process of updating the threat lists.</td>
167 </tr>
168 <tr>
169 <td><a href="#SafeBrowsingManager.lookupUrl">lookupUrl</a></td>
170 <td>Public method to lookup an URL.</td>
171 </tr>
172 <tr>
173 <td><a href="#SafeBrowsingManager.showSafeBrowsingDialog">showSafeBrowsingDialog</a></td>
174 <td>Public slot to show the safe browsing management dialog.</td>
175 </tr>
176 <tr>
177 <td><a href="#SafeBrowsingManager.updateHashPrefixCache">updateHashPrefixCache</a></td>
178 <td>Public method to load or update the locally cached threat lists.</td>
179 </tr>
180 </table>
181 <h3>Static Methods</h3>
182
183 <table>
184 <tr><td>None</td></tr>
185 </table>
186
187 <a NAME="SafeBrowsingManager.getIgnoreSchemes" ID="SafeBrowsingManager.getIgnoreSchemes"></a>
188 <h4>SafeBrowsingManager.getIgnoreSchemes (class method)</h4>
189 <b>getIgnoreSchemes</b>(<i></i>)
190
191 <p>
192 Class method to get the schemes not to be checked.
193 </p>
194 <dl>
195 <dt>Return:</dt>
196 <dd>
197 list of schemes to be ignored
198 </dd>
199 </dl>
200 <dl>
201 <dt>Return Type:</dt>
202 <dd>
203 list of str
204 </dd>
205 </dl>
206 <a NAME="SafeBrowsingManager.isEnabled" ID="SafeBrowsingManager.isEnabled"></a>
207 <h4>SafeBrowsingManager.isEnabled (class method)</h4>
208 <b>isEnabled</b>(<i></i>)
209
210 <p>
211 Class method to check, if safe browsing is enabled.
212 </p>
213 <dl>
214 <dt>Return:</dt>
215 <dd>
216 flag indicating the enabled state
217 </dd>
218 </dl>
219 <dl>
220 <dt>Return Type:</dt>
221 <dd>
222 bool
223 </dd>
224 </dl>
225 <a NAME="SafeBrowsingManager.__init__" ID="SafeBrowsingManager.__init__"></a>
226 <h4>SafeBrowsingManager (Constructor)</h4>
227 <b>SafeBrowsingManager</b>(<i></i>)
228
229 <p>
230 Constructor
231 </p>
232 <a NAME="SafeBrowsingManager.__lookupHashes" ID="SafeBrowsingManager.__lookupHashes"></a>
233 <h4>SafeBrowsingManager.__lookupHashes</h4>
234 <b>__lookupHashes</b>(<i>fullHashes</i>)
235
236 <p>
237 Private method to lookup the given hashes.
238 </p>
239 <dl>
240
241 <dt><i>fullHashes</i> (list of bytes)</dt>
242 <dd>
243 list of hashes to lookup
244 </dd>
245 </dl>
246 <dl>
247 <dt>Return:</dt>
248 <dd>
249 names of threat lists hashes were found in
250 </dd>
251 </dl>
252 <dl>
253 <dt>Return Type:</dt>
254 <dd>
255 list of ThreatList
256 </dd>
257 </dl>
258 <a NAME="SafeBrowsingManager.__setAutoUpdateThreatLists" ID="SafeBrowsingManager.__setAutoUpdateThreatLists"></a>
259 <h4>SafeBrowsingManager.__setAutoUpdateThreatLists</h4>
260 <b>__setAutoUpdateThreatLists</b>(<i></i>)
261
262 <p>
263 Private method to set auto update for the threat lists.
264 </p>
265 <a NAME="SafeBrowsingManager.__setLookupMethod" ID="SafeBrowsingManager.__setLookupMethod"></a>
266 <h4>SafeBrowsingManager.__setLookupMethod</h4>
267 <b>__setLookupMethod</b>(<i></i>)
268
269 <p>
270 Private method to set the lookup method (Update API or Lookup API).
271 </p>
272 <a NAME="SafeBrowsingManager.__setPlatforms" ID="SafeBrowsingManager.__setPlatforms"></a>
273 <h4>SafeBrowsingManager.__setPlatforms</h4>
274 <b>__setPlatforms</b>(<i></i>)
275
276 <p>
277 Private method to set the platforms to be checked against.
278 </p>
279 <a NAME="SafeBrowsingManager.__showNotificationMessage" ID="SafeBrowsingManager.__showNotificationMessage"></a>
280 <h4>SafeBrowsingManager.__showNotificationMessage</h4>
281 <b>__showNotificationMessage</b>(<i>message, timeout=5</i>)
282
283 <p>
284 Private method to show some message in a notification widget.
285 </p>
286 <dl>
287
288 <dt><i>message</i> (str)</dt>
289 <dd>
290 message to be shown
291 </dd>
292 <dt><i>timeout</i> (int)</dt>
293 <dd>
294 amount of time in seconds the message should be shown
295 (0 = indefinitely)
296 </dd>
297 </dl>
298 <a NAME="SafeBrowsingManager.__syncFullHashes" ID="SafeBrowsingManager.__syncFullHashes"></a>
299 <h4>SafeBrowsingManager.__syncFullHashes</h4>
300 <b>__syncFullHashes</b>(<i>hashPrefixes</i>)
301
302 <p>
303 Private method to download full hashes matching given prefixes.
304 </p>
305 <p>
306 This also updates the cache expiration timestamps.
307 </p>
308 <dl>
309
310 <dt><i>hashPrefixes</i> (list of bytes)</dt>
311 <dd>
312 list of hash prefixes to get full hashes for
313 </dd>
314 </dl>
315 <a NAME="SafeBrowsingManager.__threatListsUpdateTimerTimeout" ID="SafeBrowsingManager.__threatListsUpdateTimerTimeout"></a>
316 <h4>SafeBrowsingManager.__threatListsUpdateTimerTimeout</h4>
317 <b>__threatListsUpdateTimerTimeout</b>(<i></i>)
318
319 <p>
320 Private slot to perform the auto update of the threat lists.
321 </p>
322 <a NAME="SafeBrowsingManager.__verifyThreatListChecksum" ID="SafeBrowsingManager.__verifyThreatListChecksum"></a>
323 <h4>SafeBrowsingManager.__verifyThreatListChecksum</h4>
324 <b>__verifyThreatListChecksum</b>(<i>threatList, remoteChecksum</i>)
325
326 <p>
327 Private method to verify the local checksum of a threat list with the
328 checksum of the safe browsing server.
329 </p>
330 <dl>
331
332 <dt><i>threatList</i> (ThreatList)</dt>
333 <dd>
334 threat list to calculate checksum for
335 </dd>
336 <dt><i>remoteChecksum</i> (bytes)</dt>
337 <dd>
338 SHA256 checksum as reported by the Google server
339 </dd>
340 </dl>
341 <dl>
342 <dt>Return:</dt>
343 <dd>
344 flag indicating equality
345 </dd>
346 </dl>
347 <dl>
348 <dt>Return Type:</dt>
349 <dd>
350 bool
351 </dd>
352 </dl>
353 <a NAME="SafeBrowsingManager.close" ID="SafeBrowsingManager.close"></a>
354 <h4>SafeBrowsingManager.close</h4>
355 <b>close</b>(<i></i>)
356
357 <p>
358 Public method to close the safe browsing interface.
359 </p>
360 <a NAME="SafeBrowsingManager.configurationChanged" ID="SafeBrowsingManager.configurationChanged"></a>
361 <h4>SafeBrowsingManager.configurationChanged</h4>
362 <b>configurationChanged</b>(<i></i>)
363
364 <p>
365 Public method to handle changes of the settings.
366 </p>
367 <a NAME="SafeBrowsingManager.fairUseDelayExpired" ID="SafeBrowsingManager.fairUseDelayExpired"></a>
368 <h4>SafeBrowsingManager.fairUseDelayExpired</h4>
369 <b>fairUseDelayExpired</b>(<i></i>)
370
371 <p>
372 Public method to check, if the fair use wait period has expired.
373 </p>
374 <dl>
375 <dt>Return:</dt>
376 <dd>
377 flag indicating expiration
378 </dd>
379 </dl>
380 <dl>
381 <dt>Return Type:</dt>
382 <dd>
383 bool
384 </dd>
385 </dl>
386 <a NAME="SafeBrowsingManager.fullCacheCleanup" ID="SafeBrowsingManager.fullCacheCleanup"></a>
387 <h4>SafeBrowsingManager.fullCacheCleanup</h4>
388 <b>fullCacheCleanup</b>(<i></i>)
389
390 <p>
391 Public method to clean up the cache completely.
392 </p>
393 <a NAME="SafeBrowsingManager.getPlatformString" ID="SafeBrowsingManager.getPlatformString"></a>
394 <h4>SafeBrowsingManager.getPlatformString</h4>
395 <b>getPlatformString</b>(<i>platformType</i>)
396
397 <p>
398 Public method to get the platform string for a given platform type.
399 </p>
400 <dl>
401
402 <dt><i>platformType</i> (str)</dt>
403 <dd>
404 platform type as defined in the v4 API
405 </dd>
406 </dl>
407 <dl>
408 <dt>Return:</dt>
409 <dd>
410 platform string
411 </dd>
412 </dl>
413 <dl>
414 <dt>Return Type:</dt>
415 <dd>
416 str
417 </dd>
418 </dl>
419 <a NAME="SafeBrowsingManager.getThreatEntryString" ID="SafeBrowsingManager.getThreatEntryString"></a>
420 <h4>SafeBrowsingManager.getThreatEntryString</h4>
421 <b>getThreatEntryString</b>(<i>threatEntry</i>)
422
423 <p>
424 Public method to get the threat entry string.
425 </p>
426 <dl>
427
428 <dt><i>threatEntry</i> (str)</dt>
429 <dd>
430 threat entry type as defined in the v4 API
431 </dd>
432 </dl>
433 <dl>
434 <dt>Return:</dt>
435 <dd>
436 threat entry string
437 </dd>
438 </dl>
439 <dl>
440 <dt>Return Type:</dt>
441 <dd>
442 str
443 </dd>
444 </dl>
445 <a NAME="SafeBrowsingManager.getThreatMessage" ID="SafeBrowsingManager.getThreatMessage"></a>
446 <h4>SafeBrowsingManager.getThreatMessage</h4>
447 <b>getThreatMessage</b>(<i>threatType</i>)
448
449 <p>
450 Public method to get a warning message for the given threat type.
451 </p>
452 <dl>
453
454 <dt><i>threatType</i> (str)</dt>
455 <dd>
456 threat type to get the message for
457 </dd>
458 </dl>
459 <dl>
460 <dt>Return:</dt>
461 <dd>
462 threat message
463 </dd>
464 </dl>
465 <dl>
466 <dt>Return Type:</dt>
467 <dd>
468 str
469 </dd>
470 </dl>
471 <a NAME="SafeBrowsingManager.getThreatMessages" ID="SafeBrowsingManager.getThreatMessages"></a>
472 <h4>SafeBrowsingManager.getThreatMessages</h4>
473 <b>getThreatMessages</b>(<i>threatLists</i>)
474
475 <p>
476 Public method to get threat messages for the given threats.
477 </p>
478 <dl>
479
480 <dt><i>threatLists</i> (list of ThreatList)</dt>
481 <dd>
482 list of threat lists to get a message for
483 </dd>
484 </dl>
485 <dl>
486 <dt>Return:</dt>
487 <dd>
488 list of threat messages, one per unique threat type
489 </dd>
490 </dl>
491 <dl>
492 <dt>Return Type:</dt>
493 <dd>
494 list of str
495 </dd>
496 </dl>
497 <a NAME="SafeBrowsingManager.getThreatType" ID="SafeBrowsingManager.getThreatType"></a>
498 <h4>SafeBrowsingManager.getThreatType</h4>
499 <b>getThreatType</b>(<i>threatList</i>)
500
501 <p>
502 Public method to get a display string for a given threat type.
503 </p>
504 <dl>
505
506 <dt><i>threatList</i> (str)</dt>
507 <dd>
508 threat list to get display string for
509 </dd>
510 </dl>
511 <dl>
512 <dt>Return:</dt>
513 <dd>
514 display string
515 </dd>
516 </dl>
517 <dl>
518 <dt>Return Type:</dt>
519 <dd>
520 str
521 </dd>
522 </dl>
523 <a NAME="SafeBrowsingManager.isUpdatingThreatLists" ID="SafeBrowsingManager.isUpdatingThreatLists"></a>
524 <h4>SafeBrowsingManager.isUpdatingThreatLists</h4>
525 <b>isUpdatingThreatLists</b>(<i></i>)
526
527 <p>
528 Public method to check, if we are in the process of updating the
529 threat lists.
530 </p>
531 <dl>
532 <dt>Return:</dt>
533 <dd>
534 flag indicating an update process is active
535 </dd>
536 </dl>
537 <dl>
538 <dt>Return Type:</dt>
539 <dd>
540 bool
541 </dd>
542 </dl>
543 <a NAME="SafeBrowsingManager.lookupUrl" ID="SafeBrowsingManager.lookupUrl"></a>
544 <h4>SafeBrowsingManager.lookupUrl</h4>
545 <b>lookupUrl</b>(<i>url</i>)
546
547 <p>
548 Public method to lookup an URL.
549 </p>
550 <dl>
551
552 <dt><i>url</i> (str or QUrl)</dt>
553 <dd>
554 URL to be checked
555 </dd>
556 </dl>
557 <dl>
558 <dt>Return:</dt>
559 <dd>
560 tuple containing the list of threat lists the URL was found in
561 and an error message
562 </dd>
563 </dl>
564 <dl>
565 <dt>Return Type:</dt>
566 <dd>
567 tuple of (list of ThreatList, str)
568 </dd>
569 </dl>
570 <dl>
571
572 <dt>Raises <b>ValueError</b>:</dt>
573 <dd>
574 raised for an invalid URL
575 </dd>
576 </dl>
577 <a NAME="SafeBrowsingManager.showSafeBrowsingDialog" ID="SafeBrowsingManager.showSafeBrowsingDialog"></a>
578 <h4>SafeBrowsingManager.showSafeBrowsingDialog</h4>
579 <b>showSafeBrowsingDialog</b>(<i></i>)
580
581 <p>
582 Public slot to show the safe browsing management dialog.
583 </p>
584 <a NAME="SafeBrowsingManager.updateHashPrefixCache" ID="SafeBrowsingManager.updateHashPrefixCache"></a>
585 <h4>SafeBrowsingManager.updateHashPrefixCache</h4>
586 <b>updateHashPrefixCache</b>(<i></i>)
587
588 <p>
589 Public method to load or update the locally cached threat lists.
590 </p>
591 <dl>
592 <dt>Return:</dt>
593 <dd>
594 flag indicating success and an error message
595 </dd>
596 </dl>
597 <dl>
598 <dt>Return Type:</dt>
599 <dd>
600 tuple of (bool, str)
601 </dd>
602 </dl>
603 <div align="right"><a href="#top">Up</a></div>
604 <hr />
605 </body></html>

eric ide

mercurial