mirror of
https://github.com/C24Be/AS_Network_List.git
synced 2026-01-26 07:45:07 +03:00
whois
This commit is contained in:
124
.github/workflows/update_ru_all_lists.yml
vendored
124
.github/workflows/update_ru_all_lists.yml
vendored
@@ -11,8 +11,8 @@ on:
|
|||||||
- cron: '0 0 1 * *'
|
- cron: '0 0 1 * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
get_asn:
|
get_lists:
|
||||||
name: 'Get/ASN'
|
name: 'Get/Lists'
|
||||||
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
@@ -25,58 +25,78 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
||||||
token: ${{ env.GH_PAT }}
|
token: ${{ env.GH_PAT }}
|
||||||
ref: ${{ github.branch }}
|
|
||||||
- uses: ./.github/actions/gitReset
|
|
||||||
- uses: ./.github/actions/pyInstall
|
- uses: ./.github/actions/pyInstall
|
||||||
- run: ./get_info_from_ripe.py --asn --limit 4000
|
- run: ./get_info_from_ripe.py
|
||||||
- uses: ./.github/actions/gitPush
|
- uses: ./.github/actions/gitPush
|
||||||
env:
|
env:
|
||||||
PUSH_FILES: auto/*txt
|
PUSH_FILES: auto/*txt
|
||||||
|
|
||||||
get_ipv4:
|
# get_asn:
|
||||||
name: 'Get/IPv4'
|
# name: 'Get/ASN'
|
||||||
|
#
|
||||||
runs-on: ubuntu-22.04
|
# runs-on: ubuntu-22.04
|
||||||
|
#
|
||||||
defaults:
|
# defaults:
|
||||||
run:
|
# run:
|
||||||
shell: bash
|
# shell: bash
|
||||||
|
#
|
||||||
needs: get_asn
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
steps:
|
# with:
|
||||||
- uses: actions/checkout@v4
|
# fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
||||||
with:
|
# token: ${{ env.GH_PAT }}
|
||||||
fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
# ref: ${{ github.branch }}
|
||||||
token: ${{ env.GH_PAT }}
|
# - uses: ./.github/actions/gitReset
|
||||||
ref: ${{ github.branch }}
|
# - uses: ./.github/actions/pyInstall
|
||||||
- uses: ./.github/actions/gitReset
|
# - run: ./get_info_from_ripe.py --asn --limit 4000
|
||||||
- uses: ./.github/actions/pyInstall
|
# - uses: ./.github/actions/gitPush
|
||||||
- run: ./get_info_from_ripe.py --ipv4 --limit 4000
|
# env:
|
||||||
- uses: ./.github/actions/gitPush
|
# PUSH_FILES: auto/*txt
|
||||||
env:
|
#
|
||||||
PUSH_FILES: auto/*txt
|
# get_ipv4:
|
||||||
|
# name: 'Get/IPv4'
|
||||||
get_ipv6:
|
#
|
||||||
name: 'Get/IPv6'
|
# runs-on: ubuntu-22.04
|
||||||
|
#
|
||||||
runs-on: ubuntu-22.04
|
# defaults:
|
||||||
|
# run:
|
||||||
defaults:
|
# shell: bash
|
||||||
run:
|
#
|
||||||
shell: bash
|
# needs: get_asn
|
||||||
|
#
|
||||||
needs: get_ipv4
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
steps:
|
# with:
|
||||||
- uses: actions/checkout@v4
|
# fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
||||||
with:
|
# token: ${{ env.GH_PAT }}
|
||||||
fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
# ref: ${{ github.branch }}
|
||||||
token: ${{ env.GH_PAT }}
|
# - uses: ./.github/actions/gitReset
|
||||||
ref: ${{ github.branch }}
|
# - uses: ./.github/actions/pyInstall
|
||||||
- uses: ./.github/actions/gitReset
|
# - run: ./get_info_from_ripe.py --ipv4 --limit 4000
|
||||||
- uses: ./.github/actions/pyInstall
|
# - uses: ./.github/actions/gitPush
|
||||||
- run: ./get_info_from_ripe.py --ipv6 --limit 4000
|
# env:
|
||||||
- uses: ./.github/actions/gitPush
|
# PUSH_FILES: auto/*txt
|
||||||
env:
|
#
|
||||||
PUSH_FILES: auto/*txt
|
# get_ipv6:
|
||||||
|
# name: 'Get/IPv6'
|
||||||
|
#
|
||||||
|
# runs-on: ubuntu-22.04
|
||||||
|
#
|
||||||
|
# defaults:
|
||||||
|
# run:
|
||||||
|
# shell: bash
|
||||||
|
#
|
||||||
|
# needs: get_ipv4
|
||||||
|
#
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# fetch-depth: 0 # this is required to fetch all history for all branches and tags
|
||||||
|
# token: ${{ env.GH_PAT }}
|
||||||
|
# ref: ${{ github.branch }}
|
||||||
|
# - uses: ./.github/actions/gitReset
|
||||||
|
# - uses: ./.github/actions/pyInstall
|
||||||
|
# - run: ./get_info_from_ripe.py --ipv6 --limit 4000
|
||||||
|
# - uses: ./.github/actions/gitPush
|
||||||
|
# env:
|
||||||
|
# PUSH_FILES: auto/*txt
|
||||||
|
|||||||
@@ -1,51 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
|
||||||
import requests
|
import requests
|
||||||
from pylib.whois import whois_query
|
from pylib.whois import whois_query
|
||||||
|
|
||||||
url = "https://stat.ripe.net/data/country-resource-list/data.json?resource=RU&v4_format=prefix"
|
url = "https://stat.ripe.net/data/country-resource-list/data.json?resource=RU&v4_format=prefix"
|
||||||
|
|
||||||
def get_data(json, file, attr, field, prefix=""):
|
def get_data(json, file, attr, field, prefix=""):
|
||||||
limit = args.limit
|
|
||||||
count = 0
|
|
||||||
with open(file, 'w') as f:
|
with open(file, 'w') as f:
|
||||||
for x in json['data']['resources'][attr]:
|
for x in json['data']['resources'][attr]:
|
||||||
count += 1
|
|
||||||
x = prefix+x.strip()
|
x = prefix+x.strip()
|
||||||
if count > limit:
|
name = "-no-description-"
|
||||||
response = None
|
|
||||||
else:
|
|
||||||
response = whois_query(x, field)
|
|
||||||
if response is None:
|
|
||||||
name = "-no-description-"
|
|
||||||
else:
|
|
||||||
name = response.split(':')[1].strip()
|
|
||||||
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')
|
|
||||||
parser.add_argument('--limit', type=int, help='Limit the number of whois queries to prevent blacklisting from whois servers', default=2500)
|
|
||||||
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()
|
||||||
|
|
||||||
if args.asn or args.all:
|
get_data(data, 'auto/all-ru-asn.txt', 'asn', 'as-name', "AS")
|
||||||
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.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