src/eric7/Documentation/Source/eric7.WebBrowser.SafeBrowsing.SafeBrowsingCache.html

branch
eric7
changeset 10479
856476537696
parent 9209
b99e7fd55fd3
child 10503
6a37b6ac3928
equal deleted inserted replaced
10478:de9106c55c3d 10479:856476537696
5 <link rel="stylesheet" href="styles.css"> 5 <link rel="stylesheet" href="styles.css">
6 </head> 6 </head>
7 <body> 7 <body>
8 <a NAME="top" ID="top"></a> 8 <a NAME="top" ID="top"></a>
9 <h1>eric7.WebBrowser.SafeBrowsing.SafeBrowsingCache</h1> 9 <h1>eric7.WebBrowser.SafeBrowsing.SafeBrowsingCache</h1>
10
11 <p> 10 <p>
12 Module implementing a cache for Google Safe Browsing. 11 Module implementing a cache for Google Safe Browsing.
13 </p> 12 </p>
13
14 <h3>Global Attributes</h3> 14 <h3>Global Attributes</h3>
15
16 <table> 15 <table>
17 <tr><td>None</td></tr> 16 <tr><td>None</td></tr>
18 </table> 17 </table>
18
19 <h3>Classes</h3> 19 <h3>Classes</h3>
20 20 <table>
21 <table>
22
23 <tr> 21 <tr>
24 <td><a href="#SafeBrowsingCache">SafeBrowsingCache</a></td> 22 <td><a href="#SafeBrowsingCache">SafeBrowsingCache</a></td>
25 <td>Class implementing a cache for Google Safe Browsing.</td> 23 <td>Class implementing a cache for Google Safe Browsing.</td>
26 </tr> 24 </tr>
27 </table> 25 </table>
26
28 <h3>Functions</h3> 27 <h3>Functions</h3>
29
30 <table> 28 <table>
31 <tr><td>None</td></tr> 29 <tr><td>None</td></tr>
32 </table> 30 </table>
31
33 <hr /> 32 <hr />
34 <hr /> 33 <hr />
35 <a NAME="SafeBrowsingCache" ID="SafeBrowsingCache"></a> 34 <a NAME="SafeBrowsingCache" ID="SafeBrowsingCache"></a>
36 <h2>SafeBrowsingCache</h2> 35 <h2>SafeBrowsingCache</h2>
37
38 <p> 36 <p>
39 Class implementing a cache for Google Safe Browsing. 37 Class implementing a cache for Google Safe Browsing.
40 </p> 38 </p>
39
41 <h3>Derived from</h3> 40 <h3>Derived from</h3>
42 QObject 41 QObject
43 <h3>Class Attributes</h3> 42 <h3>Class Attributes</h3>
44 43 <table>
45 <table> 44 <tr><td>create_full_hash_cue_idx</td></tr>
46 <tr><td>create_full_hash_cue_idx</td></tr><tr><td>create_full_hash_expires_idx</td></tr><tr><td>create_full_hash_value_idx</td></tr><tr><td>create_full_hashes_stmt</td></tr><tr><td>create_hash_prefix_stmt</td></tr><tr><td>create_threat_list_stmt</td></tr><tr><td>drop_full_hash_cue_idx</td></tr><tr><td>drop_full_hash_expires_idx</td></tr><tr><td>drop_full_hash_value_idx</td></tr><tr><td>drop_full_hashes_stmt</td></tr><tr><td>drop_hash_prefix_stmt</td></tr><tr><td>drop_threat_list_stmt</td></tr><tr><td>maxProcessEventsTime</td></tr> 45 <tr><td>create_full_hash_expires_idx</td></tr>
47 </table> 46 <tr><td>create_full_hash_value_idx</td></tr>
47 <tr><td>create_full_hashes_stmt</td></tr>
48 <tr><td>create_hash_prefix_stmt</td></tr>
49 <tr><td>create_threat_list_stmt</td></tr>
50 <tr><td>drop_full_hash_cue_idx</td></tr>
51 <tr><td>drop_full_hash_expires_idx</td></tr>
52 <tr><td>drop_full_hash_value_idx</td></tr>
53 <tr><td>drop_full_hashes_stmt</td></tr>
54 <tr><td>drop_hash_prefix_stmt</td></tr>
55 <tr><td>drop_threat_list_stmt</td></tr>
56 <tr><td>maxProcessEventsTime</td></tr>
57 </table>
58
48 <h3>Class Methods</h3> 59 <h3>Class Methods</h3>
49
50 <table> 60 <table>
51 <tr><td>None</td></tr> 61 <tr><td>None</td></tr>
52 </table> 62 </table>
63
53 <h3>Methods</h3> 64 <h3>Methods</h3>
54 65 <table>
55 <table>
56
57 <tr> 66 <tr>
58 <td><a href="#SafeBrowsingCache.__init__">SafeBrowsingCache</a></td> 67 <td><a href="#SafeBrowsingCache.__init__">SafeBrowsingCache</a></td>
59 <td>Constructor</td> 68 <td>Constructor</td>
60 </tr> 69 </tr>
61 <tr> 70 <tr>
125 <tr> 134 <tr>
126 <td><a href="#SafeBrowsingCache.updateThreatListClientState">updateThreatListClientState</a></td> 135 <td><a href="#SafeBrowsingCache.updateThreatListClientState">updateThreatListClientState</a></td>
127 <td>Public method to update the client state of a threat list.</td> 136 <td>Public method to update the client state of a threat list.</td>
128 </tr> 137 </tr>
129 </table> 138 </table>
139
130 <h3>Static Methods</h3> 140 <h3>Static Methods</h3>
131
132 <table> 141 <table>
133 <tr><td>None</td></tr> 142 <tr><td>None</td></tr>
134 </table> 143 </table>
144
135 145
136 <a NAME="SafeBrowsingCache.__init__" ID="SafeBrowsingCache.__init__"></a> 146 <a NAME="SafeBrowsingCache.__init__" ID="SafeBrowsingCache.__init__"></a>
137 <h4>SafeBrowsingCache (Constructor)</h4> 147 <h4>SafeBrowsingCache (Constructor)</h4>
138 <b>SafeBrowsingCache</b>(<i>dbPath, parent=None</i>) 148 <b>SafeBrowsingCache</b>(<i>dbPath, parent=None</i>)
139
140 <p> 149 <p>
141 Constructor 150 Constructor
142 </p> 151 </p>
152
143 <dl> 153 <dl>
144 154
145 <dt><i>dbPath</i> (str)</dt> 155 <dt><i>dbPath</i> (str)</dt>
146 <dd> 156 <dd>
147 path to store the cache DB into 157 path to store the cache DB into
152 </dd> 162 </dd>
153 </dl> 163 </dl>
154 <a NAME="SafeBrowsingCache.__openCacheDb" ID="SafeBrowsingCache.__openCacheDb"></a> 164 <a NAME="SafeBrowsingCache.__openCacheDb" ID="SafeBrowsingCache.__openCacheDb"></a>
155 <h4>SafeBrowsingCache.__openCacheDb</h4> 165 <h4>SafeBrowsingCache.__openCacheDb</h4>
156 <b>__openCacheDb</b>(<i></i>) 166 <b>__openCacheDb</b>(<i></i>)
157
158 <p> 167 <p>
159 Private method to open the cache database. 168 Private method to open the cache database.
160 </p> 169 </p>
170
161 <dl> 171 <dl>
162 <dt>Return:</dt> 172 <dt>Return:</dt>
163 <dd> 173 <dd>
164 flag indicating the open state 174 flag indicating the open state
165 </dd> 175 </dd>
171 </dd> 181 </dd>
172 </dl> 182 </dl>
173 <a NAME="SafeBrowsingCache.addThreatList" ID="SafeBrowsingCache.addThreatList"></a> 183 <a NAME="SafeBrowsingCache.addThreatList" ID="SafeBrowsingCache.addThreatList"></a>
174 <h4>SafeBrowsingCache.addThreatList</h4> 184 <h4>SafeBrowsingCache.addThreatList</h4>
175 <b>addThreatList</b>(<i>threatList</i>) 185 <b>addThreatList</b>(<i>threatList</i>)
176
177 <p> 186 <p>
178 Public method to add a threat list to the cache. 187 Public method to add a threat list to the cache.
179 </p> 188 </p>
189
180 <dl> 190 <dl>
181 191
182 <dt><i>threatList</i> (ThreatList)</dt> 192 <dt><i>threatList</i> (ThreatList)</dt>
183 <dd> 193 <dd>
184 threat list to be added 194 threat list to be added
185 </dd> 195 </dd>
186 </dl> 196 </dl>
187 <a NAME="SafeBrowsingCache.cleanupFullHashes" ID="SafeBrowsingCache.cleanupFullHashes"></a> 197 <a NAME="SafeBrowsingCache.cleanupFullHashes" ID="SafeBrowsingCache.cleanupFullHashes"></a>
188 <h4>SafeBrowsingCache.cleanupFullHashes</h4> 198 <h4>SafeBrowsingCache.cleanupFullHashes</h4>
189 <b>cleanupFullHashes</b>(<i>keepExpiredFor=43200</i>) 199 <b>cleanupFullHashes</b>(<i>keepExpiredFor=43200</i>)
190
191 <p> 200 <p>
192 Public method to clean up full hash entries expired more than the 201 Public method to clean up full hash entries expired more than the
193 given time. 202 given time.
194 </p> 203 </p>
204
195 <dl> 205 <dl>
196 206
197 <dt><i>keepExpiredFor</i> (int or float)</dt> 207 <dt><i>keepExpiredFor</i> (int or float)</dt>
198 <dd> 208 <dd>
199 time period in seconds of entries to be expired 209 time period in seconds of entries to be expired
200 </dd> 210 </dd>
201 </dl> 211 </dl>
202 <a NAME="SafeBrowsingCache.close" ID="SafeBrowsingCache.close"></a> 212 <a NAME="SafeBrowsingCache.close" ID="SafeBrowsingCache.close"></a>
203 <h4>SafeBrowsingCache.close</h4> 213 <h4>SafeBrowsingCache.close</h4>
204 <b>close</b>(<i></i>) 214 <b>close</b>(<i></i>)
205
206 <p> 215 <p>
207 Public method to close the database. 216 Public method to close the database.
208 </p> 217 </p>
218
209 <a NAME="SafeBrowsingCache.deleteHashPrefixList" ID="SafeBrowsingCache.deleteHashPrefixList"></a> 219 <a NAME="SafeBrowsingCache.deleteHashPrefixList" ID="SafeBrowsingCache.deleteHashPrefixList"></a>
210 <h4>SafeBrowsingCache.deleteHashPrefixList</h4> 220 <h4>SafeBrowsingCache.deleteHashPrefixList</h4>
211 <b>deleteHashPrefixList</b>(<i>threatList</i>) 221 <b>deleteHashPrefixList</b>(<i>threatList</i>)
212
213 <p> 222 <p>
214 Public method to delete hash prefixes for a given threat list. 223 Public method to delete hash prefixes for a given threat list.
215 </p> 224 </p>
225
216 <dl> 226 <dl>
217 227
218 <dt><i>threatList</i> (ThreatList)</dt> 228 <dt><i>threatList</i> (ThreatList)</dt>
219 <dd> 229 <dd>
220 threat list info object 230 threat list info object
221 </dd> 231 </dd>
222 </dl> 232 </dl>
223 <a NAME="SafeBrowsingCache.deleteThreatList" ID="SafeBrowsingCache.deleteThreatList"></a> 233 <a NAME="SafeBrowsingCache.deleteThreatList" ID="SafeBrowsingCache.deleteThreatList"></a>
224 <h4>SafeBrowsingCache.deleteThreatList</h4> 234 <h4>SafeBrowsingCache.deleteThreatList</h4>
225 <b>deleteThreatList</b>(<i>threatList</i>) 235 <b>deleteThreatList</b>(<i>threatList</i>)
226
227 <p> 236 <p>
228 Public method to delete a threat list from the cache. 237 Public method to delete a threat list from the cache.
229 </p> 238 </p>
239
230 <dl> 240 <dl>
231 241
232 <dt><i>threatList</i> (ThreatList)</dt> 242 <dt><i>threatList</i> (ThreatList)</dt>
233 <dd> 243 <dd>
234 threat list to be deleted 244 threat list to be deleted
235 </dd> 245 </dd>
236 </dl> 246 </dl>
237 <a NAME="SafeBrowsingCache.getHashPrefixValuesToRemove" ID="SafeBrowsingCache.getHashPrefixValuesToRemove"></a> 247 <a NAME="SafeBrowsingCache.getHashPrefixValuesToRemove" ID="SafeBrowsingCache.getHashPrefixValuesToRemove"></a>
238 <h4>SafeBrowsingCache.getHashPrefixValuesToRemove</h4> 248 <h4>SafeBrowsingCache.getHashPrefixValuesToRemove</h4>
239 <b>getHashPrefixValuesToRemove</b>(<i>threatList, indexes</i>) 249 <b>getHashPrefixValuesToRemove</b>(<i>threatList, indexes</i>)
240
241 <p> 250 <p>
242 Public method to get the hash prefix values to be removed from the 251 Public method to get the hash prefix values to be removed from the
243 cache. 252 cache.
244 </p> 253 </p>
254
245 <dl> 255 <dl>
246 256
247 <dt><i>threatList</i> (ThreatList)</dt> 257 <dt><i>threatList</i> (ThreatList)</dt>
248 <dd> 258 <dd>
249 threat list to remove prefixes from 259 threat list to remove prefixes from
266 </dd> 276 </dd>
267 </dl> 277 </dl>
268 <a NAME="SafeBrowsingCache.getThreatLists" ID="SafeBrowsingCache.getThreatLists"></a> 278 <a NAME="SafeBrowsingCache.getThreatLists" ID="SafeBrowsingCache.getThreatLists"></a>
269 <h4>SafeBrowsingCache.getThreatLists</h4> 279 <h4>SafeBrowsingCache.getThreatLists</h4>
270 <b>getThreatLists</b>(<i></i>) 280 <b>getThreatLists</b>(<i></i>)
271
272 <p> 281 <p>
273 Public method to get the available threat lists. 282 Public method to get the available threat lists.
274 </p> 283 </p>
284
275 <dl> 285 <dl>
276 <dt>Return:</dt> 286 <dt>Return:</dt>
277 <dd> 287 <dd>
278 list of available threat lists 288 list of available threat lists
279 </dd> 289 </dd>
285 </dd> 295 </dd>
286 </dl> 296 </dl>
287 <a NAME="SafeBrowsingCache.hashPrefixListChecksum" ID="SafeBrowsingCache.hashPrefixListChecksum"></a> 297 <a NAME="SafeBrowsingCache.hashPrefixListChecksum" ID="SafeBrowsingCache.hashPrefixListChecksum"></a>
288 <h4>SafeBrowsingCache.hashPrefixListChecksum</h4> 298 <h4>SafeBrowsingCache.hashPrefixListChecksum</h4>
289 <b>hashPrefixListChecksum</b>(<i>threatList</i>) 299 <b>hashPrefixListChecksum</b>(<i>threatList</i>)
290
291 <p> 300 <p>
292 Public method to calculate the SHA256 checksum for an alphabetically 301 Public method to calculate the SHA256 checksum for an alphabetically
293 sorted concatenated list of hash prefixes. 302 sorted concatenated list of hash prefixes.
294 </p> 303 </p>
304
295 <dl> 305 <dl>
296 306
297 <dt><i>threatList</i> (ThreatList)</dt> 307 <dt><i>threatList</i> (ThreatList)</dt>
298 <dd> 308 <dd>
299 threat list to calculate checksum for 309 threat list to calculate checksum for
312 </dd> 322 </dd>
313 </dl> 323 </dl>
314 <a NAME="SafeBrowsingCache.lookupFullHashes" ID="SafeBrowsingCache.lookupFullHashes"></a> 324 <a NAME="SafeBrowsingCache.lookupFullHashes" ID="SafeBrowsingCache.lookupFullHashes"></a>
315 <h4>SafeBrowsingCache.lookupFullHashes</h4> 325 <h4>SafeBrowsingCache.lookupFullHashes</h4>
316 <b>lookupFullHashes</b>(<i>hashValues</i>) 326 <b>lookupFullHashes</b>(<i>hashValues</i>)
317
318 <p> 327 <p>
319 Public method to get a list of threat lists and expiration flag 328 Public method to get a list of threat lists and expiration flag
320 for the given hashes if a hash is blacklisted. 329 for the given hashes if a hash is blacklisted.
321 </p> 330 </p>
331
322 <dl> 332 <dl>
323 333
324 <dt><i>hashValues</i> (list of bytes)</dt> 334 <dt><i>hashValues</i> (list of bytes)</dt>
325 <dd> 335 <dd>
326 list of hash values to look up 336 list of hash values to look up
340 </dd> 350 </dd>
341 </dl> 351 </dl>
342 <a NAME="SafeBrowsingCache.lookupHashPrefix" ID="SafeBrowsingCache.lookupHashPrefix"></a> 352 <a NAME="SafeBrowsingCache.lookupHashPrefix" ID="SafeBrowsingCache.lookupHashPrefix"></a>
343 <h4>SafeBrowsingCache.lookupHashPrefix</h4> 353 <h4>SafeBrowsingCache.lookupHashPrefix</h4>
344 <b>lookupHashPrefix</b>(<i>prefixes</i>) 354 <b>lookupHashPrefix</b>(<i>prefixes</i>)
345
346 <p> 355 <p>
347 Public method to look up hash prefixes in the local cache. 356 Public method to look up hash prefixes in the local cache.
348 </p> 357 </p>
358
349 <dl> 359 <dl>
350 360
351 <dt><i>prefixes</i> (list of bytes)</dt> 361 <dt><i>prefixes</i> (list of bytes)</dt>
352 <dd> 362 <dd>
353 list of hash prefixes to look up 363 list of hash prefixes to look up
367 </dd> 377 </dd>
368 </dl> 378 </dl>
369 <a NAME="SafeBrowsingCache.populateHashPrefixList" ID="SafeBrowsingCache.populateHashPrefixList"></a> 379 <a NAME="SafeBrowsingCache.populateHashPrefixList" ID="SafeBrowsingCache.populateHashPrefixList"></a>
370 <h4>SafeBrowsingCache.populateHashPrefixList</h4> 380 <h4>SafeBrowsingCache.populateHashPrefixList</h4>
371 <b>populateHashPrefixList</b>(<i>threatList, prefixes</i>) 381 <b>populateHashPrefixList</b>(<i>threatList, prefixes</i>)
372
373 <p> 382 <p>
374 Public method to populate the hash prefixes for a threat list. 383 Public method to populate the hash prefixes for a threat list.
375 </p> 384 </p>
385
376 <dl> 386 <dl>
377 387
378 <dt><i>threatList</i> (ThreatList)</dt> 388 <dt><i>threatList</i> (ThreatList)</dt>
379 <dd> 389 <dd>
380 threat list of the hash prefixes 390 threat list of the hash prefixes
385 </dd> 395 </dd>
386 </dl> 396 </dl>
387 <a NAME="SafeBrowsingCache.prepareCacheDb" ID="SafeBrowsingCache.prepareCacheDb"></a> 397 <a NAME="SafeBrowsingCache.prepareCacheDb" ID="SafeBrowsingCache.prepareCacheDb"></a>
388 <h4>SafeBrowsingCache.prepareCacheDb</h4> 398 <h4>SafeBrowsingCache.prepareCacheDb</h4>
389 <b>prepareCacheDb</b>(<i></i>) 399 <b>prepareCacheDb</b>(<i></i>)
390
391 <p> 400 <p>
392 Public method to prepare the cache database. 401 Public method to prepare the cache database.
393 </p> 402 </p>
403
394 <a NAME="SafeBrowsingCache.removeHashPrefixIndices" ID="SafeBrowsingCache.removeHashPrefixIndices"></a> 404 <a NAME="SafeBrowsingCache.removeHashPrefixIndices" ID="SafeBrowsingCache.removeHashPrefixIndices"></a>
395 <h4>SafeBrowsingCache.removeHashPrefixIndices</h4> 405 <h4>SafeBrowsingCache.removeHashPrefixIndices</h4>
396 <b>removeHashPrefixIndices</b>(<i>threatList, indexes</i>) 406 <b>removeHashPrefixIndices</b>(<i>threatList, indexes</i>)
397
398 <p> 407 <p>
399 Public method to remove hash prefixes from the cache. 408 Public method to remove hash prefixes from the cache.
400 </p> 409 </p>
410
401 <dl> 411 <dl>
402 412
403 <dt><i>threatList</i> (ThreatList)</dt> 413 <dt><i>threatList</i> (ThreatList)</dt>
404 <dd> 414 <dd>
405 threat list to delete hash prefixes of 415 threat list to delete hash prefixes of
410 </dd> 420 </dd>
411 </dl> 421 </dl>
412 <a NAME="SafeBrowsingCache.storeFullHash" ID="SafeBrowsingCache.storeFullHash"></a> 422 <a NAME="SafeBrowsingCache.storeFullHash" ID="SafeBrowsingCache.storeFullHash"></a>
413 <h4>SafeBrowsingCache.storeFullHash</h4> 423 <h4>SafeBrowsingCache.storeFullHash</h4>
414 <b>storeFullHash</b>(<i>threatList, hashValue, cacheDuration, malwareThreatType</i>) 424 <b>storeFullHash</b>(<i>threatList, hashValue, cacheDuration, malwareThreatType</i>)
415
416 <p> 425 <p>
417 Public method to store full hash data in the cache database. 426 Public method to store full hash data in the cache database.
418 </p> 427 </p>
428
419 <dl> 429 <dl>
420 430
421 <dt><i>threatList</i> (ThreatList)</dt> 431 <dt><i>threatList</i> (ThreatList)</dt>
422 <dd> 432 <dd>
423 threat list info object 433 threat list info object
436 </dd> 446 </dd>
437 </dl> 447 </dl>
438 <a NAME="SafeBrowsingCache.updateHashPrefixExpiration" ID="SafeBrowsingCache.updateHashPrefixExpiration"></a> 448 <a NAME="SafeBrowsingCache.updateHashPrefixExpiration" ID="SafeBrowsingCache.updateHashPrefixExpiration"></a>
439 <h4>SafeBrowsingCache.updateHashPrefixExpiration</h4> 449 <h4>SafeBrowsingCache.updateHashPrefixExpiration</h4>
440 <b>updateHashPrefixExpiration</b>(<i>threatList, hashPrefix, negativeCacheDuration</i>) 450 <b>updateHashPrefixExpiration</b>(<i>threatList, hashPrefix, negativeCacheDuration</i>)
441
442 <p> 451 <p>
443 Public method to update the hash prefix expiration time. 452 Public method to update the hash prefix expiration time.
444 </p> 453 </p>
454
445 <dl> 455 <dl>
446 456
447 <dt><i>threatList</i> (ThreatList)</dt> 457 <dt><i>threatList</i> (ThreatList)</dt>
448 <dd> 458 <dd>
449 threat list info object 459 threat list info object
459 </dd> 469 </dd>
460 </dl> 470 </dl>
461 <a NAME="SafeBrowsingCache.updateThreatListClientState" ID="SafeBrowsingCache.updateThreatListClientState"></a> 471 <a NAME="SafeBrowsingCache.updateThreatListClientState" ID="SafeBrowsingCache.updateThreatListClientState"></a>
462 <h4>SafeBrowsingCache.updateThreatListClientState</h4> 472 <h4>SafeBrowsingCache.updateThreatListClientState</h4>
463 <b>updateThreatListClientState</b>(<i>threatList, clientState</i>) 473 <b>updateThreatListClientState</b>(<i>threatList, clientState</i>)
464
465 <p> 474 <p>
466 Public method to update the client state of a threat list. 475 Public method to update the client state of a threat list.
467 </p> 476 </p>
477
468 <dl> 478 <dl>
469 479
470 <dt><i>threatList</i> (ThreatList)</dt> 480 <dt><i>threatList</i> (ThreatList)</dt>
471 <dd> 481 <dd>
472 threat list to update the client state for 482 threat list to update the client state for

eric ide

mercurial