다음 코드를 사용하여 여기에서 가져옴 인증되지 않은 호출을 허용하는 클라우드 함수를 찾을 수 있습니다.
#!/bin/bash############################# Run this tool to find Cloud Functions that permit unauthenticated invocations# anywhere in your GCP organization.# Enjoy!############################for proj in $(gcloudprojectslist--format="get(projectId)"); doecho"[*] scraping project $proj"enabled=$(gcloudserviceslist--project"$proj"|grep"Cloud Functions API")if [ -z"$enabled" ]; thencontinuefifor func_region in $(gcloudfunctionslist--quiet--project"$proj"--format="value[separator=','](NAME,REGION)"); do# drop substring from first occurence of "," to end of string.func="${func_region%%,*}"# drop substring from start of string up to last occurence of ","region="${func_region##*,}"ACL="$(gcloudfunctionsget-iam-policy "$func" --project "$proj" --region "$region")"all_users="$(echo "$ACL" |grepallUsers)"all_auth="$(echo "$ACL" |grepallAuthenticatedUsers)"if [ -z"$all_users" ]then:elseecho"[!] Open to all users: $proj: $func"fiif [ -z"$all_auth" ]then:elseecho"[!] Open to all authenticated users: $proj: $func"fidonedone