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

Method getLambdaFunctionsPerRegion

aws/endpoints.go:426–481  ·  view source on GitHub ↗
(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint)

Source from the content-addressed store, hash-verified

424}
425
426func (m *EndpointsModule) getLambdaFunctionsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) {
427 defer func() {
428 m.CommandCounter.DecrExecuting()
429 m.CommandCounter.IncrComplete()
430 wg.Done()
431
432 }()
433 semaphore <- struct{}{}
434 defer func() {
435 <-semaphore
436 }()
437 // m.CommandCounter.IncrTotal()
438 m.CommandCounter.DecrPending()
439 m.CommandCounter.IncrExecuting()
440 // "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.
441 var public string
442
443 Functions, err := sdk.CachedLambdaListFunctions(m.LambdaClient, aws.ToString(m.Caller.Account), r)
444 if err != nil {
445 m.modLog.Error(err.Error())
446 m.CommandCounter.IncrError()
447 return
448 }
449
450 for _, function := range Functions {
451 name := aws.ToString(function.FunctionName)
452 FunctionDetails, err := sdk.CachedLambdaGetFunctionUrlConfig(m.LambdaClient, aws.ToString(m.Caller.Account), r, name)
453 if err != nil {
454 if errors.As(err, &oe) {
455 m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s, Service: %s, Operation: %s", r, oe.Service(), oe.Operation()))
456 }
457 m.modLog.Error(err.Error())
458 m.CommandCounter.IncrError()
459 continue
460 }
461 endpoint := aws.ToString(FunctionDetails.FunctionUrl)
462
463 if FunctionDetails.AuthType == "NONE" {
464 public = "True"
465 } else {
466 public = "False"
467 }
468
469 dataReceiver <- Endpoint{
470 AWSService: "Lambda",
471 Region: r,
472 Name: name,
473 Endpoint: endpoint,
474 Port: 443,
475 Protocol: "https",
476 Public: public,
477 }
478 //fmt.Println(endpoint, name, roleArn)
479 }
480
481}
482
483func (m *EndpointsModule) getEksClustersPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) {

Callers 1

executeChecksMethod · 0.95

Calls 8

DecrExecutingMethod · 0.80
IncrCompleteMethod · 0.80
DecrPendingMethod · 0.80
IncrExecutingMethod · 0.80
ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected