Last active
August 23, 2020 13:56
-
-
Save aabed/88b740f06e39541dbbb9b9ffd8dea17f to your computer and use it in GitHub Desktop.
dirty_sg_scanner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
response = ec2.describe_security_groups() | |
groups=set() | |
for sg in response.get('SecurityGroups'): | |
for rule in sg.get('IpPermissions'): | |
for cidr in rule.get('IpRanges'): | |
if cidr.get('CidrIp') == '0.0.0.0/0': | |
groups.add(sg.get('GroupId')) | |
print(groups) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment