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

changeset 6942
2602857055c5
parent 6234
fb1f9e681848
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
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>enabled</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><tr>
69 <td><a href="#SafeBrowsingManager.isEnabled">isEnabled</a></td>
70 <td>Class method to check, if safe browsing is enabled.</td>
71 </tr>
72 </table>
73 <h3>Methods</h3>
74 <table>
75 <tr>
76 <td><a href="#SafeBrowsingManager.__init__">SafeBrowsingManager</a></td>
77 <td>Constructor</td>
78 </tr><tr>
79 <td><a href="#SafeBrowsingManager.__lookupHashes">__lookupHashes</a></td>
80 <td>Private method to lookup the given hashes.</td>
81 </tr><tr>
82 <td><a href="#SafeBrowsingManager.__setAutoUpdateThreatLists">__setAutoUpdateThreatLists</a></td>
83 <td>Private method to set auto update for the threat lists.</td>
84 </tr><tr>
85 <td><a href="#SafeBrowsingManager.__setLookupMethod">__setLookupMethod</a></td>
86 <td>Private method to set the lookup method (Update API or Lookup API).</td>
87 </tr><tr>
88 <td><a href="#SafeBrowsingManager.__setPlatforms">__setPlatforms</a></td>
89 <td>Private method to set the platforms to be checked against.</td>
90 </tr><tr>
91 <td><a href="#SafeBrowsingManager.__showNotificationMessage">__showNotificationMessage</a></td>
92 <td>Private method to show some message in a notification widget.</td>
93 </tr><tr>
94 <td><a href="#SafeBrowsingManager.__syncFullHashes">__syncFullHashes</a></td>
95 <td>Private method to download full hashes matching given prefixes.</td>
96 </tr><tr>
97 <td><a href="#SafeBrowsingManager.__threatListsUpdateTimerTimeout">__threatListsUpdateTimerTimeout</a></td>
98 <td>Private slot to perform the auto update of the threat lists.</td>
99 </tr><tr>
100 <td><a href="#SafeBrowsingManager.__verifyThreatListChecksum">__verifyThreatListChecksum</a></td>
101 <td>Private method to verify the local checksum of a threat list with the checksum of the safe browsing server.</td>
102 </tr><tr>
103 <td><a href="#SafeBrowsingManager.close">close</a></td>
104 <td>Public method to close the safe browsing interface.</td>
105 </tr><tr>
106 <td><a href="#SafeBrowsingManager.configurationChanged">configurationChanged</a></td>
107 <td>Public method to handle changes of the settings.</td>
108 </tr><tr>
109 <td><a href="#SafeBrowsingManager.fairUseDelayExpired">fairUseDelayExpired</a></td>
110 <td>Public method to check, if the fair use wait period has expired.</td>
111 </tr><tr>
112 <td><a href="#SafeBrowsingManager.fullCacheCleanup">fullCacheCleanup</a></td>
113 <td>Public method to clean up the cache completely.</td>
114 </tr><tr>
115 <td><a href="#SafeBrowsingManager.getPlatformString">getPlatformString</a></td>
116 <td>Public method to get the platform string for a given platform type.</td>
117 </tr><tr>
118 <td><a href="#SafeBrowsingManager.getThreatEntryString">getThreatEntryString</a></td>
119 <td>Public method to get the threat entry string.</td>
120 </tr><tr>
121 <td><a href="#SafeBrowsingManager.getThreatMessage">getThreatMessage</a></td>
122 <td>Public method to get a warning message for the given threat type.</td>
123 </tr><tr>
124 <td><a href="#SafeBrowsingManager.getThreatMessages">getThreatMessages</a></td>
125 <td>Public method to get threat messages for the given threats.</td>
126 </tr><tr>
127 <td><a href="#SafeBrowsingManager.getThreatType">getThreatType</a></td>
128 <td>Public method to get a display string for a given threat type.</td>
129 </tr><tr>
130 <td><a href="#SafeBrowsingManager.isUpdatingThreatLists">isUpdatingThreatLists</a></td>
131 <td>Public method to check, if we are in the process of updating the threat lists.</td>
132 </tr><tr>
133 <td><a href="#SafeBrowsingManager.lookupUrl">lookupUrl</a></td>
134 <td>Public method to lookup an URL.</td>
135 </tr><tr>
136 <td><a href="#SafeBrowsingManager.showSafeBrowsingDialog">showSafeBrowsingDialog</a></td>
137 <td>Public slot to show the safe browsing management dialog.</td>
138 </tr><tr>
139 <td><a href="#SafeBrowsingManager.updateHashPrefixCache">updateHashPrefixCache</a></td>
140 <td>Public method to load or update the locally cached threat lists.</td>
141 </tr>
142 </table>
143 <h3>Static Methods</h3>
144 <table>
145 <tr><td>None</td></tr>
146 </table>
147 <a NAME="SafeBrowsingManager.getIgnoreSchemes" ID="SafeBrowsingManager.getIgnoreSchemes"></a>
148 <h4>SafeBrowsingManager.getIgnoreSchemes (class method)</h4>
149 <b>getIgnoreSchemes</b>(<i></i>)
150 <p>
151 Class method to get the schemes not to be checked.
152 </p><dl>
153 <dt>Returns:</dt>
154 <dd>
155 list of schemes to be ignored
156 </dd>
157 </dl><dl>
158 <dt>Return Type:</dt>
159 <dd>
160 list of str
161 </dd>
162 </dl><a NAME="SafeBrowsingManager.isEnabled" ID="SafeBrowsingManager.isEnabled"></a>
163 <h4>SafeBrowsingManager.isEnabled (class method)</h4>
164 <b>isEnabled</b>(<i></i>)
165 <p>
166 Class method to check, if safe browsing is enabled.
167 </p><dl>
168 <dt>Returns:</dt>
169 <dd>
170 flag indicating the enabled state
171 </dd>
172 </dl><dl>
173 <dt>Return Type:</dt>
174 <dd>
175 bool
176 </dd>
177 </dl><a NAME="SafeBrowsingManager.__init__" ID="SafeBrowsingManager.__init__"></a>
178 <h4>SafeBrowsingManager (Constructor)</h4>
179 <b>SafeBrowsingManager</b>(<i></i>)
180 <p>
181 Constructor
182 </p><a NAME="SafeBrowsingManager.__lookupHashes" ID="SafeBrowsingManager.__lookupHashes"></a>
183 <h4>SafeBrowsingManager.__lookupHashes</h4>
184 <b>__lookupHashes</b>(<i>fullHashes</i>)
185 <p>
186 Private method to lookup the given hashes.
187 </p><dl>
188 <dt><i>fullHashes</i> (list of bytes)</dt>
189 <dd>
190 list of hashes to lookup
191 </dd>
192 </dl><dl>
193 <dt>Returns:</dt>
194 <dd>
195 names of threat lists hashes were found in
196 </dd>
197 </dl><dl>
198 <dt>Return Type:</dt>
199 <dd>
200 list of ThreatList
201 </dd>
202 </dl><a NAME="SafeBrowsingManager.__setAutoUpdateThreatLists" ID="SafeBrowsingManager.__setAutoUpdateThreatLists"></a>
203 <h4>SafeBrowsingManager.__setAutoUpdateThreatLists</h4>
204 <b>__setAutoUpdateThreatLists</b>(<i></i>)
205 <p>
206 Private method to set auto update for the threat lists.
207 </p><a NAME="SafeBrowsingManager.__setLookupMethod" ID="SafeBrowsingManager.__setLookupMethod"></a>
208 <h4>SafeBrowsingManager.__setLookupMethod</h4>
209 <b>__setLookupMethod</b>(<i></i>)
210 <p>
211 Private method to set the lookup method (Update API or Lookup API).
212 </p><a NAME="SafeBrowsingManager.__setPlatforms" ID="SafeBrowsingManager.__setPlatforms"></a>
213 <h4>SafeBrowsingManager.__setPlatforms</h4>
214 <b>__setPlatforms</b>(<i></i>)
215 <p>
216 Private method to set the platforms to be checked against.
217 </p><a NAME="SafeBrowsingManager.__showNotificationMessage" ID="SafeBrowsingManager.__showNotificationMessage"></a>
218 <h4>SafeBrowsingManager.__showNotificationMessage</h4>
219 <b>__showNotificationMessage</b>(<i>message, timeout=5</i>)
220 <p>
221 Private method to show some message in a notification widget.
222 </p><p>
223 If desktop notifications have been disabled, the message will
224 be shown in the status bar of the main window (either the main
225 web browser window or the eric main window)
226 </p><dl>
227 <dt><i>message</i> (str)</dt>
228 <dd>
229 message to be shown
230 </dd><dt><i>timeout</i> (int)</dt>
231 <dd>
232 amount of time in seconds the message should be shown
233 (0 = indefinitely)
234 </dd>
235 </dl><a NAME="SafeBrowsingManager.__syncFullHashes" ID="SafeBrowsingManager.__syncFullHashes"></a>
236 <h4>SafeBrowsingManager.__syncFullHashes</h4>
237 <b>__syncFullHashes</b>(<i>hashPrefixes</i>)
238 <p>
239 Private method to download full hashes matching given prefixes.
240 </p><p>
241 This also updates the cache expiration timestamps.
242 </p><dl>
243 <dt><i>hashPrefixes</i> (list of bytes)</dt>
244 <dd>
245 list of hash prefixes to get full hashes for
246 </dd>
247 </dl><a NAME="SafeBrowsingManager.__threatListsUpdateTimerTimeout" ID="SafeBrowsingManager.__threatListsUpdateTimerTimeout"></a>
248 <h4>SafeBrowsingManager.__threatListsUpdateTimerTimeout</h4>
249 <b>__threatListsUpdateTimerTimeout</b>(<i></i>)
250 <p>
251 Private slot to perform the auto update of the threat lists.
252 </p><a NAME="SafeBrowsingManager.__verifyThreatListChecksum" ID="SafeBrowsingManager.__verifyThreatListChecksum"></a>
253 <h4>SafeBrowsingManager.__verifyThreatListChecksum</h4>
254 <b>__verifyThreatListChecksum</b>(<i>threatList, remoteChecksum</i>)
255 <p>
256 Private method to verify the local checksum of a threat list with the
257 checksum of the safe browsing server.
258 </p><dl>
259 <dt><i>threatList</i> (ThreatList)</dt>
260 <dd>
261 threat list to calculate checksum for
262 </dd><dt><i>remoteChecksum</i> (bytes)</dt>
263 <dd>
264 SHA256 checksum as reported by the Google server
265 </dd>
266 </dl><dl>
267 <dt>Returns:</dt>
268 <dd>
269 flag indicating equality
270 </dd>
271 </dl><dl>
272 <dt>Return Type:</dt>
273 <dd>
274 bool
275 </dd>
276 </dl><a NAME="SafeBrowsingManager.close" ID="SafeBrowsingManager.close"></a>
277 <h4>SafeBrowsingManager.close</h4>
278 <b>close</b>(<i></i>)
279 <p>
280 Public method to close the safe browsing interface.
281 </p><a NAME="SafeBrowsingManager.configurationChanged" ID="SafeBrowsingManager.configurationChanged"></a>
282 <h4>SafeBrowsingManager.configurationChanged</h4>
283 <b>configurationChanged</b>(<i></i>)
284 <p>
285 Public method to handle changes of the settings.
286 </p><a NAME="SafeBrowsingManager.fairUseDelayExpired" ID="SafeBrowsingManager.fairUseDelayExpired"></a>
287 <h4>SafeBrowsingManager.fairUseDelayExpired</h4>
288 <b>fairUseDelayExpired</b>(<i></i>)
289 <p>
290 Public method to check, if the fair use wait period has expired.
291 </p><dl>
292 <dt>Returns:</dt>
293 <dd>
294 flag indicating expiration
295 </dd>
296 </dl><dl>
297 <dt>Return Type:</dt>
298 <dd>
299 bool
300 </dd>
301 </dl><a NAME="SafeBrowsingManager.fullCacheCleanup" ID="SafeBrowsingManager.fullCacheCleanup"></a>
302 <h4>SafeBrowsingManager.fullCacheCleanup</h4>
303 <b>fullCacheCleanup</b>(<i></i>)
304 <p>
305 Public method to clean up the cache completely.
306 </p><a NAME="SafeBrowsingManager.getPlatformString" ID="SafeBrowsingManager.getPlatformString"></a>
307 <h4>SafeBrowsingManager.getPlatformString</h4>
308 <b>getPlatformString</b>(<i>platformType</i>)
309 <p>
310 Public method to get the platform string for a given platform type.
311 </p><dl>
312 <dt><i>platformType</i> (str)</dt>
313 <dd>
314 platform type as defined in the v4 API
315 </dd>
316 </dl><dl>
317 <dt>Returns:</dt>
318 <dd>
319 platform string
320 </dd>
321 </dl><dl>
322 <dt>Return Type:</dt>
323 <dd>
324 str
325 </dd>
326 </dl><a NAME="SafeBrowsingManager.getThreatEntryString" ID="SafeBrowsingManager.getThreatEntryString"></a>
327 <h4>SafeBrowsingManager.getThreatEntryString</h4>
328 <b>getThreatEntryString</b>(<i>threatEntry</i>)
329 <p>
330 Public method to get the threat entry string.
331 </p><dl>
332 <dt><i>threatEntry</i> (str)</dt>
333 <dd>
334 threat entry type as defined in the v4 API
335 </dd>
336 </dl><dl>
337 <dt>Returns:</dt>
338 <dd>
339 threat entry string
340 </dd>
341 </dl><dl>
342 <dt>Return Type:</dt>
343 <dd>
344 str
345 </dd>
346 </dl><a NAME="SafeBrowsingManager.getThreatMessage" ID="SafeBrowsingManager.getThreatMessage"></a>
347 <h4>SafeBrowsingManager.getThreatMessage</h4>
348 <b>getThreatMessage</b>(<i>threatType</i>)
349 <p>
350 Public method to get a warning message for the given threat type.
351 </p><dl>
352 <dt><i>threatType</i> (str)</dt>
353 <dd>
354 threat type to get the message for
355 </dd>
356 </dl><dl>
357 <dt>Returns:</dt>
358 <dd>
359 threat message
360 </dd>
361 </dl><dl>
362 <dt>Return Type:</dt>
363 <dd>
364 str
365 </dd>
366 </dl><a NAME="SafeBrowsingManager.getThreatMessages" ID="SafeBrowsingManager.getThreatMessages"></a>
367 <h4>SafeBrowsingManager.getThreatMessages</h4>
368 <b>getThreatMessages</b>(<i>threatLists</i>)
369 <p>
370 Public method to get threat messages for the given threats.
371 </p><dl>
372 <dt><i>threatLists</i> (list of ThreatList)</dt>
373 <dd>
374 list of threat lists to get a message for
375 </dd>
376 </dl><dl>
377 <dt>Returns:</dt>
378 <dd>
379 list of threat messages, one per unique threat type
380 </dd>
381 </dl><dl>
382 <dt>Return Type:</dt>
383 <dd>
384 list of str
385 </dd>
386 </dl><a NAME="SafeBrowsingManager.getThreatType" ID="SafeBrowsingManager.getThreatType"></a>
387 <h4>SafeBrowsingManager.getThreatType</h4>
388 <b>getThreatType</b>(<i>threatList</i>)
389 <p>
390 Public method to get a display string for a given threat type.
391 </p><dl>
392 <dt><i>threatList</i> (str)</dt>
393 <dd>
394 threat list to get display string for
395 </dd>
396 </dl><dl>
397 <dt>Returns:</dt>
398 <dd>
399 display string
400 </dd>
401 </dl><dl>
402 <dt>Return Type:</dt>
403 <dd>
404 str
405 </dd>
406 </dl><a NAME="SafeBrowsingManager.isUpdatingThreatLists" ID="SafeBrowsingManager.isUpdatingThreatLists"></a>
407 <h4>SafeBrowsingManager.isUpdatingThreatLists</h4>
408 <b>isUpdatingThreatLists</b>(<i></i>)
409 <p>
410 Public method to check, if we are in the process of updating the
411 threat lists.
412 </p><dl>
413 <dt>Returns:</dt>
414 <dd>
415 flag indicating an update process is active
416 </dd>
417 </dl><dl>
418 <dt>Return Type:</dt>
419 <dd>
420 bool
421 </dd>
422 </dl><a NAME="SafeBrowsingManager.lookupUrl" ID="SafeBrowsingManager.lookupUrl"></a>
423 <h4>SafeBrowsingManager.lookupUrl</h4>
424 <b>lookupUrl</b>(<i>url</i>)
425 <p>
426 Public method to lookup an URL.
427 </p><dl>
428 <dt><i>url</i> (str or QUrl)</dt>
429 <dd>
430 URL to be checked
431 </dd>
432 </dl><dl>
433 <dt>Returns:</dt>
434 <dd>
435 tuple containing the list of threat lists the URL was found in
436 and an error message
437 </dd>
438 </dl><dl>
439 <dt>Return Type:</dt>
440 <dd>
441 tuple of (list of ThreatList, str)
442 </dd>
443 </dl><dl>
444 <dt>Raises <b>ValueError</b>:</dt>
445 <dd>
446 raised for an invalid URL
447 </dd>
448 </dl><a NAME="SafeBrowsingManager.showSafeBrowsingDialog" ID="SafeBrowsingManager.showSafeBrowsingDialog"></a>
449 <h4>SafeBrowsingManager.showSafeBrowsingDialog</h4>
450 <b>showSafeBrowsingDialog</b>(<i></i>)
451 <p>
452 Public slot to show the safe browsing management dialog.
453 </p><a NAME="SafeBrowsingManager.updateHashPrefixCache" ID="SafeBrowsingManager.updateHashPrefixCache"></a>
454 <h4>SafeBrowsingManager.updateHashPrefixCache</h4>
455 <b>updateHashPrefixCache</b>(<i></i>)
456 <p>
457 Public method to load or update the locally cached threat lists.
458 </p><dl>
459 <dt>Returns:</dt>
460 <dd>
461 flag indicating success and an error message
462 </dd>
463 </dl><dl>
464 <dt>Return Type:</dt>
465 <dd>
466 tuple of (bool, str)
467 </dd>
468 </dl>
469 <div align="right"><a href="#top">Up</a></div>
470 <hr />
471 </body></html>

eric ide

mercurial