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

Method writeLoot

aws/access-keys.go:137–157  ·  view source on GitHub ↗
(outputDirectory string, verbosity int)

Source from the content-addressed store, hash-verified

135}
136
137func (m *AccessKeysModule) writeLoot(outputDirectory string, verbosity int) {
138 path := filepath.Join(outputDirectory, "loot")
139 err := os.MkdirAll(path, os.ModePerm)
140 if err != nil {
141 m.modLog.Error(err.Error())
142 }
143 f := filepath.Join(path, "access-keys.txt")
144
145 var out string
146
147 for _, key := range m.AnalyzedUsers {
148 out = out + fmt.Sprintln(key.Key)
149 }
150
151 err = os.WriteFile(f, []byte(out), 0644)
152 if err != nil {
153 m.modLog.Error(err.Error())
154 }
155 fmt.Printf("[%s][%s] Loot written to [%s]\n", cyan(m.output.CallingModule), cyan(m.AWSProfile), f)
156
157}
158
159func (m *AccessKeysModule) getAccessKeysForAllUsers() {
160

Callers 1

PrintAccessKeysMethod · 0.95

Calls 1

ErrorMethod · 0.80

Tested by

no test coverage detected