Documentation ¶
Index ¶
- Variables
- func AssumeRoleWithInstance(account AccountInfo, region string) (*session.Session, error)
- func AssumeRoleWithProfile(account AccountInfo, region string) *session.Session
- func CreateFile(name string) (file *os.File, err error)
- func GenPassword(n int) string
- func GetAccountId(sess *session.Session) (string, error)
- func LoadConfigFile()
- func LogAll(args ...interface{})
- func MakeDir(path string)
- func OpenSession(profile string, region string) *session.Session
- func PrettyPrintJson(input interface{})
- func ReadFile(path string) ([]string, error)
- type AccountInfo
- type ELBIPInfo
- type ELBLogInfo
- type Ec2Options
- type GeoIpInfo
- type Sessioninfo
Constants ¶
This section is empty.
Variables ¶
var (
RegionMap = []string{"us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-west-1", "eu-central-1", "eu-west-2", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1"}
)
Functions ¶
func AssumeRoleWithInstance ¶
func AssumeRoleWithInstance(account AccountInfo, region string) (*session.Session, error)
Assumes the role of the given arn with the instance profile and returns a session into the account associated with the arn
func AssumeRoleWithProfile ¶
func AssumeRoleWithProfile(account AccountInfo, region string) *session.Session
Assumes the role of the specified profile
func CreateFile ¶
CreateFile will create a file with a given name It will check to ensure that it does not overwrite a file with the same name
func GenPassword ¶
Will generate a password with length of n using a custom random password generator
func GetAccountId ¶
GetAccountId will get the account ID for the profile currently in use for the session
func MakeDir ¶
func MakeDir(path string)
This will create a new directory with the given path relative to where the script was run from
func PrettyPrintJson ¶
func PrettyPrintJson(input interface{})
Will take in a struct and print with pretty json
Types ¶
type AccountInfo ¶
type AccountInfo struct { AccountId string Arn string // only required if AccessType is instanceassume ExternalId string AccessType string Profile string }
If AccessType is role, then the Profile needs to be configured in your shared config file ~/.aws/config to use have the assume role config setup Example:
[profile <profile name>] role_arn = arn:aws:iam::123456789012:role/<role name> source_profile = <source profile in ~/.aws/credentials> region = us-east-1 output = json
If AccessType is profile, then it will just use the profile in your shared credential file ~/.aws/credentials
func BuildAccountsSlice ¶
func BuildAccountsSlice(profilesFile string, accessType string) ([]AccountInfo, error)
func (AccountInfo) GetSession ¶
func (account AccountInfo) GetSession(region string) (*session.Session, error)
func (AccountInfo) SetAccountId ¶
func (account AccountInfo) SetAccountId() error
type ELBLogInfo ¶
type ELBLogInfo []ELBIPInfo
func ParseELBLog ¶
func ParseELBLog(path string, geo bool) (ELBLogInfo, error)
ParseELBLog will parse an elb log file and return the relevant details Will also check the Geo location of the IP if "geo" is true
type Ec2Options ¶
type Ec2Options struct {
Tags []string
}
type GeoIpInfo ¶
func GetIPGeoLocation ¶
GetIPGeoLocation will use api.hackertarget.com to find the location of an IP