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

Method getAccessKeysForAllUsers

aws/access-keys.go:159–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157}
158
159func (m *AccessKeysModule) getAccessKeysForAllUsers() {
160
161 ListUsers, err := sdk.CachedIamListUsers(m.IAMClient, aws.ToString(m.Caller.Account))
162 if err != nil {
163 m.modLog.Error(err.Error())
164 m.CommandCounter.IncrError()
165 }
166
167 // added this to break out if there no users
168 if len(ListUsers) != 0 {
169 for _, user := range ListUsers {
170
171 results, err := sdk.CachedIamListAccessKeys(m.IAMClient, aws.ToString(m.Caller.Account), aws.ToString(user.UserName))
172 if err != nil {
173 m.modLog.Error(err.Error())
174 m.CommandCounter.IncrError()
175 break
176 }
177
178 // This for loop extracts relevant information for each access key and adds to output array
179 for _, key := range results {
180
181 if key.Status == "Active" {
182 m.AnalyzedUsers = append(m.AnalyzedUsers, UserKeys{Username: *user.UserName, Key: *key.AccessKeyId})
183 }
184 }
185 }
186 }
187}

Callers 1

PrintAccessKeysMethod · 0.95

Calls 4

CachedIamListUsersFunction · 0.92
CachedIamListAccessKeysFunction · 0.92
ErrorMethod · 0.80
IncrErrorMethod · 0.80

Tested by

no test coverage detected