Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def bfs_search(org, base_id):
visited.append(service_account)
JSON_REQUEST={
"analysisQuery": {
"parent": org,
"identitySelector": {
"identity": "serviceAccount:{}".format(service_account)
},
Expand All @@ -55,7 +54,7 @@ def bfs_search(org, base_id):
}
for dangerous_permission in dangerous_permissions:
JSON_REQUEST["analysisQuery"]["accessSelector"]["permissions"].append(dangerous_permission)
res = requests.post("https://cloudasset.googleapis.com/v1p4beta1/organizations/{}:analyzeIamPolicy".format(org), headers=headers, json=JSON_REQUEST)
res = requests.post("https://cloudasset.googleapis.com/v1/organizations/{}:analyzeIamPolicy".format(org), headers=headers, json=JSON_REQUEST)
results = res.json()
if "analysisResults" in results["mainAnalysis"]:
for result in results["mainAnalysis"]["analysisResults"]:
Expand Down Expand Up @@ -103,4 +102,4 @@ def bfs_search(org, base_id):
print("\n\n~~~~~~~{} can move laterally to the following identities ~~~~~~~~~~~".format(base_id))
for service_account in visited:
if service_account != base_id:
print("{} from project {}".format(service_account, info[service_account]))
print("{} from project {}".format(service_account, info[service_account]))