MCPcopy Index your code
hub / github.com/BishopFox/cloudfox / PrintCodeBuildProjects

Method PrintCodeBuildProjects

aws/codebuild.go:54–210  ·  view source on GitHub ↗
(outputDirectory string, verbosity int)

Source from the content-addressed store, hash-verified

52}
53
54func (m *CodeBuildModule) PrintCodeBuildProjects(outputDirectory string, verbosity int) {
55 // These struct values are used by the output module
56 m.output.Verbosity = verbosity
57 m.output.Directory = outputDirectory
58 m.output.CallingModule = "codebuild"
59 localAdminMap := make(map[string]bool)
60
61 m.modLog = internal.TxtLog.WithFields(logrus.Fields{
62 "module": m.output.CallingModule,
63 })
64 if m.AWSProfile == "" {
65 m.AWSProfile = internal.BuildAWSPath(m.Caller)
66 }
67
68 fmt.Printf("[%s][%s] Enumerating CodeBuild projects for account %s.\n", cyan(m.output.CallingModule), cyan(m.AWSProfile), aws.ToString(m.Caller.Account))
69 m.pmapperMod, m.pmapperError = InitPmapperGraph(m.Caller, m.AWSProfile, m.Goroutines, m.PmapperDataBasePath)
70 m.iamSimClient = InitIamCommandClient(m.IAMClient, m.Caller, m.AWSProfile, m.Goroutines)
71
72 wg := new(sync.WaitGroup)
73 semaphore := make(chan struct{}, m.Goroutines)
74
75 // Create a channel to signal the spinner aka task status goroutine to finish
76 spinnerDone := make(chan bool)
77 //fire up the the task status spinner/updated
78 go internal.SpinUntil(m.output.CallingModule, &m.CommandCounter, spinnerDone, "regions")
79
80 //create a channel to receive the objects
81 dataReceiver := make(chan Project)
82
83 // Create a channel to signal to stop
84 receiverDone := make(chan bool)
85
86 go m.Receiver(dataReceiver, receiverDone)
87
88 for _, region := range m.AWSRegions {
89 wg.Add(1)
90 m.CommandCounter.IncrPending()
91 go m.executeChecks(region, wg, semaphore, dataReceiver)
92
93 }
94
95 wg.Wait()
96
97 // Send a message to the spinner goroutine to close the channel and stop
98 spinnerDone <- true
99 <-spinnerDone
100 receiverDone <- true
101 <-receiverDone
102
103 // Perform role analysis
104 if m.pmapperError == nil {
105 for i := range m.Projects {
106 m.Projects[i].Admin, m.Projects[i].CanPrivEsc = GetPmapperResults(m.SkipAdminCheck, m.pmapperMod, &m.Projects[i].Role)
107 }
108 } else {
109 for i := range m.Projects {
110 m.Projects[i].Admin, m.Projects[i].CanPrivEsc = GetIamSimResult(m.SkipAdminCheck, &m.Projects[i].Role, m.iamSimClient, localAdminMap)
111 }

Callers 3

runCodeBuildCommandFunction · 0.95
runAllChecksCommandFunction · 0.95
TestCodeBuildProjectsFunction · 0.95

Calls 13

ReceiverMethod · 0.95
executeChecksMethod · 0.95
WriteFullOutputMethod · 0.95
BuildAWSPathFunction · 0.92
SpinUntilFunction · 0.92
ContainsFunction · 0.92
InitPmapperGraphFunction · 0.85
InitIamCommandClientFunction · 0.85
GetPmapperResultsFunction · 0.85
GetIamSimResultFunction · 0.85
removeStringFromSliceFunction · 0.85
AddMethod · 0.80

Tested by 1

TestCodeBuildProjectsFunction · 0.76