diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 8d09fc23..7df89642 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -19,11 +19,12 @@ jobs: bash digitalocean/downloader.sh bash bing/downloader.sh bash github/downloader.sh + bash facebook/downloader.sh - name: Create All-In-One ranges run: | - cat google/ipv4.txt amazon/ipv4.txt microsoft/ipv4.txt oracle/ipv4.txt digitalocean/ipv4.txt bing/ipv4.txt github/ipv4.txt | sort -h > all/ipv4.txt - cat google/ipv6.txt amazon/ipv6.txt microsoft/ipv6.txt digitalocean/ipv6.txt github/ipv6.txt | sort -h > all/ipv6.txt + cat google/ipv4.txt amazon/ipv4.txt microsoft/ipv4.txt oracle/ipv4.txt digitalocean/ipv4.txt bing/ipv4.txt github/ipv4.txt facebook/ipv4.txt | sort -h > all/ipv4.txt + cat google/ipv6.txt amazon/ipv6.txt microsoft/ipv6.txt digitalocean/ipv6.txt github/ipv6.txt facebook/ipv6.txt | sort -h > all/ipv6.txt - name: Set up Python 3.7 uses: actions/setup-python@v2 @@ -54,6 +55,7 @@ jobs: python utils/merge.py --source=digitalocean/ipv4.txt | sort -h > digitalocean/ipv4_merged.txt python utils/merge.py --source=bing/ipv4.txt | sort -h > bing/ipv4_merged.txt python utils/merge.py --source=github/ipv4.txt | sort -h > github/ipv4_merged.txt + python utils/merge.py --source=facebook/ipv4.txt | sort -h > facebook/ipv4_merged.txt python utils/merge.py --source=all/ipv4.txt | sort -h > all/ipv4_merged.txt # ipv6 python utils/merge.py --source=google/ipv6.txt | sort -h > google/ipv6_merged.txt @@ -63,6 +65,7 @@ jobs: python utils/merge.py --source=digitalocean/ipv6.txt | sort -h > digitalocean/ipv6_merged.txt # bing not provide ipv6 python utils/merge.py --source=github/ipv6.txt | sort -h > github/ipv6_merged.txt + python utils/merge.py --source=facebook/ipv6.txt | sort -h > facebook/ipv6_merged.txt python utils/merge.py --source=all/ipv6.txt | sort -h > all/ipv6_merged.txt - name: Commit files diff --git a/README.md b/README.md index 5e2f71ad..530676f8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # IPRanges -List all IP ranges from: Google (Cloud & GoogleBot), Bing (Bingbot), Amazon (AWS), Microsoft (Azure), Oracle (Cloud), DigitalOcean and GitHub with daily updates. +List all IP ranges from: Google (Cloud & GoogleBot), Bing (Bingbot), Amazon (AWS), Microsoft (Azure), Oracle (Cloud), DigitalOcean, GitHub and Facebook (Meta) with daily updates. All lists are obtained from public sources. @@ -59,6 +59,13 @@ All addresses are stored in `.txt` files with CIDRs, where each range is on a ne - IPv6: https://raw.githubusercontent.com/lord-alfred/ipranges/main/github/ipv6.txt - IPv6 (merged): https://raw.githubusercontent.com/lord-alfred/ipranges/main/github/ipv6_merged.txt +### Facebook (Meta) + +- IPv4: https://raw.githubusercontent.com/lord-alfred/ipranges/main/facebook/ipv4.txt +- IPv4 (merged): https://raw.githubusercontent.com/lord-alfred/ipranges/main/facebook/ipv4_merged.txt +- IPv6: https://raw.githubusercontent.com/lord-alfred/ipranges/main/facebook/ipv6.txt +- IPv6 (merged): https://raw.githubusercontent.com/lord-alfred/ipranges/main/facebook/ipv6_merged.txt + ## All-In-One IPs A list of IP addresses from all sources combined into one file. diff --git a/facebook/downloader.sh b/facebook/downloader.sh new file mode 100644 index 00000000..17e9cd7e --- /dev/null +++ b/facebook/downloader.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# https://www.workplace.com/resources/tech/it-configuration/domain-whitelisting +# https://www.irr.net/docs/list.html +# https://bgp.he.net/search?search%5Bsearch%5D=facebook&commit=Search + +set -euo pipefail +set -x + + +# get from Autonomous System +get_routes() { + whois -h riswhois.ripe.net -- "-i origin $1" | grep '^route' | awk '{ print $2; }' + whois -h whois.radb.net -- "-i origin $1" | grep '^route' | awk '{ print $2; }' + whois -h rr.ntt.net -- "-i origin $1" | grep '^route' | awk '{ print $2; }' + whois -h whois.rogerstelecom.net -- "-i origin $1" | grep '^route' | awk '{ print $2; }' + whois -h whois.bgp.net.br -- "-i origin $1" | grep '^route' | awk '{ print $2; }' +} + +get_routes 'AS32934' > /tmp/facebook.txt +get_routes 'AS63293' >> /tmp/facebook.txt + + +# save ipv4 +grep -v ':' /tmp/facebook.txt > /tmp/facebook-ipv4.txt + +# save ipv6 +grep ':' /tmp/facebook.txt > /tmp/facebook-ipv6.txt + + +# sort & uniq +sort -h /tmp/facebook-ipv4.txt | uniq > facebook/ipv4.txt +sort -h /tmp/facebook-ipv6.txt | uniq > facebook/ipv6.txt