types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultModuleName = "AWTest"
View Source
const InvalidAccessKeyId = "InvalidAccessKeyId"
View Source
const InvalidClientTokenId = "InvalidClientTokenId"
View Source
const MaxAccessibleMethodsInSummary = 20

MaxAccessibleMethodsInSummary caps the number of accessible method names displayed in text/table summaries to avoid overwhelming output.

Variables

View Source
var AwsErrorMessages = map[string]string{
	"UnauthorizedOperation": "You don't have permission to perform this operation.",
	"InvalidAccessKeyId":    "Invalid access key. Aborting scan.",
	"AccessDeniedException": "Access denied to this service.",
	"InvalidClientTokenId":  "The security token included in the request is invalid. Aborting scan.",
}
View Source
var Regions = []string{
	"us-east-1",
	"us-east-2",
	"us-west-1",
	"us-west-2",
}

Functions

func FormatAccessibleMethods

func FormatAccessibleMethods(methods []string, formatName func(string) string) []string

FormatAccessibleMethods returns the accessible methods section lines for summary display. The formatName parameter allows callers to wrap method names (e.g., with ANSI coloring). Returns nil if there are no accessible methods.

Types

type AWSService

type AWSService struct {
	Name       string
	Call       func(context.Context, *session.Session) (interface{}, error)
	Process    func(interface{}, error, bool) []ScanResult
	ModuleName string
}

type InvalidKeyError

type InvalidKeyError struct {
	Message string
}

func (*InvalidKeyError) Error

func (e *InvalidKeyError) Error() string

type ScanResult

type ScanResult struct {
	ServiceName  string                 // e.g., "S3", "EC2", "IAM"
	MethodName   string                 // e.g., "s3:ListBuckets", "ec2:DescribeInstances"
	ResourceType string                 // e.g., "bucket", "instance", "user"
	ResourceName string                 // e.g., "my-bucket", "i-1234567890abcdef0"
	Details      map[string]interface{} // Service-specific details (region, count, metadata)
	Error        error                  // nil if successful, error if failed
	Timestamp    time.Time              // When this result was collected
}

ScanResult represents a single result from an AWS service enumeration. It captures service-specific information along with metadata about the scan.

func (ScanResult) HasError

func (sr ScanResult) HasError() bool

HasError returns true if the scan result contains an error.

type ScanSummary

type ScanSummary struct {
	TotalServices         int
	AccessibleServices    int
	AccessDeniedServices  int
	TotalResources        int
	AccessibleMethodNames []string
	ScanDuration          time.Duration
	Timestamp             time.Time
}

ScanSummary holds aggregate statistics about a completed scan.

func GenerateSummary

func GenerateSummary(results []ScanResult, startTime time.Time) ScanSummary

GenerateSummary computes aggregate scan statistics from results. A service can appear in both accessible and denied counts if it has mixed success/error results (e.g., S3 ListBuckets succeeds but ListObjects fails).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL