本文档介绍了如何识别存在相关行为的帐号。 例如,您可能需要识别恶意用户创建的所有用户帐号。您可以找到显示相关行为的帐号、帐号群组和帐号群组成员资格。
当以前合法的帐号与具有滥用行为的帐号相关时,识别显示相关行为的帐号可帮助您发现虚假帐号群组和帐号接管情况。
此功能仅适用于 reCAPTCHA Enterprise REST API 和客户端库。
检索与特定帐号相关的帐号
如需检索与指定帐号相关的帐号列表,请使用 relatedaccountgroupmemberships.search
方法。
在使用任何请求数据之前,请先进行以下替换:
- PROJECT_ID:您的 Google Cloud 项目 ID。
- HASHED_ACCOUNT_ID:使用 SHA256-HMAC 方法针对您网站上的用户帐号生成的稳定经过哈希处理的用户标识符。
- PAGE_SIZE:可选。要纳入响应的帐号成员数量。 默认值为 50,最大值为 1,000。如果帐号成员数量大于页面大小,则响应将包含分页令牌,您可以使用该令牌检索下一页结果。
- NEXT_PAGE_TOKEN:可选。此方法的早期响应中返回的
nextPageToken
值。指定此参数可查询更多帐号成员资格。
HTTP 方法和网址:
POST https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN
请求 JSON 正文:
{ "hashedAccountId": "HASHED_ACCOUNT_ID" }
如需发送请求,请选择以下方式之一:
curl
将请求正文保存在名为 request.json
的文件中,然后执行以下命令:
curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"
PowerShell
将请求正文保存在名为 request.json
的文件中,然后执行以下命令:
$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content
您应该会收到类似以下内容的 JSON 响应:
{ "relatedAccountGroupMemberships": [ { "name": "projects/projectId/relatedaccountgroups/groupId187/memberships/membershipId95", "hashedAccountId": "4RopXS59" }, { "name": "projects/projectId/relatedaccountgroups/groupId91/memberships/membershipId23", "hashedAccountId": "HVMv1DTb" } ], "nextPageToken": "Q2N_rZgxUXOjNZtK1T1i0Q" }
代码示例
检索相关帐号群组
要检索具有类似行为的帐号群组列表,请使用 relatedaccountgroups.list
方法。
在使用任何请求数据之前,请先进行以下替换:
- PROJECT_ID:您的 Google Cloud 项目 ID。
- PAGE_SIZE:可选。要包含在响应中的帐号群组数量。 默认值为 50,最大值为 1,000。如果帐号群组数量大于页面大小,则响应中会包含分页令牌,您可以使用该令牌检索下一页结果。
- NEXT_PAGE_TOKEN:可选。此方法之前的响应中返回的
nextPageToken
值。指定此参数可查询更多帐号群组。
HTTP 方法和网址:
GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN
如需发送请求,请选择以下方式之一:
curl
执行以下命令:
curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"
PowerShell
执行以下命令:
$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content
您应该会收到类似以下内容的 JSON 响应:
{ "relatedAccountGroups": [ { "name": "projects/projectId/relatedaccountgroups/groupId1" }, { "name": "projects/projectId/relatedaccountgroups/groupId2" } ], "nextPageToken": "BenimQwKzIOibbOO2Lhisw" }
代码示例
检索相关的帐号群组成员资格
要检索具有类似行为的帐号群组成员资格列表,请使用 relatedaccountgroupmemberships.list
方法。
在使用任何请求数据之前,请先进行以下替换:
- PROJECT_ID:您的 Google Cloud 项目 ID。
- GROUP_ID:您要为其查找相关成员资格的帐号群组的名称。
- PAGE_SIZE:可选。要包含在响应中的帐号群组成员资格的数量。 默认值为 50,最大值为 1,000。如果帐号群组成员资格数量大于页面大小,则响应中会包含分页令牌,您可以使用该令牌检索下一页结果。
- NEXT_PAGE_TOKEN:可选。此方法的早期响应中返回的
nextPageToken
值。指定此参数可查询更多帐号群组成员资格。
HTTP 方法和网址:
GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN
如需发送请求,请选择以下方式之一:
curl
执行以下命令:
curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"
PowerShell
执行以下命令:
$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content
您应该会收到类似以下内容的 JSON 响应:
{ "relatedAccountGroupMemberships": [ { "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId1", "hashedAccountId": "4RopXS59" }, { "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId2", "hashedAccountId": "HVMv1DTb" } ], "nextPageToken": "WPuIn8GHU3JvcJqgvmE7Aw" }