| 135 | } |
| 136 | |
| 137 | func (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 | |
| 159 | func (m *AccessKeysModule) getAccessKeysForAllUsers() { |
| 160 | |