### CSV Data Structure Example Source: https://context7.com/jhassine/server-ip-addresses/llms.txt Example of the CSV output format containing CIDR block information, including the CIDR notation, minimum and maximum host IPs, and the associated cloud vendor. This structure is designed for easy parsing and filtering. ```csv "cidr","hostmin","hostmax","vendor" "1.178.1.0/24","1.178.1.0","1.178.1.255","AWS" "104.16.0.0/13","104.16.0.0","104.23.255.255","CloudFlare" "35.190.0.0/17","35.190.0.0","35.190.127.255","GCP" "20.33.0.0/16","20.33.0.0","20.33.255.255","Azure" ``` -------------------------------- ### Run Data Generator Locally with Docker Source: https://context7.com/jhassine/server-ip-addresses/llms.txt Builds and runs a Docker container to regenerate the CIDR data from upstream sources (AWS, Azure, GCP, CloudFlare). This process fetches and processes all IP data, writing the output to `./data/datacenters.csv` and `./data/datacenters.txt`. Requires Docker and Docker Compose to be installed. ```bash # Build the Docker image docker compose build app # Run the generator to fetch and process all CIDR data docker compose run --rm app # Expected output: # AWS CIDRs: 8000+ # CloudFlare CIDRs: 15 # GCP CIDRs: 500+ # Azure CIDRs: 40000+ # Success! # Output files are written to ./data/datacenters.csv and ./data/datacenters.txt ``` -------------------------------- ### IP Address Lookup in CIDR Ranges Source: https://context7.com/jhassine/server-ip-addresses/llms.txt Checks if a specific IP address falls within any of the known datacenter CIDR ranges. This can be done using command-line tools like `grepcidr` or programmatically with Python. The examples demonstrate fetching the CIDR list and then performing the lookup. ```bash # Download the CIDR list curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.txt > cidrs.txt # Check if an IP (e.g., 3.5.140.100) matches any CIDR using grepcidr # Install: apt-get install grepcidr (Debian/Ubuntu) or brew install grepcidr (macOS) echo "3.5.140.100" | grepcidr -f cidrs.txt && echo "IP is from a datacenter" || echo "IP is not from a datacenter" ``` ```python import ipaddress import urllib.request # Fetch CIDR list url = "https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.txt" cidrs = urllib.request.urlopen(url).read().decode().strip().split('\n') # Check an IP address ip_to_check = ipaddress.ip_address("3.5.140.100") for cidr in cidrs: if cidr and ip_to_check in ipaddress.ip_network(cidr.strip()): print(f"IP {ip_to_check} is in datacenter range: {cidr}") break else: print(f"IP {ip_to_check} is not from a known datacenter") ``` -------------------------------- ### Fetch CIDR Data - Plain Text Format Source: https://context7.com/jhassine/server-ip-addresses/llms.txt Retrieves a simple, one-line-per-CIDR block list of all datacenter IP ranges. This format is ideal for direct integration with firewall rules or IP filtering systems. The data is fetched using `curl` and can be saved to a file or counted. ```bash # Download the latest CIDR blocks as plain text curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.txt # Example output: # 1.178.1.0/24 # 1.178.4.0/24 # 1.178.5.0/24 # 3.0.0.0/15 # 3.2.0.0/24 # ... # Save to a local file for firewall import curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.txt > datacenter-cidrs.txt # Count total CIDR blocks curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.txt | wc -l ``` -------------------------------- ### Fetch CIDR Data - CSV Format Source: https://context7.com/jhassine/server-ip-addresses/llms.txt Retrieves detailed CIDR information in CSV format, including IP range boundaries (hostmin, hostmax) and vendor attribution. This format is suitable for analytics and more granular filtering. The data can be fetched using `curl` and filtered using standard command-line tools like `grep`. ```bash # Download the CSV with full details (cidr, hostmin, hostmax, vendor) curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.csv # Example output: # "cidr","hostmin","hostmax","vendor" # "1.178.1.0/24","1.178.1.0","1.178.1.255","AWS" # "1.178.4.0/24","1.178.4.0","1.178.4.255","AWS" # "104.16.0.0/13","104.16.0.0","104.23.255.255","CloudFlare" # "35.190.0.0/17","35.190.0.0","35.190.127.255","GCP" # "20.33.0.0/16","20.33.0.0","20.33.255.255","Azure" # Filter by specific vendor (e.g., AWS only) curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.csv | grep "AWS" # Filter by specific vendor (e.g., CloudFlare only) curl -sL https://raw.githubusercontent.com/jhassine/server-ip-addresses/master/data/datacenters.csv | grep "CloudFlare" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.