Skip to content
Merged
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
15 changes: 6 additions & 9 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:

- name: Go 1.21
uses: actions/setup-go@v4
- name: Go 1.25
uses: actions/setup-go@v5
with:
go-version: ^1.20
go-version: ^1.25
id: go

- id: install-secret-key
Expand All @@ -28,7 +28,7 @@ jobs:
gpg --list-secret-keys --keyid-format LONG

- name: Check Out Code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Git Fetch Tags
run: git fetch --prune --unshallow --tags -f
Expand All @@ -39,9 +39,6 @@ jobs:


- name: Release binaries
uses: "marvinpinto/action-automatic-releases@latest"
uses: softprops/action-gh-release@v2
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
./cloudfox/*
files: ./cloudfox/*
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: pip install --user codespell
- run: codespell --ignore-words-list="aks,referers,invokable" --skip="*.sum"
4 changes: 2 additions & 2 deletions aws/access-keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (m *AccessKeysModule) getAccessKeysForAllUsers() {
ListUsers, err := sdk.CachedIamListUsers(m.IAMClient, aws.ToString(m.Caller.Account))
if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}

// added this to break out if there no users
Expand All @@ -171,7 +171,7 @@ func (m *AccessKeysModule) getAccessKeysForAllUsers() {
results, err := sdk.CachedIamListAccessKeys(m.IAMClient, aws.ToString(m.Caller.Account), aws.ToString(user.UserName))
if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
break
}

Expand Down
94 changes: 47 additions & 47 deletions aws/api-gws.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ func (m *ApiGwModule) executeChecks(r string, wg *sync.WaitGroup, semaphore chan
m.modLog.Error(err)
}
if res {
m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
wg.Add(1)
go m.getAPIGatewayAPIsPerRegion(r, wg, semaphore, dataReceiver)

m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
wg.Add(1)
go m.getAPIGatewayVIPsPerRegion(r, wg, semaphore, dataReceiver)

m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
wg.Add(1)
go m.getAPIGatewayv2APIsPerRegion(r, wg, semaphore, dataReceiver)

m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
wg.Add(1)
go m.getAPIGatewayv2VIPsPerRegion(r, wg, semaphore, dataReceiver)
}
Expand Down Expand Up @@ -244,7 +244,7 @@ func (m *ApiGwModule) writeLoot(outputDirectory string, verbosity int) string {
// err = os.WriteFile(f, []byte(out), 0644)
// if err != nil {
// m.modLog.Error(err.Error())
// m.CommandCounter.Error++
// m.CommandCounter.IncrError()
// panic(err.Error())
// }

Expand All @@ -263,30 +263,30 @@ func (m *ApiGwModule) writeLoot(outputDirectory string, verbosity int) string {

func (m *ApiGwModule) getAPIGatewayAPIsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan ApiGateway) {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
wg.Done()

}()
semaphore <- struct{}{}
defer func() {
<-semaphore
}()
// m.CommandCounter.Total++
m.CommandCounter.Pending--
m.CommandCounter.Executing++
// m.CommandCounter.IncrTotal()
m.CommandCounter.DecrPending()
m.CommandCounter.IncrExecuting()
// "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.

Items, err := sdk.CachedApiGatewayGetRestAPIs(m.APIGatewayClient, aws.ToString(m.Caller.Account), r)

if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return
}

for _, api := range Items {
m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
for _, endpoint := range m.getEndpointsPerAPIGateway(r, api) {
dataReceiver <- endpoint
}
Expand All @@ -295,25 +295,25 @@ func (m *ApiGwModule) getAPIGatewayAPIsPerRegion(r string, wg *sync.WaitGroup, s

func (m *ApiGwModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan ApiGateway) {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
wg.Done()

}()
semaphore <- struct{}{}
defer func() {
<-semaphore
}()
// m.CommandCounter.Total++
m.CommandCounter.Pending--
m.CommandCounter.Executing++
// m.CommandCounter.IncrTotal()
m.CommandCounter.DecrPending()
m.CommandCounter.IncrExecuting()
// "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.

Items, err := sdk.CachedApiGatewayGetRestAPIs(m.APIGatewayClient, aws.ToString(m.Caller.Account), r)

if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return
}

Expand All @@ -322,7 +322,7 @@ func (m *ApiGwModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, s
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return
}

Expand All @@ -334,7 +334,7 @@ func (m *ApiGwModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, s
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
break
}

Expand All @@ -347,7 +347,7 @@ func (m *ApiGwModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, s

for _, api := range Items {
if api.Id != nil && aws.ToString(api.Id) == aws.ToString(mapping.RestApiId) {
m.CommandCounter.Total++
m.CommandCounter.IncrTotal()

endpoints := m.getEndpointsPerAPIGateway(r, api)
for _, endpoint := range endpoints {
Expand Down Expand Up @@ -376,8 +376,8 @@ func (m *ApiGwModule) getAPIGatewayVIPsPerRegion(r string, wg *sync.WaitGroup, s

func (m *ApiGwModule) getEndpointsPerAPIGateway(r string, api apigatewayTypes.RestApi) []ApiGateway {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
}()
var gateways []ApiGateway

Expand All @@ -402,7 +402,7 @@ func (m *ApiGwModule) getEndpointsPerAPIGateway(r string, api apigatewayTypes.Re
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return gateways
}

Expand All @@ -411,7 +411,7 @@ func (m *ApiGwModule) getEndpointsPerAPIGateway(r string, api apigatewayTypes.Re
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}

for _, stage := range GetStages.Item {
Expand All @@ -427,7 +427,7 @@ func (m *ApiGwModule) getEndpointsPerAPIGateway(r string, api apigatewayTypes.Re
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}
}

Expand All @@ -454,29 +454,29 @@ func (m *ApiGwModule) getEndpointsPerAPIGateway(r string, api apigatewayTypes.Re

func (m *ApiGwModule) getAPIGatewayv2APIsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan ApiGateway) {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
wg.Done()

}()
semaphore <- struct{}{}
defer func() {
<-semaphore
}()
// m.CommandCounter.Total++
m.CommandCounter.Pending--
m.CommandCounter.Executing++
// m.CommandCounter.IncrTotal()
m.CommandCounter.DecrPending()
m.CommandCounter.IncrExecuting()
// "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.

Items, err := sdk.CachedAPIGatewayv2GetAPIs(m.APIGatewayv2Client, aws.ToString(m.Caller.Account), r)

if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return
}
for _, api := range Items {
m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
for _, endpoint := range m.getEndpointsPerAPIGatewayv2(r, api) {
dataReceiver <- endpoint
}
Expand All @@ -486,25 +486,25 @@ func (m *ApiGwModule) getAPIGatewayv2APIsPerRegion(r string, wg *sync.WaitGroup,

func (m *ApiGwModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan ApiGateway) {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
wg.Done()

}()
semaphore <- struct{}{}
defer func() {
<-semaphore
}()
// m.CommandCounter.Total++
m.CommandCounter.Pending--
m.CommandCounter.Executing++
// m.CommandCounter.IncrTotal()
m.CommandCounter.DecrPending()
m.CommandCounter.IncrExecuting()
// "PaginationMarker" is a control variable used for output continuity, as AWS return the output in pages.

Items, err := sdk.CachedAPIGatewayv2GetAPIs(m.APIGatewayv2Client, aws.ToString(m.Caller.Account), r)

if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
return
}

Expand All @@ -513,7 +513,7 @@ func (m *ApiGwModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup,
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}

for _, item := range GetDomainNames {
Expand All @@ -524,7 +524,7 @@ func (m *ApiGwModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup,
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
break
}

Expand All @@ -537,7 +537,7 @@ func (m *ApiGwModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup,

for _, api := range Items {
if api.ApiId != nil && aws.ToString(api.ApiId) == aws.ToString(mapping.ApiId) {
m.CommandCounter.Total++
m.CommandCounter.IncrTotal()
endpoints := m.getEndpointsPerAPIGatewayv2(r, api)
for _, endpoint := range endpoints {
var old string
Expand Down Expand Up @@ -568,8 +568,8 @@ func (m *ApiGwModule) getAPIGatewayv2VIPsPerRegion(r string, wg *sync.WaitGroup,

func (m *ApiGwModule) getEndpointsPerAPIGatewayv2(r string, api apigatewayV2Types.Api) []ApiGateway {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
m.CommandCounter.DecrExecuting()
m.CommandCounter.IncrComplete()
}()

var gateways []ApiGateway
Expand All @@ -588,7 +588,7 @@ func (m *ApiGwModule) getEndpointsPerAPIGatewayv2(r string, api apigatewayV2Type
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}

for _, stage := range GetStages {
Expand All @@ -603,7 +603,7 @@ func (m *ApiGwModule) getEndpointsPerAPIGatewayv2(r string, api apigatewayV2Type
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
}

for _, stage := range stages {
Expand Down Expand Up @@ -643,7 +643,7 @@ func (m *ApiGwModule) ApiGatewayApiKeyRequired(r string, ApiId *string, Resource
if err != nil {
m.Errors = append(m.Errors, fmt.Sprintf(" Error: Region: %s", r))
m.modLog.Error(err.Error())
m.CommandCounter.Error++
m.CommandCounter.IncrError()
} else {
return aws.ToBool(GetMethod.ApiKeyRequired)
}
Expand Down
Loading