diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 0c8dcf83..8d09fc23 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -18,11 +18,12 @@ jobs: bash oracle/downloader.sh bash digitalocean/downloader.sh bash bing/downloader.sh - + bash github/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 | sort -h > all/ipv4.txt - cat google/ipv6.txt amazon/ipv6.txt microsoft/ipv6.txt digitalocean/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 | 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 - name: Set up Python 3.7 uses: actions/setup-python@v2 @@ -52,6 +53,7 @@ jobs: python utils/merge.py --source=oracle/ipv4.txt | sort -h > oracle/ipv4_merged.txt 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=all/ipv4.txt | sort -h > all/ipv4_merged.txt # ipv6 python utils/merge.py --source=google/ipv6.txt | sort -h > google/ipv6_merged.txt @@ -60,6 +62,7 @@ jobs: # oracle not provide ipv6 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=all/ipv6.txt | sort -h > all/ipv6_merged.txt - name: Commit files diff --git a/README.md b/README.md index 87643d61..f3dc429e 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,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/digitalocean/ipv6.txt - IPv6 (merged): https://raw.githubusercontent.com/lord-alfred/ipranges/main/digitalocean/ipv6_merged.txt +### GitHub + +- IPv4: https://raw.githubusercontent.com/lord-alfred/ipranges/main/github/ipv4.txt +- IPv4 (merged): https://raw.githubusercontent.com/lord-alfred/ipranges/main/github/ipv4_merged.txt +- 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 + ## All-In-One IPs A list of IP addresses from all sources combined into one file. diff --git a/github/downloader.sh b/github/downloader.sh new file mode 100644 index 00000000..8ff9cd3c --- /dev/null +++ b/github/downloader.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses + +set -euo pipefail +set -x + + +# get from public ranges +curl -s https://api.github.com/meta > /tmp/github.json + + +# get all prefixes without some keys +jq 'del(.["ssh_keys", "verifiable_password_authentication", "ssh_key_fingerprints"]) | .[] | .[]' -r /tmp/github.json > /tmp/github-all.txt + + +# save ipv4 +grep -v ':' /tmp/github-all.txt > /tmp/github-ipv4.txt + +# save ipv6 +grep ':' /tmp/github-all.txt > /tmp/github-ipv6.txt + + +# sort & uniq +sort -h /tmp/github-ipv4.txt | uniq > github/ipv4.txt +sort -h /tmp/github-ipv6.txt | uniq > github/ipv6.txt