Merged
Conversation
Contributor
Author
|
I added a whomai command and supporting service to facilitate knowing which account is being used to authenticate to the projects when using cloudfox gcp. Also fixed the bug where the logic that sets the projectIDs for gcp was being run on all the AWS & Azure commands |
| fullPath := path.Join(l.DirectoryName, "loot", file.Name) | ||
| err := afero.WriteFile(fileSystem, fullPath, contents, 0644) // Use Afero's WriteFile | ||
|
|
||
| err := os.WriteFile(fullPath, contents, 0644) |
Contributor
Author
There was a problem hiding this comment.
@sethsec-bf should this be using afero package?
Contributor
|
Amazing work @dbravo-bishopfox, thanks for pushing this! |
sethsec-bf
approved these changes
Apr 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Card
This PR adds functionality to cloudfox to support resources in GCP projects. The currently supported resources are artifact registry, bigquery tables and datasets, cloud storage buckets, iam policy bindings, compute engine instances, and secrets.
Details
The code related to each cobra command is in its own file in gcp/commands/. In each of those files there is high level logic to parse command line arguments, call appropriate services that return a GCP resource data structure, and output or present the information using internal/output2.go. Each command file also houses the logic related to defining the CSV / JSON headers, content, and file names based on the data structure returned by service(s).
The code related to retrieving the resource information from the GCP API and structuring them in a custom struct, is in gcp/services/. There each service is named after a given resource type in GCP and attempts to exports few functions that will return data structures ready to be "outputted" by commands.
In addition to adding functionality to support the new resources, a new HandleOutput function was added to the internal/output2.go file that is a flexible way to WriteFullOutput for any command that wants to write to std out or in a file.
New functionality in the internal/log.go was also added from @bishopfaure gcp branch. We plan to coordinate on integrating his code into upcoming functionality for GCP related workflows.
Some strings were added in globals/gcp.go and globals/utils.go to facilitate their use throughout the tool.