Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added condiiton for AWS ipv6 #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added br.py
Empty file.
12 changes: 8 additions & 4 deletions cloud_ip_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ def match_aws(target_ip):
logger.info('Checking for AWS')
aws_url = 'https://ip-ranges.amazonaws.com/ip-ranges.json'
aws_ips = requests.get(aws_url, allow_redirects=True).json()

for item in aws_ips["prefixes"]:
if target_ip in IPNetwork(str(item["ip_prefix"])):
for ipv4 in aws_ips["prefixes"]:
if target_ip in IPNetwork(str(ipv4["ip_prefix"])):
matched = True
logger.info(f'Match for AWS range '
f'"{item["ip_prefix"]}", region "{item["region"]}" and service "{item["service"]}"')
f'"{ipv4["ip_prefix"]}", region "{ipv4["region"]}" and service "{ipv4["service"]}"')

for ipv6 in aws_ips["ipv6_prefixes"]:
if target_ip in IPNetwork(str(ipv6["ipv6_prefix"])):
matched = True
logger.info(f'Match for AWS range '
f'"{ipv6["ipv6_prefix"]}", region "{ipv6["region"]}" and service "{ipv6["service"]}"')
except Exception as e:
logger.error(f'Error: {e}')

Expand Down
Empty file added external_users_CYBER-41166
Empty file.
Empty file added known_vpn_ips.py
Empty file.
Empty file added list_ip.py
Empty file.
Loading