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

Method getLambdasPerRegion

aws/lambda.go:307–344  ·  view source on GitHub ↗
(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Lambda)

Source from the content-addressed store, hash-verified

305}
306
307func (m *LambdasModule) getLambdasPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Lambda) {
308 defer func() {
309 m.CommandCounter.DecrExecuting()
310 m.CommandCounter.IncrComplete()
311 wg.Done()
312
313 }()
314 semaphore <- struct{}{}
315 defer func() {
316 <-semaphore
317 }()
318
319 functions, err := m.listFunctions(r)
320 if err != nil {
321 m.modLog.Error(err.Error())
322 m.CommandCounter.IncrError()
323 }
324
325 for _, function := range functions {
326 arn := aws.ToString(function.FunctionArn)
327 name := aws.ToString(function.FunctionName)
328 role := aws.ToString(function.Role)
329
330 dataReceiver <- Lambda{
331 AWSService: "Lambda",
332 Name: name,
333 Arn: arn,
334 Region: r,
335 Type: "",
336 Role: role,
337 Admin: "",
338 CanPrivEsc: "",
339 Public: "",
340 }
341
342 }
343
344}
345
346func (m *LambdasModule) listFunctions(r string) ([]types.FunctionConfiguration, error) {
347 // "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.

Callers 1

executeChecksMethod · 0.95

Calls 5

listFunctionsMethod · 0.95
DecrExecutingMethod · 0.80
IncrCompleteMethod · 0.80
ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected