Compare commits

...
11 Commits
Author SHA1 Message Date
David 70a050a973 Merge pull request #90 from BishopFox/add-386-binary-to-release
Update Makefile to include 386 linux binary for release action
2024-07-03 22:39:48 -04:00
David 738085dc78 fix typo from codespell 2024-07-03 17:59:19 -04:00
Seth Art 0ac24e3aa1 Update utils.go
bumping the version so that once this is merged and we can create a new tag and release on the new version
2024-07-02 11:48:36 -04:00
Seth Art 5ba8b087ff Update Makefile to include 386 linux binary for release action 2024-07-02 11:45:44 -04:00
Bastien Faure b02ad612f0 Merge pull request #89 from BishopFox/aws-databases-rds-fix
Aws databases rds fix
2024-06-03 19:47:52 -07:00
Bastien Faure 3759d2c57d Merge pull request #87 from testwill/close_file
fix: close input file
2024-06-03 19:46:25 -07:00
Seth Art 0b88bcac56 Updated tests to make sure that RDS instances without clusters are checked for 2024-05-29 11:30:49 -04:00
Seth Art 91f5f14f0e Added RDS database instances back into output. I think it's ok to have both clusters and instances in the output 2024-05-29 10:07:02 -04:00
guangwu ca810a00d7 fix: close input file 2024-05-11 20:43:07 +08:00
David d9cbefd911 Merge pull request #84 from BishopFox/graph
v1.14.0, cape
2024-04-16 14:41:05 -04:00
Seth Art bfa95acafe Merge pull request #81 from BishopFox/bastien_directoryservice_aws
Add Directory Service support for AWS
2024-04-16 14:14:32 -04:00
7 changed files with 100 additions and 8 deletions

No files matched your search

+6 -2
View File
@@ -24,7 +24,7 @@ all: windows linux macos
.PHONY: release
release: clean
mkdir -p ./cloudfox
mkdir -p ./cloudfox
GOOS=windows GOARCH=amd64 go build -o ./cloudfox/cloudfox.exe .
zip ./cloudfox/cloudfox-windows-amd64.zip ./cloudfox/cloudfox.exe
rm -rf ./cloudfox/cloudfox.exe
@@ -33,6 +33,10 @@ release: clean
zip ./cloudfox/cloudfox-linux-amd64.zip ./cloudfox/cloudfox .
rm -rf ./cloudfox/cloudfox
GOOS=linux GOARCH=386 go build -o ./cloudfox/cloudfox .
zip ./cloudfox/cloudfox-linux-386.zip ./cloudfox/cloudfox .
rm -rf ./cloudfox/cloudfox
GOOS=darwin GOARCH=amd64 go build -o ./cloudfox/cloudfox .
zip ./cloudfox/cloudfox-macos-amd64.zip ./cloudfox/cloudfox
rm -rf ./cloudfox/cloudfox
@@ -42,4 +46,4 @@ release: clean
rm -rf ./cloudfox/cloudfox
clean:
rm -rf ./cloudfox
rm -rf ./cloudfox
+78
View File
@@ -271,6 +271,15 @@ func (m *DatabasesModule) executeRdsCheck(r string, wg *sync.WaitGroup, semaphor
service: "rds",
executor: m.getRdsClustersPerRegion,
})
m.executeCheck(check{
region: r,
wg: wg,
semaphore: semaphore,
dataReceiver: dataReceiver,
serviceMap: servicemap,
service: "rds",
executor: m.getRdsInstancesPerRegion,
})
}
func (m *DatabasesModule) executeRedshiftCheck(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Database, servicemap *awsservicemap.AwsServiceMap) {
@@ -395,6 +404,75 @@ func (m *DatabasesModule) getRdsClustersPerRegion(r string, wg *sync.WaitGroup,
}
}
func (m *DatabasesModule) getRdsInstancesPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Database) {
defer func() {
m.CommandCounter.Executing--
m.CommandCounter.Complete++
wg.Done()
}()
semaphore <- struct{}{}
defer func() {
<-semaphore
}()
m.CommandCounter.Pending--
m.CommandCounter.Executing++
DBInstances, err := sdk.CachedRDSDescribeDBInstances(m.RDSClient, aws.ToString(m.Caller.Account), r)
if err != nil {
m.modLog.Error(err.Error())
m.CommandCounter.Error++
return
}
for _, instance := range DBInstances {
var public string
var service string
var roles string
if instance.Endpoint == nil {
continue
}
name := aws.ToString(instance.DBInstanceIdentifier)
port := instance.Endpoint.Port
endpoint := aws.ToString(instance.Endpoint.Address)
engine := aws.ToString(instance.Engine)
if aws.ToBool(instance.PubliclyAccessible) {
public = "True"
} else {
public = "False"
}
if isNeptune(instance.Engine) {
service = "Neptune"
} else if isDocDB(instance.Engine) {
service = "DocsDB"
} else {
service = "RDS"
}
associatedRoles := instance.AssociatedRoles
for _, role := range associatedRoles {
roles = roles + aws.ToString(role.RoleArn) + " "
}
dataReceiver <- Database{
AWSService: service,
Region: r,
Name: name,
Engine: engine,
Endpoint: endpoint,
UserName: aws.ToString(instance.MasterUsername),
Port: aws.ToInt32(port),
Protocol: aws.ToString(instance.Engine),
Public: public,
Roles: roles,
}
}
}
func (m *DatabasesModule) getRedshiftDatabasesPerRegion(r string, wg *sync.WaitGroup, semaphore chan struct{}, dataReceiver chan Database) {
defer func() {
m.CommandCounter.Executing--
+5 -4
View File
@@ -42,10 +42,11 @@ func TestDatabasesCommand(t *testing.T) {
}
expectedResults := []string{
"db1.cluster-123456789012.us-west-2.rds.amazonaws.com",
"db2.cluster-123456789012.us-west-2.rds.amazonaws.com",
"db3.cluster-123456789012.us-west-2.neptune.amazonaws.com",
"db4.cluster-123456789012.us-west-2.docdb.amazonaws.com",
"db1.cluster-123456789012.us-west-2.rds.amazonaws.com", // make sure it includes the Aurora clusters
"db2.cluster-123456789012.us-west-2.rds.amazonaws.com", // make sure it includes the Aurora clusters
"db3.cluster-123456789012.us-west-2.neptune.amazonaws.com", // make sure it includes the Neptune instances
"db4.cluster-123456789012.us-west-2.docdb.amazonaws.com", // make sure it includes the DocumentDB instances
"db1-instances-1.blah.us-west-2.rds.amazonaws.com", // make sure it includes the RDS instances
}
for _, expected := range expectedResults {
+8
View File
@@ -21,6 +21,10 @@ func (m *MockedRDSClient) DescribeDBInstances(ctx context.Context, input *rds.De
EngineVersion: aws.String("13.3"),
InstanceCreateTime: aws.Time(time.Now()),
MasterUsername: aws.String("postgres"),
Endpoint: &rdsTypes.Endpoint{
Address: aws.String("db1-instances-1.blah.us-west-2.rds.amazonaws.com"),
Port: aws.Int32(5432),
},
},
{
DBInstanceIdentifier: aws.String("db2"),
@@ -28,6 +32,10 @@ func (m *MockedRDSClient) DescribeDBInstances(ctx context.Context, input *rds.De
EngineVersion: aws.String("13.3"),
InstanceCreateTime: aws.Time(time.Now()),
MasterUsername: aws.String("postgres"),
Endpoint: &rdsTypes.Endpoint{
Address: aws.String("db2-instances-1.blah.us-west-2.rds.amazonaws.com"),
Port: aws.Int32(5432),
},
},
},
}, nil
+1 -1
View File
@@ -17,7 +17,7 @@ package iamservice
// Projects []string
// }
// // Be incorportated in iam.go
// // Be incorporated in iam.go
// func (m *AccessTokensModule) PrintAccessTokens(outputFormat string, outputDirectory string, verbosity int) error {
// GCPLogger.InfoM(fmt.Sprintf("Enumerating GCP local access tokens (%s, %s)...", color.CyanString("default user token"), color.RedString("application-default token")), globals.GCP_ACCESSTOKENS_MODULE_NAME)
// tokens := gcp.ReadRefreshTokens()
+1 -1
View File
@@ -4,4 +4,4 @@ const CLOUDFOX_USER_AGENT = "cloudfox"
const CLOUDFOX_LOG_FILE_DIR_NAME = ".cloudfox"
const CLOUDFOX_BASE_DIRECTORY = "cloudfox-output"
const LOOT_DIRECTORY_NAME = "loot"
const CLOUDFOX_VERSION = "1.14.0"
const CLOUDFOX_VERSION = "1.14.1"
+1
View File
@@ -10,6 +10,7 @@ func LoadFileLinesIntoArray(input string) []string {
if err != nil {
return []string{input}
}
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Split(bufio.ScanLines)