Home ⌂Doc Index ◂Up ▴

eric6.WebBrowser.SafeBrowsing.SafeBrowsingManager

Module implementing the interface for Google Safe Browsing.

Global Attributes

None

Classes

SafeBrowsingManager Class implementing the interface for Google Safe Browsing.

Functions

None


SafeBrowsingManager

Class implementing the interface for Google Safe Browsing.

Signals

progress(current)
emitted to signal the current progress
progressMessage(message,maximum)
emitted to give a message for the action about to be performed and the maximum value

Derived from

QObject

Class Attributes

enabled

Class Methods

getIgnoreSchemes Class method to get the schemes not to be checked.
isEnabled Class method to check, if safe browsing is enabled.

Methods

SafeBrowsingManager Constructor
__lookupHashes Private method to lookup the given hashes.
__setAutoUpdateThreatLists Private method to set auto update for the threat lists.
__setLookupMethod Private method to set the lookup method (Update API or Lookup API).
__setPlatforms Private method to set the platforms to be checked against.
__showNotificationMessage Private method to show some message in a notification widget.
__syncFullHashes Private method to download full hashes matching given prefixes.
__threatListsUpdateTimerTimeout Private slot to perform the auto update of the threat lists.
__verifyThreatListChecksum Private method to verify the local checksum of a threat list with the checksum of the safe browsing server.
close Public method to close the safe browsing interface.
configurationChanged Public method to handle changes of the settings.
fairUseDelayExpired Public method to check, if the fair use wait period has expired.
fullCacheCleanup Public method to clean up the cache completely.
getPlatformString Public method to get the platform string for a given platform type.
getThreatEntryString Public method to get the threat entry string.
getThreatMessage Public method to get a warning message for the given threat type.
getThreatMessages Public method to get threat messages for the given threats.
getThreatType Public method to get a display string for a given threat type.
isUpdatingThreatLists Public method to check, if we are in the process of updating the threat lists.
lookupUrl Public method to lookup an URL.
showSafeBrowsingDialog Public slot to show the safe browsing management dialog.
updateHashPrefixCache Public method to load or update the locally cached threat lists.

Static Methods

None

SafeBrowsingManager.getIgnoreSchemes (class method)

getIgnoreSchemes()

Class method to get the schemes not to be checked.

Returns:
list of schemes to be ignored
Return Type:
list of str

SafeBrowsingManager.isEnabled (class method)

isEnabled()

Class method to check, if safe browsing is enabled.

Returns:
flag indicating the enabled state
Return Type:
bool

SafeBrowsingManager (Constructor)

SafeBrowsingManager()

Constructor

SafeBrowsingManager.__lookupHashes

__lookupHashes(fullHashes)

Private method to lookup the given hashes.

fullHashes (list of bytes)
list of hashes to lookup
Returns:
names of threat lists hashes were found in
Return Type:
list of ThreatList

SafeBrowsingManager.__setAutoUpdateThreatLists

__setAutoUpdateThreatLists()

Private method to set auto update for the threat lists.

SafeBrowsingManager.__setLookupMethod

__setLookupMethod()

Private method to set the lookup method (Update API or Lookup API).

SafeBrowsingManager.__setPlatforms

__setPlatforms()

Private method to set the platforms to be checked against.

SafeBrowsingManager.__showNotificationMessage

__showNotificationMessage(message, timeout=5)

Private method to show some message in a notification widget.

If desktop notifications have been disabled, the message will be shown in the status bar of the main window (either the main web browser window or the eric main window)

message (str)
message to be shown
timeout (int)
amount of time in seconds the message should be shown (0 = indefinitely)

SafeBrowsingManager.__syncFullHashes

__syncFullHashes(hashPrefixes)

Private method to download full hashes matching given prefixes.

This also updates the cache expiration timestamps.

hashPrefixes (list of bytes)
list of hash prefixes to get full hashes for

SafeBrowsingManager.__threatListsUpdateTimerTimeout

__threatListsUpdateTimerTimeout()

Private slot to perform the auto update of the threat lists.

SafeBrowsingManager.__verifyThreatListChecksum

__verifyThreatListChecksum(threatList, remoteChecksum)

Private method to verify the local checksum of a threat list with the checksum of the safe browsing server.

threatList (ThreatList)
threat list to calculate checksum for
remoteChecksum (bytes)
SHA256 checksum as reported by the Google server
Returns:
flag indicating equality
Return Type:
bool

SafeBrowsingManager.close

close()

Public method to close the safe browsing interface.

SafeBrowsingManager.configurationChanged

configurationChanged()

Public method to handle changes of the settings.

SafeBrowsingManager.fairUseDelayExpired

fairUseDelayExpired()

Public method to check, if the fair use wait period has expired.

Returns:
flag indicating expiration
Return Type:
bool

SafeBrowsingManager.fullCacheCleanup

fullCacheCleanup()

Public method to clean up the cache completely.

SafeBrowsingManager.getPlatformString

getPlatformString(platformType)

Public method to get the platform string for a given platform type.

platformType (str)
platform type as defined in the v4 API
Returns:
platform string
Return Type:
str

SafeBrowsingManager.getThreatEntryString

getThreatEntryString(threatEntry)

Public method to get the threat entry string.

threatEntry (str)
threat entry type as defined in the v4 API
Returns:
threat entry string
Return Type:
str

SafeBrowsingManager.getThreatMessage

getThreatMessage(threatType)

Public method to get a warning message for the given threat type.

threatType (str)
threat type to get the message for
Returns:
threat message
Return Type:
str

SafeBrowsingManager.getThreatMessages

getThreatMessages(threatLists)

Public method to get threat messages for the given threats.

threatLists (list of ThreatList)
list of threat lists to get a message for
Returns:
list of threat messages, one per unique threat type
Return Type:
list of str

SafeBrowsingManager.getThreatType

getThreatType(threatList)

Public method to get a display string for a given threat type.

threatList (str)
threat list to get display string for
Returns:
display string
Return Type:
str

SafeBrowsingManager.isUpdatingThreatLists

isUpdatingThreatLists()

Public method to check, if we are in the process of updating the threat lists.

Returns:
flag indicating an update process is active
Return Type:
bool

SafeBrowsingManager.lookupUrl

lookupUrl(url)

Public method to lookup an URL.

url (str or QUrl)
URL to be checked
Returns:
tuple containing the list of threat lists the URL was found in and an error message
Return Type:
tuple of (list of ThreatList, str)
Raises ValueError:
raised for an invalid URL

SafeBrowsingManager.showSafeBrowsingDialog

showSafeBrowsingDialog()

Public slot to show the safe browsing management dialog.

SafeBrowsingManager.updateHashPrefixCache

updateHashPrefixCache()

Public method to load or update the locally cached threat lists.

Returns:
flag indicating success and an error message
Return Type:
tuple of (bool, str)
Up



Home ⌂Doc Index ◂Up ▴