Last active
July 29, 2020 07:22
-
-
Save prrraveen/4d3edadfebfa47bd3f54f9b5d790e435 to your computer and use it in GitHub Desktop.
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
#Is source/target an IP v4? | |
if len(rule['IpRanges']) > 0: | |
for ip_range in rule['IpRanges']: | |
cidr_block = ip_range['CidrIp'] | |
print("%s,%s,%s,%s,%s,%s" % ("", "", "", ip_protpcol, port_range, cidr_block, description)) | |
#Is source/target an IP v6? | |
if len(rule['Ipv6Ranges']) > 0: | |
for ip_range in rule['Ipv6Ranges']: | |
cidr_block = ip_range['CidrIpv6'] | |
print("%s,%s,%s,%s,%s,%s" % ("", "", "", ip_protpcol, port_range, cidr_block, description )) | |
#Is source/target a security group? | |
if len(rule['UserIdGroupPairs']) > 0: | |
for source in rule['UserIdGroupPairs']: | |
from_source = source['GroupId'] | |
print("%s,%s,%s,%s,%s,%s" % ("", "", "", ip_protpcol, port_range, from_source, description)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment