To iterate over all security groups and print your rules, including protocol, ports and ip range, try the following:
import boto.ec2
conn = boto.ec2.connect_to_region("eu-west-1")
groups = conn.get_all_security_groups()
for group in groups:
print group.name
for rule in group.rules:
print rule.ip_protocol, rule.from_port, rule.to_port, rule.grants
which may result in:
default
tcp 22 22 [0.0.0.0/0]
tcp 80 80 [0.0.0.0/0]