Skip to content

Commit

Permalink
Fixed bug in cape where files did not exist crash. Fixed bug that dup…
Browse files Browse the repository at this point in the history
…licated edges because of magenta.
  • Loading branch information
sethsec committed Oct 15, 2024
1 parent ebf9985 commit 878d7ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aws/cape-tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func preloadData(filePaths []string) (*AllAccountData, error) {

for _, filePath := range filePaths {
fileRecords, err := loadFileRecords(filePath)
if err != nil {
if err != nil {
return nil, err
}
appData.Files[filePath] = fileRecords
Expand Down
2 changes: 1 addition & 1 deletion aws/cape.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (m *CapeCommand) findPathsToThisDestination(allGlobalNodes map[string]map[s
privescPathsBody = append(privescPathsBody, []string{
aws.ToString(m.Caller.Account),
s,
magenta(d),
d,
magenta(destinationVertexWithProperties.Attributes["IsAdminString"]),
paths})
} else {
Expand Down
12 changes: 11 additions & 1 deletion cli/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1334,10 +1334,20 @@ func runCapeTUICommand(cmd *cobra.Command, args []string) {
if _, err := os.Stat(filepath.Join(cloudfoxRunData.OutputLocation, "json", fileName)); os.IsNotExist(err) {
fmt.Printf("[%s] Could not retrieve CAPE data for profile %s.\n", cyan(emoji.Sprintf(":fox:cloudfox v%s :fox:", cmd.Root().Version)), profile)
//remove the profile from the list of profiles to analyze
AWSProfiles = append(AWSProfiles[:i], AWSProfiles[i+1:]...)
if len(AWSProfiles) > 1 {
AWSProfiles = append(AWSProfiles[:i], AWSProfiles[i+1:]...)
} else {
if CapeAdminOnly {
fmt.Printf("[%s] Could not retrieve cape data. Did you run cape without the --admin-only flag? You'll need to run cape with --admin-only to use the tui with --admin-only\n", cyan(emoji.Sprintf(":fox:cloudfox v%s :fox:", cmd.Root().Version)))
} else {
fmt.Printf("[%s] Did you run cape with the --admin-only flag? You'll need to run cape without --admin-only to use the tui without --admin-only\n", cyan(emoji.Sprintf(":fox:cloudfox v%s :fox:", cmd.Root().Version)))
}
os.Exit(1)
}
}

}

if len(capeOutputFileLocations) == 0 {
fmt.Printf("[%s] Could not retrieve CAPE data.\n", cyan(emoji.Sprintf(":fox:cloudfox v%s :fox:", cmd.Root().Version)))
os.Exit(1)
Expand Down

0 comments on commit 878d7ec

Please sign in to comment.