mirror of
https://github.com/C24Be/AS_Network_List.git
synced 2026-01-24 23:26:38 +03:00
Get RUS data / fix
This commit is contained in:
2
.github/workflows/update_blacklists.yml
vendored
2
.github/workflows/update_blacklists.yml
vendored
@@ -8,7 +8,7 @@ env:
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 2 * * *'
|
- cron: '0 6 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
12
.github/workflows/update_ru_all_lists.yml
vendored
12
.github/workflows/update_ru_all_lists.yml
vendored
@@ -8,7 +8,7 @@ env:
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 1 * * 0'
|
- cron: '0 0,2,4 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -29,7 +29,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.12'
|
python-version: '3.12'
|
||||||
- run: ./requirements.sh
|
- 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
|
- uses: ./.github/actions/gitPush
|
||||||
env:
|
env:
|
||||||
PUSH_FILES: auto/all-ru-*txt
|
PUSH_FILES: auto/all-ru-*txt
|
||||||
|
|||||||
2571
auto/all-ru-asn.txt
2571
auto/all-ru-asn.txt
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
import requests
|
import requests
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
@@ -42,11 +43,27 @@ def get_data(json, file, attr, field, prefix=""):
|
|||||||
print(f"{x} {name}")
|
print(f"{x} {name}")
|
||||||
f.write(str(x+" "+name) + '\n')
|
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 = requests.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
get_data(data, 'auto/all-ru-asn.txt', 'asn', 'as-name', "AS")
|
if args.asn or args.all:
|
||||||
get_data(data, 'auto/all-ru-ipv4.txt', 'ipv4', 'netname')
|
get_data(data, 'auto/all-ru-asn.txt', 'asn', 'as-name', "AS")
|
||||||
get_data(data, 'auto/all-ru-ipv6.txt', 'ipv6', 'netname')
|
|
||||||
|
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')
|
||||||
|
|||||||
Reference in New Issue
Block a user