MCPcopy Create free account
hub / github.com/BishopFox/cloudfox / PrintEndpoints

Method PrintEndpoints

aws/endpoints.go:89–248  ·  view source on GitHub ↗
(outputDirectory string, verbosity int)

Source from the content-addressed store, hash-verified

87var oe *smithy.OperationError
88
89func (m *EndpointsModule) PrintEndpoints(outputDirectory string, verbosity int) {
90 // These struct values are used by the output module
91 m.output.Verbosity = verbosity
92 m.output.Directory = outputDirectory
93 m.output.CallingModule = "endpoints"
94 m.modLog = internal.TxtLog.WithFields(logrus.Fields{
95 "module": m.output.CallingModule,
96 })
97 if m.AWSProfile == "" {
98 m.AWSProfile = internal.BuildAWSPath(m.Caller)
99 }
100
101 fmt.Printf("[%s][%s] Enumerating endpoints for account %s.\n", cyan(m.output.CallingModule), cyan(m.AWSProfile), aws.ToString(m.Caller.Account))
102 fmt.Printf("[%s][%s] Supported Services: App Runner, APIGateway, ApiGatewayV2, Cloudfront, EKS, ELB, ELBv2, Grafana, \n", cyan(m.output.CallingModule), cyan(m.AWSProfile))
103 fmt.Printf("[%s][%s] \t\t\tLambda, MQ, OpenSearch, Redshift, RDS\n", cyan(m.output.CallingModule), cyan(m.AWSProfile))
104
105 wg := new(sync.WaitGroup)
106 semaphore := make(chan struct{}, m.Goroutines)
107 // Create a channel to signal the spinner aka task status goroutine to finish
108 spinnerDone := make(chan bool)
109 //fire up the task status spinner/updated
110 go internal.SpinUntil(m.output.CallingModule, &m.CommandCounter, spinnerDone, "tasks")
111
112 //create a channel to receive the objects
113 dataReceiver := make(chan Endpoint)
114
115 // Create a channel to signal to stop
116 receiverDone := make(chan bool)
117
118 go m.Receiver(dataReceiver, receiverDone)
119
120 //execute global checks -- removing from now. not sure i want s3 data in here
121 // wg.Add(1)
122 // go m.getS3EndpointsPerRegion(wg)
123 wg.Add(1)
124 go m.getCloudfrontEndpoints(wg, semaphore, dataReceiver)
125
126 //execute regional checks
127
128 for _, region := range m.AWSRegions {
129 wg.Add(1)
130 go m.executeChecks(region, wg, semaphore, dataReceiver)
131 }
132
133 // for _, r := range utils.GetRegionsForService(m.AWSProfile, "apprunner") {
134 // fmt.Println()
135 // fmt.Println(r)
136 // m.getAppRunnerEndpointsPerRegion(r, wg)
137 // }
138
139 wg.Wait()
140 //time.Sleep(time.Second * 2)
141
142 // Send a message to the spinner goroutine to close the channel and stop
143 spinnerDone <- true
144 <-spinnerDone
145 receiverDone <- true
146 <-receiverDone

Callers 2

runEndpointsCommandFunction · 0.95
runAllChecksCommandFunction · 0.95

Calls 8

ReceiverMethod · 0.95
executeChecksMethod · 0.95
WriteFullOutputMethod · 0.95
writeLootMethod · 0.95
BuildAWSPathFunction · 0.92
SpinUntilFunction · 0.92
AddMethod · 0.80

Tested by

no test coverage detected