percolate / ec2-security-groups-dumper

Dump your EC2 Security Groups as a CSV or JSON file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issues with csv

ghoshtapo opened this issue · comments

Thanks for coming up with this nice tool. But I get an error for csv option

ec2-security-groups-dumper --csv
Traceback (most recent call last):
File "/usr/local/bin/ec2-security-groups-dumper", line 11, in
sys.exit(main())
File "/Library/Python/2.7/site-packages/ec2_security_groups_dumper/main.py", line 295, in main
print firewall.csv
File "/Library/Python/2.7/site-packages/ec2_security_groups_dumper/main.py", line 228, in csv
for fr in self.rules:
File "/Library/Python/2.7/site-packages/ec2_security_groups_dumper/main.py", line 162, in rules
rules_grants_cidr_ip=grant_row['cidr_ip'])
File "/Library/Python/2.7/site-packages/ec2_security_groups_dumper/main.py", line 57, in init
assert rules_ip_protocol in (u'tcp', u'udp', u'icmp', None)
AssertionError

Can you dump a redacted json dump to see why you would have an unsupported ip protocol?

Thanks for creating this awesome app! I'm having the same issues as above and feel it's because other security groups are tied to the one being dumped and it's showing up as followed:
"direction": "INGRESS",
"from_port": null,
"ip_protocol": "-1",
"to_port": null

I can't reproduce the issue, would you have more info to share?

python main.py --region=xxxxx --profile=xxxx --vpc=vpc-xxxxx --csv
Traceback (most recent call last):
File "main.py", line 355, in
main()
File "main.py", line 351, in main
print firewall.csv
File "main.py", line 252, in csv
for fr in self.rules:
File "main.py", line 182, in rules
rules_grants_cidr_ip=grant_row['cidr_ip'])
File "main.py", line 62, in init
assert rules_ip_protocol in (u'tcp', u'udp', u'icmp', "-1", None)
AssertionError

Fixed it with the following:

assert rules_ip_protocol in (u'tcp', u'udp', u'icmp', u'icmpv6', "-1", None)

Will need to edit additional protocols for v6.

awesome, feel free to do a PR if you know how to

Fixed in #11

Thanks for this great app. I am getting the below error for csv. Can you please help in fixing it?

Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/ec2_security_groups_dumper/main.py", line 374, in
main()
File "/usr/local/lib/python2.7/site-packages/ec2_security_groups_dumper/main.py", line 370, in main
print firewall.csv
File "/usr/local/lib/python2.7/site-packages/ec2_security_groups_dumper/main.py", line 266, in csv
for fr in self.rules:
File "/usr/local/lib/python2.7/site-packages/ec2_security_groups_dumper/main.py", line 181, in rules
rules_description=grant_row['description'])
File "/usr/local/lib/python2.7/site-packages/ec2_security_groups_dumper/main.py", line 64, in init
u'tcp', u'udp', u'icmp', u'icmpv6', "-1", None)
AssertionError

I am able to fix by updating like below:

    assert rules_ip_protocol in (
        u'tcp', u'udp', u'icmp', u'icmpv6', "4", "50", "-1", None)