As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Webrisk v1 API

class google.cloud.webrisk_v1.types.CompressionType(value)[source]

Bases: proto.enums.Enum

The ways in which threat entry sets can be compressed.

Values:
COMPRESSION_TYPE_UNSPECIFIED (0):

Unknown.

RAW (1):

Raw, uncompressed data.

RICE (2):

Rice-Golomb encoded data.

class google.cloud.webrisk_v1.types.ComputeThreatListDiffRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes an API diff request.

threat_type

Required. The threat list to update. Only a single ThreatType should be specified per request. If you want to handle multiple ThreatTypes, you must make one request per ThreatType.

Type

google.cloud.webrisk_v1.types.ThreatType

version_token

The current version token of the client for the requested list (the client version that was received from the last successful diff). If the client does not have a version token (this is the first time calling ComputeThreatListDiff), this may be left empty and a full database snapshot will be returned.

Type

bytes

constraints

Required. The constraints associated with this request.

Type

google.cloud.webrisk_v1.types.ComputeThreatListDiffRequest.Constraints

class Constraints(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The constraints for this diff.

max_diff_entries

The maximum size in number of entries. The diff will not contain more entries than this value. This should be a power of 2 between 210 and 220. If zero, no diff size limit is set.

Type

int

max_database_entries

Sets the maximum number of entries that the client is willing to have in the local database. This should be a power of 2 between 210 and 220. If zero, no database size limit is set.

Type

int

supported_compressions

The compression types supported by the client.

Type

MutableSequence[google.cloud.webrisk_v1.types.CompressionType]

class google.cloud.webrisk_v1.types.ComputeThreatListDiffResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

response_type

The type of response. This may indicate that an action must be taken by the client when the response is received.

Type

google.cloud.webrisk_v1.types.ComputeThreatListDiffResponse.ResponseType

additions

A set of entries to add to a local threat type’s list.

Type

google.cloud.webrisk_v1.types.ThreatEntryAdditions

removals

A set of entries to remove from a local threat type’s list. This field may be empty.

Type

google.cloud.webrisk_v1.types.ThreatEntryRemovals

new_version_token

The new opaque client version token. This should be retained by the client and passed into the next call of ComputeThreatListDiff as ‘version_token’. A separate version token should be stored and used for each threatList.

Type

bytes

checksum

The expected SHA256 hash of the client state; that is, of the sorted list of all hashes present in the database after applying the provided diff. If the client state doesn’t match the expected state, the client must discard this diff and retry later.

Type

google.cloud.webrisk_v1.types.ComputeThreatListDiffResponse.Checksum

recommended_next_diff

The soonest the client should wait before issuing any diff request. Querying sooner is unlikely to produce a meaningful diff. Waiting longer is acceptable considering the use case. If this field is not set clients may update as soon as they want.

Type

google.protobuf.timestamp_pb2.Timestamp

class Checksum(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The expected state of a client’s local database.

sha256

The SHA256 hash of the client state; that is, of the sorted list of all hashes present in the database.

Type

bytes

class ResponseType(value)[source]

Bases: proto.enums.Enum

The type of response sent to the client.

Values:
RESPONSE_TYPE_UNSPECIFIED (0):

Unknown.

DIFF (1):

Partial updates are applied to the client’s existing local database.

RESET (2):

Full updates resets the client’s entire local database. This means that either the client had no state, was seriously out-of-date, or the client is believed to be corrupt.

class google.cloud.webrisk_v1.types.CreateSubmissionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to send a potentially phishy URI to WebRisk.

parent

Required. The name of the project that is making the submission. This string is in the format “projects/{project_number}”.

Type

str

submission

Required. The submission that contains the content of the phishing report.

Type

google.cloud.webrisk_v1.types.Submission

class google.cloud.webrisk_v1.types.RawHashes(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The uncompressed threat entries in hash format. Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4 bytes, but some hashes are lengthened if they collide with the hash of a popular URI.

Used for sending ThreatEntryAdditons to clients that do not support compression, or when sending non-4-byte hashes to clients that do support compression.

prefix_size

The number of bytes for each prefix encoded below. This field can be anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). In practice this is almost always 4, except in exceptional circumstances.

Type

int

raw_hashes

The hashes, in binary format, concatenated into one long string. Hashes are sorted in lexicographic order. For JSON API users, hashes are base64-encoded.

Type

bytes

class google.cloud.webrisk_v1.types.RawIndices(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A set of raw indices to remove from a local list.

indices

The indices to remove from a lexicographically-sorted local list.

Type

MutableSequence[int]

class google.cloud.webrisk_v1.types.RiceDeltaEncoding(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or compressed removal indices.

first_value

The offset of the first entry in the encoded data, or, if only a single integer was encoded, that single integer’s value. If the field is empty or missing, assume zero.

Type

int

rice_parameter

The Golomb-Rice parameter, which is a number between 2 and 28. This field is missing (that is, zero) if num_entries is zero.

Type

int

entry_count

The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in first_value.

Type

int

encoded_data

The encoded deltas that are encoded using the Golomb-Rice coder.

Type

bytes

class google.cloud.webrisk_v1.types.SearchHashesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to return full hashes matched by the provided hash prefixes.

hash_prefix

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded. Note that if this parameter is provided by a URI, it must be encoded using the web safe base64 variant (RFC 4648).

Type

bytes

threat_types

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatType]

class google.cloud.webrisk_v1.types.SearchHashesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

threats

The full hashes that matched the requested prefixes. The hash will be populated in the key.

Type

MutableSequence[google.cloud.webrisk_v1.types.SearchHashesResponse.ThreatHash]

negative_expire_time

For requested entities that did not match the threat list, how long to cache the response until.

Type

google.protobuf.timestamp_pb2.Timestamp

class ThreatHash(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains threat information on a matching hash.

threat_types

The ThreatList this threat belongs to. This must contain at least one entry.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatType]

hash_

A 32 byte SHA256 hash. This field is in binary format. For JSON requests, hashes are base64-encoded.

Type

bytes

expire_time

The cache lifetime for the returned match. Clients must not cache this response past this timestamp to avoid false positives.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.webrisk_v1.types.SearchUrisRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to check URI entries against threatLists.

uri

Required. The URI to be checked for matches.

Type

str

threat_types

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatType]

class google.cloud.webrisk_v1.types.SearchUrisResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

threat

The threat list matches. This might be empty if the URI is on no list.

Type

google.cloud.webrisk_v1.types.SearchUrisResponse.ThreatUri

class ThreatUri(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains threat information on a matching uri.

threat_types

The ThreatList this threat belongs to.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatType]

expire_time

The cache lifetime for the returned match. Clients must not cache this response past this timestamp to avoid false positives.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.webrisk_v1.types.Submission(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Wraps a URI that might be displaying malicious content.

uri

Required. The URI that is being reported for malicious content to be analyzed.

Type

str

threat_types

Output only. ThreatTypes found to be associated with the submitted URI after reviewing it. This might be empty if the URI was not added to any list.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatType]

class google.cloud.webrisk_v1.types.SubmitUriMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for the Submit URI long-running operation. option (google.api.message_visibility).restriction = “TRUSTED_TESTER”;

state

The state of the operation.

Type

google.cloud.webrisk_v1.types.SubmitUriMetadata.State

create_time

Creation time of the operation.

Type

google.protobuf.timestamp_pb2.Timestamp

update_time

Latest update time of the operation.

Type

google.protobuf.timestamp_pb2.Timestamp

class State(value)[source]

Bases: proto.enums.Enum

Enum that represents the state of the long-running operation.

Values:
STATE_UNSPECIFIED (0):

Default unspecified state.

RUNNING (1):

The operation is currently running.

SUCCEEDED (2):

The operation finished with a success status.

CANCELLED (3):

The operation was cancelled.

FAILED (4):

The operation finished with a failure status.

CLOSED (5):

The operation was closed with no action taken.

class google.cloud.webrisk_v1.types.SubmitUriRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to send a potentially malicious URI to WebRisk.

parent

Required. The name of the project that is making the submission. This string is in the format “projects/{project_number}”.

Type

str

submission

Required. The submission that contains the URI to be scanned.

Type

google.cloud.webrisk_v1.types.Submission

threat_info

Provides additional information about the submission.

Type

google.cloud.webrisk_v1.types.ThreatInfo

threat_discovery

Provides additional information about how the submission was discovered.

Type

google.cloud.webrisk_v1.types.ThreatDiscovery

class google.cloud.webrisk_v1.types.ThreatDiscovery(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details about how the threat was discovered.

platform

Platform on which the threat was discovered.

Type

google.cloud.webrisk_v1.types.ThreatDiscovery.Platform

region_codes

CLDR region code of the countries/regions the URI poses a threat ordered from most impact to least impact. Example: “US” for United States.

Type

MutableSequence[str]

class Platform(value)[source]

Bases: proto.enums.Enum

Platform types.

Values:
PLATFORM_UNSPECIFIED (0):

Default.

ANDROID (1):

General Android platform.

IOS (2):

General iOS platform.

MACOS (3):

General macOS platform.

WINDOWS (4):

General Windows platform.

class google.cloud.webrisk_v1.types.ThreatEntryAdditions(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains the set of entries to add to a local database. May contain a combination of compressed and raw data in a single response.

raw_hashes

The raw SHA256-formatted entries. Repeated to allow returning sets of hashes with different prefix sizes.

Type

MutableSequence[google.cloud.webrisk_v1.types.RawHashes]

rice_hashes

The encoded 4-byte prefixes of SHA256-formatted entries, using a Golomb-Rice encoding. The hashes are converted to uint32, sorted in ascending order, then delta encoded and stored as encoded_data.

Type

google.cloud.webrisk_v1.types.RiceDeltaEncoding

class google.cloud.webrisk_v1.types.ThreatEntryRemovals(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains the set of entries to remove from a local database.

raw_indices

The raw removal indices for a local list.

Type

google.cloud.webrisk_v1.types.RawIndices

rice_indices

The encoded local, lexicographically-sorted list indices, using a Golomb-Rice encoding. Used for sending compressed removal indices. The removal indices (uint32) are sorted in ascending order, then delta encoded and stored as encoded_data.

Type

google.cloud.webrisk_v1.types.RiceDeltaEncoding

class google.cloud.webrisk_v1.types.ThreatInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Context about the submission including the type of abuse found on the URI and supporting details. option (google.api.message_visibility).restriction = “TRUSTED_TESTER”;

abuse_type

The type of abuse.

Type

google.cloud.webrisk_v1.types.ThreatInfo.AbuseType

threat_confidence

Confidence that the URI is unsafe.

Type

google.cloud.webrisk_v1.types.ThreatInfo.Confidence

threat_justification

Context about why the URI is unsafe.

Type

google.cloud.webrisk_v1.types.ThreatInfo.ThreatJustification

class AbuseType(value)[source]

Bases: proto.enums.Enum

The abuse type found on the URI.

Values:
ABUSE_TYPE_UNSPECIFIED (0):

Default.

MALWARE (1):

The URI contains malware.

SOCIAL_ENGINEERING (2):

The URI contains social engineering.

UNWANTED_SOFTWARE (3):

The URI contains unwanted software.

class Confidence(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Confidence that a URI is unsafe.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

score

A decimal representation of confidence in the range of 0 to 1 where 0 indicates no confidence and 1 indicates complete confidence.

This field is a member of oneof value.

Type

float

level

Enum representation of confidence.

This field is a member of oneof value.

Type

google.cloud.webrisk_v1.types.ThreatInfo.Confidence.ConfidenceLevel

class ConfidenceLevel(value)[source]

Bases: proto.enums.Enum

Enum representation of confidence.

Values:
CONFIDENCE_LEVEL_UNSPECIFIED (0):

Default.

LOW (1):

Less than 60% confidence that the URI is unsafe.

MEDIUM (2):

Between 60% and 80% confidence that the URI is unsafe.

HIGH (3):

Greater than 80% confidence that the URI is unsafe.

class ThreatJustification(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Context about why the URI is unsafe.

labels

Labels associated with this URI that explain how it was classified.

Type

MutableSequence[google.cloud.webrisk_v1.types.ThreatInfo.ThreatJustification.JustificationLabel]

comments

Free-form context on why this URI is unsafe.

Type

MutableSequence[str]

class JustificationLabel(value)[source]

Bases: proto.enums.Enum

Labels that explain how the URI was classified.

Values:
JUSTIFICATION_LABEL_UNSPECIFIED (0):

Default.

MANUAL_VERIFICATION (1):

The submitter manually verified that the submission is unsafe.

USER_REPORT (2):

The submitter received the submission from an end user.

AUTOMATED_REPORT (3):

The submitter received the submission from an automated system.

class google.cloud.webrisk_v1.types.ThreatType(value)[source]

Bases: proto.enums.Enum

The type of threat. This maps directly to the threat list a threat may belong to.

Values:
THREAT_TYPE_UNSPECIFIED (0):

No entries should match this threat type. This threat type is unused.

MALWARE (1):

Malware targeting any platform.

SOCIAL_ENGINEERING (2):

Social engineering targeting any platform.

UNWANTED_SOFTWARE (3):

Unwanted software targeting any platform.

SOCIAL_ENGINEERING_EXTENDED_COVERAGE (4):

A list of extended coverage social engineering URIs targeting any platform.