Update tor exit_addresses + or_addresses #2835
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update tor exit_addresses + or_addresses | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "00 0,6,12,18 * * *" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 1 | |
- name: Get IPv4 exit_addresses + or_addresses, delete ports and sort-unique output | |
run: | | |
ip4regex="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" | |
tor_ipv4=$(curl -s 'https://onionoo.torproject.org/details?flag=Exit&fields=exit_addresses,or_addresses' 2>/dev/null \ | |
| grep -Po '[[,]"\K[^"]*' | grep -v 'or_addresses\|exit_addresses' | sed "s/:[0-9]*$//g" \ | |
| grep -oE "${ip4regex}" | sort -Vu); \ | |
if [ $(echo "${tor_ipv4}" | grep -coE "${ip4regex}") -ge 1000 ]; then \ | |
echo "${tor_ipv4}" > exits-ipv4.txt;fi #update file only if there are enough ipv4 found | |
- name: Get IPv6 exit_addresses + or_addresses, delete ports and sort-unique output | |
run: | | |
ipregex='(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|\ | |
([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|\ | |
([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|\ | |
[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|\ | |
::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|\ | |
([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))' | |
ip6regex="$(printf '%s' "${ipregex//[[:space:]]/}" | sed 's/\|\\//g')" | |
tor_ipv6=$(curl -s 'https://onionoo.torproject.org/details?flag=Exit&fields=exit_addresses,or_addresses' 2>/dev/null \ | |
| grep -Po '[[,]"\K[^"]*' | grep -v 'or_addresses\|exit_addresses' | sed "s/:[0-9]*$//g" \ | |
| grep -oE "${ip6regex}" | sort -Vu); | |
if [ $(echo "${tor_ipv6}" | grep -coE "${ip6regex}") -ge 500 ]; then \ | |
echo "${tor_ipv6}" > exits-ipv6.txt;fi #update file only if there are enough ipv6 found | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d - %H:%M:%S')" | |
- name: Upload Stuff to GitHub via https://github.com/stefanzweifel/git-auto-commit-action | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
file_pattern: '*.txt' | |
disable_globbing: true | |
commit_message: Update TOR Lists - ${{ steps.date.outputs.date }} |