Get RUS data / fix

This commit is contained in:
Be
2024-03-02 23:51:28 +01:00
parent bc10fb59f2
commit 1f0512c687
4 changed files with 31 additions and 2577 deletions

View File

@@ -8,7 +8,7 @@ env:
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
- cron: '0 6 * * *'
jobs:
build:

View File

@@ -8,7 +8,7 @@ env:
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 0'
- cron: '0 0,2,4 * * *'
jobs:
build:
@@ -29,7 +29,15 @@ jobs:
with:
python-version: '3.12'
- run: ./requirements.sh
- run: ./get_info_from_ripe.py
- run: |
hour=$(date +%H)
if (( 0 <= 10#$hour && 10#$hour < 1 )); then
./get_info_from_ripe.py --asn
elif (( 2 <= 10#$hour && 10#$hour < 3 )); then
./get_info_from_ripe.py --ipv4
else
./get_info_from_ripe.py --ipv6
fi
- uses: ./.github/actions/gitPush
env:
PUSH_FILES: auto/all-ru-*txt

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import argparse
import requests
import socket
@@ -42,11 +43,27 @@ def get_data(json, file, attr, field, prefix=""):
print(f"{x} {name}")
f.write(str(x+" "+name) + '\n')
parser = argparse.ArgumentParser()
parser.add_argument('--asn', action='store_true', help='Run the ASN query')
parser.add_argument('--ipv4', action='store_true', help='Run the IPv4 query')
parser.add_argument('--ipv6', action='store_true', help='Run the IPv6 query')
parser.add_argument('--all', action='store_true', help='Run all queries')
args = parser.parse_args()
if not (args.asn or args.ipv4 or args.ipv6 or args.all):
parser.print_help()
exit()
response = requests.get(url)
response.raise_for_status()
data = response.json()
get_data(data, 'auto/all-ru-asn.txt', 'asn', 'as-name', "AS")
get_data(data, 'auto/all-ru-ipv4.txt', 'ipv4', 'netname')
get_data(data, 'auto/all-ru-ipv6.txt', 'ipv6', 'netname')
if args.asn or args.all:
get_data(data, 'auto/all-ru-asn.txt', 'asn', 'as-name', "AS")
if args.ipv4 or args.all:
get_data(data, 'auto/all-ru-ipv4.txt', 'ipv4', 'netname')
if args.ipv6 or args.all:
get_data(data, 'auto/all-ru-ipv6.txt', 'ipv6', 'netname')