WebBrowser/SafeBrowsing/SafeBrowsingManager.py

changeset 6187
2cc7e3629784
parent 6093
5ed91fe54bc9
child 6229
72b40274a3b6
equal deleted inserted replaced
6186:83451f10f3eb 6187:2cc7e3629784
244 self.__cache.cleanupFullHashes() 244 self.__cache.cleanupFullHashes()
245 QCoreApplication.processEvents() 245 QCoreApplication.processEvents()
246 246
247 # step 2: update threat lists 247 # step 2: update threat lists
248 threatListsForRemove = {} 248 threatListsForRemove = {}
249 for threatList, clientState in self.__cache.getThreatLists(): 249 for threatList, _clientState in self.__cache.getThreatLists():
250 threatListsForRemove[repr(threatList)] = threatList 250 threatListsForRemove[repr(threatList)] = threatList
251 threatLists = self.__apiClient.getThreatLists() 251 threatLists = self.__apiClient.getThreatLists()
252 maximum = len(threatLists) 252 maximum = len(threatLists)
253 current = 0 253 current = 0
254 self.progressMessage.emit(self.tr("Updating threat lists"), maximum) 254 self.progressMessage.emit(self.tr("Updating threat lists"), maximum)
402 402
403 matchingPrefixes = {} 403 matchingPrefixes = {}
404 matchingFullHashes = set() 404 matchingFullHashes = set()
405 isPotentialThreat = False 405 isPotentialThreat = False
406 # Lookup hash prefixes which match full URL hash 406 # Lookup hash prefixes which match full URL hash
407 for threatList, hashPrefix, negativeCacheExpired in \ 407 for _threatList, hashPrefix, negativeCacheExpired in \
408 self.__cache.lookupHashPrefix(cues): 408 self.__cache.lookupHashPrefix(cues):
409 for fullHash in fullHashes: 409 for fullHash in fullHashes:
410 if fullHash.startswith(hashPrefix): 410 if fullHash.startswith(hashPrefix):
411 isPotentialThreat = True 411 isPotentialThreat = True
412 # consider hash prefix negative cache as expired if it 412 # consider hash prefix negative cache as expired if it
484 malwareThreatType) 484 malwareThreatType)
485 485
486 negativeCacheDuration = int( 486 negativeCacheDuration = int(
487 fullHashResponses["negativeCacheDuration"].rstrip("s")) 487 fullHashResponses["negativeCacheDuration"].rstrip("s"))
488 for prefixValue in hashPrefixes: 488 for prefixValue in hashPrefixes:
489 for threatList, clientState in threatLists: 489 for threatList, _clientState in threatLists:
490 self.__cache.updateHashPrefixExpiration( 490 self.__cache.updateHashPrefixExpiration(
491 threatList, prefixValue, negativeCacheDuration) 491 threatList, prefixValue, negativeCacheDuration)
492 492
493 @classmethod 493 @classmethod
494 def getIgnoreSchemes(cls): 494 def getIgnoreSchemes(cls):

eric ide

mercurial