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 |
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 |
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 |
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 |