Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions aws/outbound-assumed-roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ func (m *OutboundAssumedRolesModule) executeChecks(r string, wg *sync.WaitGroup,
m.modLog.Error(err)
}
if res {
// wg.Add(1)
// m.CommandCounter.IncrTotal()
// m.getAssumeRoleLogEntriesPerRegion(r, wg, semaphore, dataReceiver)
wg.Add(1)
m.CommandCounter.IncrTotal()
m.getAssumeRoleLogEntriesPerRegion(r, wg, semaphore, dataReceiver)
wg.Add(1)
m.CommandCounter.IncrTotal()
m.getCrossAccountBatchGetImageEntriesPerRegion(r, wg, semaphore, dataReceiver)
Expand All @@ -334,9 +334,13 @@ func (m *OutboundAssumedRolesModule) getAssumeRoleLogEntriesPerRegion(r string,
//var LookupAttribute types.LookupAttribute
var pages int

days := 0 - m.Days
// Ensure input days is absolute value for lookback calculation.
days := m.Days
if (days < 0) {
days = -days
}
endTime := aws.Time(time.Now())
startTime := endTime.AddDate(0, 0, days)
startTime := endTime.AddDate(0, 0, -days)
for {
LookupEvents, err := m.CloudTrailClient.LookupEvents(
context.TODO(),
Expand Down Expand Up @@ -427,21 +431,25 @@ func (m *OutboundAssumedRolesModule) getCrossAccountBatchGetImageEntriesPerRegio
//var LookupAttribute types.LookupAttribute
var pages int

days := 0 - m.Days
// Ensure input days is absolute value for lookback calculation.
days := m.Days
if (days < 0) {
days = -days
}
endTime := aws.Time(time.Now())
startTime := endTime.AddDate(0, 0, days)
startTime := endTime.AddDate(0, 0, -days)
for {
LookupEvents, err := m.CloudTrailClient.LookupEvents(
context.TODO(),
&cloudtrail.LookupEventsInput{
EndTime: endTime,
StartTime: &startTime,
// LookupAttributes: []cloudtrailTypes.LookupAttribute{
// {
// AttributeKey: cloudtrailTypes.LookupAttributeKeyEventName,
// AttributeValue: aws.String("BatchGetImage"),
// },
// },
LookupAttributes: []cloudtrailTypes.LookupAttribute{
{
AttributeKey: cloudtrailTypes.LookupAttributeKeyEventName,
AttributeValue: aws.String("BatchGetImage"),
},
},
NextToken: PaginationControl,
},

Expand Down
2 changes: 1 addition & 1 deletion cli/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ func init() {
SNSCommand.Flags().BoolVarP(&StoreSNSAccessPolicies, "policies", "", false, "Store all flagged access policies along with the output")

// outbound-assumed-roles module flags
OutboundAssumedRolesCommand.Flags().IntVarP(&OutboundAssumedRolesDays, "days", "d", -7, "How many days of CloudTrail events should we go back and look at.")
OutboundAssumedRolesCommand.Flags().IntVarP(&OutboundAssumedRolesDays, "days", "d", 7, "How many days of CloudTrail events should we go back and look at.")

// iam-simulator module flags
IamSimulatorCommand.Flags().StringVar(&SimulatorPrincipal, "principal", "", "Principal Arn")
Expand Down