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

Method writeLoot

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

Source from the content-addressed store, hash-verified

390}
391
392func (m *EndpointsModule) writeLoot(outputDirectory string, verbosity int) {
393 path := filepath.Join(outputDirectory, "loot")
394 err := os.MkdirAll(path, os.ModePerm)
395 if err != nil {
396 m.modLog.Error(err.Error())
397 m.CommandCounter.IncrError()
398 panic(err.Error())
399 }
400 f := filepath.Join(path, "endpoints-UrlsOnly.txt")
401
402 var out string
403
404 for _, endpoint := range m.Endpoints {
405 out = out + fmt.Sprintln(endpoint.Endpoint)
406 }
407
408 err = os.WriteFile(f, []byte(out), 0644)
409 if err != nil {
410 m.modLog.Error(err.Error())
411 m.CommandCounter.IncrError()
412 panic(err.Error())
413 }
414
415 if verbosity > 2 {
416 fmt.Println()
417 fmt.Printf("[%s][%s] %s \n", cyan(m.output.CallingModule), cyan(m.AWSProfile), green("Feed this endpoints into nmap and something like gowitness/aquatone for screenshots."))
418 fmt.Print(out)
419 fmt.Printf("[%s][%s] %s \n\n", cyan(m.output.CallingModule), cyan(m.AWSProfile), green("End of loot file."))
420 }
421
422 fmt.Printf("[%s][%s] Loot written to [%s]\n", cyan(m.output.CallingModule), cyan(m.AWSProfile), f)
423
424}
425
426func (m *EndpointsModule) getLambdaFunctionsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Endpoint) {
427 defer func() {

Callers 1

PrintEndpointsMethod · 0.95

Calls 2

ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected