Compare commits
7 Commits
551e8db291
...
main
Author | SHA1 | Date | |
---|---|---|---|
77c82563f5 | |||
b0777f71c7 | |||
fb75901c49 | |||
266c8665fc | |||
1c41ce4816 | |||
7bb1b24128 | |||
4392043362 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
**/__pycache__/
|
__pycache__/
|
||||||
/unloading/
|
unloading/
|
||||||
|
414
download.py
Executable file
414
download.py
Executable file
@ -0,0 +1,414 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import net_tree
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# массив выгружаемых списков
|
||||||
|
ip_list = {
|
||||||
|
'RU': [
|
||||||
|
# Большая часть RU сегмента
|
||||||
|
{ 'url': ['https://stat.ripe.net/data/country-resource-list/data.json?resource=RU'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://ipv4.fetus.jp/ru.txt'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://github.com/ipverse/rir-ip/blob/master/country/ru/aggregated.json'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# HLL LLC
|
||||||
|
{ 'url': ['https://bgp.he.net/AS51115#_prefixes', 'https://ipinfo.io/widget/demo/AS51115?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS51115'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# STATIC
|
||||||
|
{ 'static4': '188.130.255.0/24', 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'MTS': [
|
||||||
|
# AS8359
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13055#_prefixes', 'https://ipinfo.io/widget/demo/AS13055?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13055'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13155#_prefixes', 'https://ipinfo.io/widget/demo/AS13155?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13155'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13174#_prefixes', 'https://ipinfo.io/widget/demo/AS13174?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13174'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS15640#_prefixes', 'https://ipinfo.io/widget/demo/AS15640?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS15640'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16012#_prefixes', 'https://ipinfo.io/widget/demo/AS16012?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16012'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16256#_prefixes', 'https://ipinfo.io/widget/demo/AS16256?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16256'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS197023#_prefixes', 'https://ipinfo.io/widget/demo/AS197023?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS197023'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS209024#_prefixes', 'https://ipinfo.io/widget/demo/AS209024?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS209024'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21103#_prefixes', 'https://ipinfo.io/widget/demo/AS21103?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21103'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21365#_prefixes', 'https://ipinfo.io/widget/demo/AS21365?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21365'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS28884#_prefixes', 'https://ipinfo.io/widget/demo/AS28884?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS28884'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS29190#_prefixes', 'https://ipinfo.io/widget/demo/AS29190?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS29190'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS29194#_prefixes', 'https://ipinfo.io/widget/demo/AS29194?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS29194'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS29209#_prefixes', 'https://ipinfo.io/widget/demo/AS29209?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS29209'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS29497#_prefixes', 'https://ipinfo.io/widget/demo/AS29497?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS29497'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS30881#_prefixes', 'https://ipinfo.io/widget/demo/AS30881?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS30881'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS30922#_prefixes', 'https://ipinfo.io/widget/demo/AS30922?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS30922'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31558#_prefixes', 'https://ipinfo.io/widget/demo/AS31558?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31558'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS33894#_prefixes', 'https://ipinfo.io/widget/demo/AS33894?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS33894'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34351#_prefixes', 'https://ipinfo.io/widget/demo/AS34351?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34351'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS35473#_prefixes', 'https://ipinfo.io/widget/demo/AS35473?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS35473'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS35728#_prefixes', 'https://ipinfo.io/widget/demo/AS35728?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS35728'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS39001#_prefixes', 'https://ipinfo.io/widget/demo/AS39001?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS39001'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS39811#_prefixes', 'https://ipinfo.io/widget/demo/AS39811?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS39811'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS39858#_prefixes', 'https://ipinfo.io/widget/demo/AS39858?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS39858'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS40993#_prefixes', 'https://ipinfo.io/widget/demo/AS40993?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS40993'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS41209#_prefixes', 'https://ipinfo.io/widget/demo/AS41209?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS41209'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS41822#_prefixes', 'https://ipinfo.io/widget/demo/AS41822?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS41822'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42087#_prefixes', 'https://ipinfo.io/widget/demo/AS42087?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42087'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42115#_prefixes', 'https://ipinfo.io/widget/demo/AS42115?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42115'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42322#_prefixes', 'https://ipinfo.io/widget/demo/AS42322?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42322'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43038#_prefixes', 'https://ipinfo.io/widget/demo/AS43038?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43038'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43148#_prefixes', 'https://ipinfo.io/widget/demo/AS43148?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43148'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS44257#_prefixes', 'https://ipinfo.io/widget/demo/AS44257?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS44257'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS44579#_prefixes', 'https://ipinfo.io/widget/demo/AS44579?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS44579'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS44677#_prefixes', 'https://ipinfo.io/widget/demo/AS44677?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS44677'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS44736#_prefixes', 'https://ipinfo.io/widget/demo/AS44736?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS44736'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS44895#_prefixes', 'https://ipinfo.io/widget/demo/AS44895?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS44895'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS47899#_prefixes', 'https://ipinfo.io/widget/demo/AS47899?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS47899'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48000#_prefixes', 'https://ipinfo.io/widget/demo/AS48000?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48000'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48123#_prefixes', 'https://ipinfo.io/widget/demo/AS48123?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48123'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48124#_prefixes', 'https://ipinfo.io/widget/demo/AS48124?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48124'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48212#_prefixes', 'https://ipinfo.io/widget/demo/AS48212?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48212'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48322#_prefixes', 'https://ipinfo.io/widget/demo/AS48322?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48322'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48400#_prefixes', 'https://ipinfo.io/widget/demo/AS48400?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48400'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48541#_prefixes', 'https://ipinfo.io/widget/demo/AS48541?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48541'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48612#_prefixes', 'https://ipinfo.io/widget/demo/AS48612?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48612'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48796#_prefixes', 'https://ipinfo.io/widget/demo/AS48796?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48796'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS49350#_prefixes', 'https://ipinfo.io/widget/demo/AS49350?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS49350'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS49665#_prefixes', 'https://ipinfo.io/widget/demo/AS49665?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS49665'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS49816#_prefixes', 'https://ipinfo.io/widget/demo/AS49816?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS49816'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS50071#_prefixes', 'https://ipinfo.io/widget/demo/AS50071?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS50071'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS50240#_prefixes', 'https://ipinfo.io/widget/demo/AS50240?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS50240'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS50406#_prefixes', 'https://ipinfo.io/widget/demo/AS50406?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS50406'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS60490#_prefixes', 'https://ipinfo.io/widget/demo/AS60490?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS60490'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS60891#_prefixes', 'https://ipinfo.io/widget/demo/AS60891?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS60891'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS6731#_prefixes', 'https://ipinfo.io/widget/demo/AS6731?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS6731'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8359#_prefixes', 'https://ipinfo.io/widget/demo/AS8359?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8359'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8580#_prefixes', 'https://ipinfo.io/widget/demo/AS8580?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8580'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'VIMPELCOM': [
|
||||||
|
# AS3216
|
||||||
|
{ 'url': ['https://bgp.he.net/AS12543#_prefixes', 'https://ipinfo.io/widget/demo/AS12543?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS12543'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13257#_prefixes', 'https://ipinfo.io/widget/demo/AS13257?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13257'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16043#_prefixes', 'https://ipinfo.io/widget/demo/AS16043?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16043'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16345#_prefixes', 'https://ipinfo.io/widget/demo/AS16345?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16345'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS20533#_prefixes', 'https://ipinfo.io/widget/demo/AS20533?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS20533'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS20597#_prefixes', 'https://ipinfo.io/widget/demo/AS20597?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS20597'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21332#_prefixes', 'https://ipinfo.io/widget/demo/AS21332?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21332'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21480#_prefixes', 'https://ipinfo.io/widget/demo/AS21480?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21480'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21483#_prefixes', 'https://ipinfo.io/widget/demo/AS21483?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21483'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS2599#_prefixes', 'https://ipinfo.io/widget/demo/AS2599?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS2599'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS2766#_prefixes', 'https://ipinfo.io/widget/demo/AS2766?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS2766'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS28703#_prefixes', 'https://ipinfo.io/widget/demo/AS28703?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS28703'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS29125#_prefixes', 'https://ipinfo.io/widget/demo/AS29125?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS29125'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31359#_prefixes', 'https://ipinfo.io/widget/demo/AS31359?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31359'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31425#_prefixes', 'https://ipinfo.io/widget/demo/AS31425?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31425'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS3216#_prefixes', 'https://ipinfo.io/widget/demo/AS3216?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS3216'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS3235#_prefixes', 'https://ipinfo.io/widget/demo/AS3235?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS3235'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS3253#_prefixes', 'https://ipinfo.io/widget/demo/AS3253?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS3253'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34038#_prefixes', 'https://ipinfo.io/widget/demo/AS34038?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34038'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34644#_prefixes', 'https://ipinfo.io/widget/demo/AS34644?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34644'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34747#_prefixes', 'https://ipinfo.io/widget/demo/AS34747?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34747'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34894#_prefixes', 'https://ipinfo.io/widget/demo/AS34894?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34894'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42110#_prefixes', 'https://ipinfo.io/widget/demo/AS42110?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42110'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42245#_prefixes', 'https://ipinfo.io/widget/demo/AS42245?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42245'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS42842#_prefixes', 'https://ipinfo.io/widget/demo/AS42842?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS42842'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43275#_prefixes', 'https://ipinfo.io/widget/demo/AS43275?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43275'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43687#_prefixes', 'https://ipinfo.io/widget/demo/AS43687?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43687'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43970#_prefixes', 'https://ipinfo.io/widget/demo/AS43970?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43970'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS49144#_prefixes', 'https://ipinfo.io/widget/demo/AS49144?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS49144'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8350#_prefixes', 'https://ipinfo.io/widget/demo/AS8350?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8350'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8371#_prefixes', 'https://ipinfo.io/widget/demo/AS8371?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8371'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8402#_prefixes', 'https://ipinfo.io/widget/demo/AS8402?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8402'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8755#_prefixes', 'https://ipinfo.io/widget/demo/AS8755?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8755'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8773#_prefixes', 'https://ipinfo.io/widget/demo/AS8773?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8773'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'CHINA': [
|
||||||
|
# Большая часть CH сегмента
|
||||||
|
{ 'url': ['https://stat.ripe.net/data/country-resource-list/data.json?resource=CN'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://ipv4.fetus.jp/cn.txt'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://github.com/ipverse/rir-ip/blob/master/country/cn/aggregated.json'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Hong Kong
|
||||||
|
{ 'url': ['https://stat.ripe.net/data/country-resource-list/data.json?resource=HK'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://ipv4.fetus.jp/hk.txt'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://github.com/ipverse/rir-ip/blob/master/country/hk/aggregated.json'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Alibaba (US) Technology Co., Ltd.
|
||||||
|
{ 'url': ['https://bgp.he.net/AS45102#_prefixes', 'https://ipinfo.io/widget/demo/AS45102?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS45102'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'JAPAN': [
|
||||||
|
# Большая часть KR сегмента
|
||||||
|
{ 'url': ['https://stat.ripe.net/data/country-resource-list/data.json?resource=JP'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://ipv4.fetus.jp/jp.txt'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://github.com/ipverse/rir-ip/blob/master/country/jp/aggregated.json'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'KOREA': [
|
||||||
|
# Большая часть KR сегмента
|
||||||
|
{ 'url': ['https://stat.ripe.net/data/country-resource-list/data.json?resource=KR'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://ipv4.fetus.jp/kr.txt'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://github.com/ipverse/rir-ip/blob/master/country/kr/aggregated.json'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# LG DACOM Corporation
|
||||||
|
{ 'url': ['https://bgp.he.net/AS3786#_prefixes', 'https://ipinfo.io/widget/demo/AS3786?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS3786'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'GOOGLE': [
|
||||||
|
# Google LLC
|
||||||
|
{ 'url': ['https://bgp.he.net/AS11344#_prefixes', 'https://ipinfo.io/widget/demo/AS11344?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS11344'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13949#_prefixes', 'https://ipinfo.io/widget/demo/AS13949?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13949'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS15169#_prefixes', 'https://ipinfo.io/widget/demo/AS15169?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS15169'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS15276#_prefixes', 'https://ipinfo.io/widget/demo/AS15276?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS15276'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS19425#_prefixes', 'https://ipinfo.io/widget/demo/AS19425?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS19425'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS22577#_prefixes', 'https://ipinfo.io/widget/demo/AS22577?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS22577'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS26910#_prefixes', 'https://ipinfo.io/widget/demo/AS26910?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS26910'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36040#_prefixes', 'https://ipinfo.io/widget/demo/AS36040?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36040'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36492#_prefixes', 'https://ipinfo.io/widget/demo/AS36492?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36492'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36561#_prefixes', 'https://ipinfo.io/widget/demo/AS36561?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36561'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS394725#_prefixes', 'https://ipinfo.io/widget/demo/AS394725?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS394725'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS40873#_prefixes', 'https://ipinfo.io/widget/demo/AS40873?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS40873'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43515#_prefixes', 'https://ipinfo.io/widget/demo/AS43515?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43515'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS55023#_prefixes', 'https://ipinfo.io/widget/demo/AS55023?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS55023'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS6432#_prefixes', 'https://ipinfo.io/widget/demo/AS6432?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS6432'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS19527#_prefixes', 'https://ipinfo.io/widget/demo/AS19527?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS19527'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS26684#_prefixes', 'https://ipinfo.io/widget/demo/AS26684?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS26684'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS395973#_prefixes', 'https://ipinfo.io/widget/demo/AS395973?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS395973'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36039#_prefixes', 'https://ipinfo.io/widget/demo/AS36039?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36039'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS24424#_prefixes', 'https://ipinfo.io/widget/demo/AS24424?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS24424'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS396982#_prefixes', 'https://ipinfo.io/widget/demo/AS396982?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS396982'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS139070#_prefixes', 'https://ipinfo.io/widget/demo/AS139070?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS139070'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS139190#_prefixes', 'https://ipinfo.io/widget/demo/AS139190?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS139190'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS394699#_prefixes', 'https://ipinfo.io/widget/demo/AS394699?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS394699'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS32381#_prefixes', 'https://ipinfo.io/widget/demo/AS32381?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS32381'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36383#_prefixes', 'https://ipinfo.io/widget/demo/AS36383?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36383'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36411#_prefixes', 'https://ipinfo.io/widget/demo/AS36411?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36411'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36520#_prefixes', 'https://ipinfo.io/widget/demo/AS36520?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36520'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS394089#_prefixes', 'https://ipinfo.io/widget/demo/AS394089?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS394089'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Google IT
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36384#_prefixes', 'https://ipinfo.io/widget/demo/AS36384?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36384'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36385#_prefixes', 'https://ipinfo.io/widget/demo/AS36385?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36385'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS41264#_prefixes', 'https://ipinfo.io/widget/demo/AS41264?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS41264'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS45566#_prefixes', 'https://ipinfo.io/widget/demo/AS45566?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS45566'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Skyonline Technosystem Private Limited
|
||||||
|
{ 'url': ['https://bgp.he.net/AS137154#_prefixes', 'https://ipinfo.io/widget/demo/AS137154?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS137154'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Ramyaa Network Communication
|
||||||
|
{ 'url': ['https://bgp.he.net/AS138756#_prefixes', 'https://ipinfo.io/widget/demo/AS138756?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS138756'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Haash Media
|
||||||
|
{ 'url': ['https://bgp.he.net/AS141480#_prefixes', 'https://ipinfo.io/widget/demo/AS141480?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS141480'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# FAB FIVE NETWORK PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151690#_prefixes', 'https://ipinfo.io/widget/demo/AS151690?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151690'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# AMITEL INDIA PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151691#_prefixes', 'https://ipinfo.io/widget/demo/AS151691?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151691'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# SMALL INDUSTRIES DEVELOPMENT BANK OF INDIA
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151692#_prefixes', 'https://ipinfo.io/widget/demo/AS151692?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151692'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# WIRED2COMMUNICATION PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151693#_prefixes', 'https://ipinfo.io/widget/demo/AS151693?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151693'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# SWS NETWORK PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151694#_prefixes', 'https://ipinfo.io/widget/demo/AS151694?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151694'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# KARNET COMMUNICATIONS LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151695#_prefixes', 'https://ipinfo.io/widget/demo/AS151695?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151695'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# GREEN WEB SOFTWARE DEVELOPMENT PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151698#_prefixes', 'https://ipinfo.io/widget/demo/AS151698?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151698'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# FASTTECH NET PRIVATE LIMITED
|
||||||
|
{ 'url': ['https://bgp.he.net/AS151699#_prefixes', 'https://ipinfo.io/widget/demo/AS151699?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS151699'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# Digivision Entertainment Private Limited
|
||||||
|
{ 'url': ['https://bgp.he.net/AS45148#_prefixes', 'https://ipinfo.io/widget/demo/AS45148?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS45148'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# MTS, TTK, Megafon
|
||||||
|
{ 'static4': '212.188.0.0/17,188.43.0.0/16,178.176.0.0/14', 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'RKN': [
|
||||||
|
{ 'url': ['https://reestr.rublacklist.net/api/v3/ips/', 'https://antifilter.network/download/ip.lst'], 'ipv4': 32, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'MSFT': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS8075#_prefixes', 'https://ipinfo.io/widget/demo/AS8075?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS8075'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'VALVE': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS32590#_prefixes', 'https://ipinfo.io/widget/demo/AS32590?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS32590'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'AMAZONE': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16509#_prefixes', 'https://ipinfo.io/widget/demo/AS16509?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16509'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'DISCORD': [
|
||||||
|
# i3D.net
|
||||||
|
{ 'url': ['https://bgp.he.net/AS49544#_prefixes', 'https://ipinfo.io/widget/demo/AS49544?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS49544'], 'ipv4': True, 'ipv6': False },
|
||||||
|
# STATIC
|
||||||
|
{ 'static4': '23.227.0.0/16,104.17.0.0/16,104.18.0.0/16,104.21.0.0/16,142.250.0.0/16,162.159.0.0/16,172.217.0.0/16,172.67.0.0/16,204.11.0.0/16,216.58.0.0/16', 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'CLOUDFLARE': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS13335#_prefixes', 'https://ipinfo.io/widget/demo/AS13335?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS13335'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS14789#_prefixes', 'https://ipinfo.io/widget/demo/AS14789?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS14789'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS132892#_prefixes', 'https://ipinfo.io/widget/demo/AS132892?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS132892'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS133877#_prefixes', 'https://ipinfo.io/widget/demo/AS133877?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS133877'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS202623#_prefixes', 'https://ipinfo.io/widget/demo/AS202623?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS202623'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS209242#_prefixes', 'https://ipinfo.io/widget/demo/AS209242?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS209242'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS394536#_prefixes', 'https://ipinfo.io/widget/demo/AS394536?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS394536'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'AKAMAI': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS12222#_prefixes', 'https://ipinfo.io/widget/demo/AS12222?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS12222'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16702#_prefixes', 'https://ipinfo.io/widget/demo/AS16702?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16702'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS20940#_prefixes', 'https://ipinfo.io/widget/demo/AS20940?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS20940'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21342#_prefixes', 'https://ipinfo.io/widget/demo/AS21342?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21342'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31107#_prefixes', 'https://ipinfo.io/widget/demo/AS31107?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31107'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31108#_prefixes', 'https://ipinfo.io/widget/demo/AS31108?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31108'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31109#_prefixes', 'https://ipinfo.io/widget/demo/AS31109?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31109'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31110#_prefixes', 'https://ipinfo.io/widget/demo/AS31110?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31110'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31377#_prefixes', 'https://ipinfo.io/widget/demo/AS31377?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31377'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS35993#_prefixes', 'https://ipinfo.io/widget/demo/AS35993?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS35993'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS39836#_prefixes', 'https://ipinfo.io/widget/demo/AS39836?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS39836'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21357#_prefixes', 'https://ipinfo.io/widget/demo/AS21357?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21357'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS21399#_prefixes', 'https://ipinfo.io/widget/demo/AS21399?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS21399'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS23903#_prefixes', 'https://ipinfo.io/widget/demo/AS23903?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS23903'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS24319#_prefixes', 'https://ipinfo.io/widget/demo/AS24319?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS24319'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS33905#_prefixes', 'https://ipinfo.io/widget/demo/AS33905?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS33905'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34164#_prefixes', 'https://ipinfo.io/widget/demo/AS34164?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34164'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS34850#_prefixes', 'https://ipinfo.io/widget/demo/AS34850?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS34850'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS35204#_prefixes', 'https://ipinfo.io/widget/demo/AS35204?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS35204'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS18680#_prefixes', 'https://ipinfo.io/widget/demo/AS18680?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS18680'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS18717#_prefixes', 'https://ipinfo.io/widget/demo/AS18717?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS18717'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS20189#_prefixes', 'https://ipinfo.io/widget/demo/AS20189?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS20189'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS35994#_prefixes', 'https://ipinfo.io/widget/demo/AS35994?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS35994'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS23454#_prefixes', 'https://ipinfo.io/widget/demo/AS23454?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS23454'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS22207#_prefixes', 'https://ipinfo.io/widget/demo/AS22207?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS22207'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS23455#_prefixes', 'https://ipinfo.io/widget/demo/AS23455?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS23455'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS43639#_prefixes', 'https://ipinfo.io/widget/demo/AS43639?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS43639'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS16625#_prefixes', 'https://ipinfo.io/widget/demo/AS16625?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS16625'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS36183#_prefixes', 'https://ipinfo.io/widget/demo/AS36183?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS36183'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS31984#_prefixes', 'https://ipinfo.io/widget/demo/AS31984?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS31984'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS200005#_prefixes', 'https://ipinfo.io/widget/demo/AS200005?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS200005'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS393560#_prefixes', 'https://ipinfo.io/widget/demo/AS393560?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS3935605'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS32787#_prefixes', 'https://ipinfo.io/widget/demo/AS32787?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS32787'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS63949#_prefixes', 'https://ipinfo.io/widget/demo/AS63949?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS63949'], 'ipv4': True, 'ipv6': False },
|
||||||
|
{ 'url': ['https://bgp.he.net/AS48337#_prefixes', 'https://ipinfo.io/widget/demo/AS48337?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS48337'], 'ipv4': True, 'ipv6': False },
|
||||||
|
],
|
||||||
|
'IQWEB': [
|
||||||
|
{ 'url': ['https://bgp.he.net/AS59692#_prefixes', 'https://ipinfo.io/widget/demo/AS59692?dataset=asn', 'https://api.hackertarget.com/aslookup/?q=AS59692'], 'ipv4': True, 'ipv6': False },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# компилируем регулярку поиска ipv4 адреса
|
||||||
|
ipv4_find_str=re.compile(r"[^0-9.]?(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]|[1-9])\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]|[0-9])\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]|[0-9])\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]|[0-9])(/([0-9]{1}[0-9]*))?[^0-9.]?")
|
||||||
|
|
||||||
|
# метод сбора словаря ip адресов ipv4 из текста
|
||||||
|
def ipv4_find(strip:str, size:int):
|
||||||
|
"""
|
||||||
|
Метод сбора словаря ip адресов ipv4 из текста
|
||||||
|
возвращает словарь ip
|
||||||
|
где:
|
||||||
|
ключ - имя сети
|
||||||
|
значение - [адрес в int формате, размер сети]
|
||||||
|
"""
|
||||||
|
listip=dict()
|
||||||
|
for c in ipv4_find_str.finditer(strip):
|
||||||
|
ip:int=0
|
||||||
|
key:str=""
|
||||||
|
# 4 элемента кортежа, содержащие актеты адреса
|
||||||
|
for i in range(1, 5):
|
||||||
|
key+=str(c.group(i))+"."
|
||||||
|
ip = ip * 256 + int(c.group(i))
|
||||||
|
# элемент кортежа, содержащий размер сети
|
||||||
|
if c.group(6) and int(c.group(6))<=size:
|
||||||
|
listip[key[:-1]+"/"+str(c.group(6))]=[ip,int(c.group(6))]
|
||||||
|
# элемент кортежа, с размером сети, отсутствует
|
||||||
|
elif size==32:
|
||||||
|
listip[f"{key[:-1]}/32"]=[ip,32]
|
||||||
|
return listip
|
||||||
|
|
||||||
|
# метод сбора словаря ip адресов ipv4 из текста
|
||||||
|
def ipv6_find(strip:str, size:int):
|
||||||
|
"""
|
||||||
|
Метод сбора словаря ip адресов ipv4 из текста
|
||||||
|
возвращает словарь ip
|
||||||
|
где:
|
||||||
|
ключ - имя сети
|
||||||
|
значение - [адрес в int формате, размер сети]
|
||||||
|
"""
|
||||||
|
return dict()
|
||||||
|
|
||||||
|
# метод получения списка ip адресов
|
||||||
|
def list_ip(c_dict: dict = []):
|
||||||
|
"""
|
||||||
|
Метод получения списка ip адресов
|
||||||
|
возвращает кортеж из 2-х списков: ipv4 и ipv6
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
ipv4_list=dict()
|
||||||
|
ipv6_list=dict()
|
||||||
|
# пробегаем словарь выгрузки
|
||||||
|
for c_list in c_dict:
|
||||||
|
# какие типы обрабытываем, от какого размера
|
||||||
|
ipv4 = False if 'ipv4' not in list(c_list) or not c_list['ipv4'] else (c_list['ipv4'] if type(c_list['ipv4']) is int else 24)
|
||||||
|
ipv6 = False if 'ipv6' not in list(c_list) or not c_list['ipv6'] else (c_list['ipv6'] if type(c_list['ipv6']) is int else 32)
|
||||||
|
# если есть источник ссылка
|
||||||
|
if 'url' in list(c_list):
|
||||||
|
# бежим весь список ссылок пока не код 200
|
||||||
|
for c_url in c_list['url']:
|
||||||
|
if (result:=requests.get(c_url)) and result.status_code == 200 and result.text:
|
||||||
|
print(f"URL: {c_url}")
|
||||||
|
# пополняем словарь ipv4_list
|
||||||
|
if ipv4: ipv4_list.update(ipv4_find(result.text,ipv4))
|
||||||
|
# пополняем словарь ipv6_list
|
||||||
|
if ipv6: ipv6_list.update(ipv6_find(result.text,ipv6))
|
||||||
|
break
|
||||||
|
print("Ошибка соединения")
|
||||||
|
# если есть статичные записи ipv4
|
||||||
|
if ipv4 and 'static4' in list(c_list):
|
||||||
|
print(f"STATIC: IPv4")
|
||||||
|
# пополняем словарь ipv4_list
|
||||||
|
ipv4_list.update(ipv4_find(str(c_list['static4']),ipv4))
|
||||||
|
# если есть статичные записи ipv6
|
||||||
|
if ipv6 and 'static6' in list(c_list):
|
||||||
|
print(f"STATIC: IPv6")
|
||||||
|
# пополняем словарь ipv6_list
|
||||||
|
ipv6_list.update(ipv6_find(str(c_list['static6']),ipv6))
|
||||||
|
|
||||||
|
# сжимаем подсети ipv4
|
||||||
|
if ipv4_list:
|
||||||
|
# строим дерево
|
||||||
|
Root = net_tree.Node(net_tree.Net(0,0), 0)
|
||||||
|
# пробегаем в цикле
|
||||||
|
for c in ipv4_list.values():
|
||||||
|
# добавляем запись в дерево
|
||||||
|
Root.addSubnet(net_tree.Node(net_tree.Net(c[0], c[1]), 1))
|
||||||
|
Root.finishTreeFirst()
|
||||||
|
# жесткое сжатие в размер 30000 записей
|
||||||
|
#Root.collapseRoot(Root.real_ip_records_count - 30000)
|
||||||
|
# более мягкое сжатие
|
||||||
|
Root.collapse(1,Root.real_ip_records_count)
|
||||||
|
# возвращаем результат
|
||||||
|
ipv4_list:str=Root.returnCollapsedTree('route {addr}/{masklen} blackhole;')
|
||||||
|
else:
|
||||||
|
ipv4_list:bool=False
|
||||||
|
|
||||||
|
# сжимаем подсети ipv6
|
||||||
|
if ipv6_list:
|
||||||
|
None
|
||||||
|
else:
|
||||||
|
ipv6_list:bool=False
|
||||||
|
|
||||||
|
# возвращаем 2 списка маршрутов
|
||||||
|
return ipv4_list, ipv6_list
|
||||||
|
except Exception as e:
|
||||||
|
# исключение
|
||||||
|
print(f"Ошибка: {e}")
|
||||||
|
return False, False
|
||||||
|
|
||||||
|
# главная фукция
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# создаем дерриктори. для сохранения
|
||||||
|
outdir=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'unloading')
|
||||||
|
if not os.path.exists(outdir):
|
||||||
|
os.makedirs(outdir,exist_ok=True)
|
||||||
|
# обходим массив списков для выкрузки
|
||||||
|
for clist in ip_list:
|
||||||
|
# имена выходых файлов
|
||||||
|
ipv4_out_file=f"{outdir}/{clist.lower()}_v4.txt"
|
||||||
|
ipv6_out_file=f"{outdir}/{clist.lower()}_v6.txt"
|
||||||
|
# вычисляем кол-во записей прошлой выгрузки
|
||||||
|
ipv4_count_old = sum(1 for line in open(ipv4_out_file)) if os.path.isfile(ipv4_out_file) else 0
|
||||||
|
ipv6_count_old = sum(1 for line in open(ipv6_out_file)) if os.path.isfile(ipv6_out_file) else 0
|
||||||
|
# выполняем выгрузку
|
||||||
|
print(f"Выгружаю список IP: {clist}")
|
||||||
|
ipv4_list, ipv6_list=list_ip(ip_list[clist])
|
||||||
|
# сохраняем ipv4
|
||||||
|
if ipv4_list and len(ipv4_list.splitlines()) >= ipv4_count_old * 0.7:
|
||||||
|
# сохраняем в файл
|
||||||
|
with open(ipv4_out_file, "w") as file:
|
||||||
|
file.write(ipv4_list)
|
||||||
|
print(f"Файл {ipv4_out_file} сохранён")
|
||||||
|
# сохраняем ipv6
|
||||||
|
if ipv6_list and len(ipv6_list.splitlines()) >= ipv6_count_old * 0.7:
|
||||||
|
# сохраняем в файл
|
||||||
|
with open(ipv6_out_file, "w") as file:
|
||||||
|
file.write(ipv6_list)
|
||||||
|
print(f"Файл {ipv6_out_file} сохранён")
|
||||||
|
print("")
|
213
net_tree.py
Normal file
213
net_tree.py
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
|
||||||
|
BIG_MASK = (1 << 32) - 1
|
||||||
|
|
||||||
|
def getMaskByMaskSize(mask_size):
|
||||||
|
return BIG_MASK ^ ((1 << (32 - mask_size)) - 1)
|
||||||
|
|
||||||
|
def getIpVolumeByMaskSize(mask_size):
|
||||||
|
return 1 << (32 - mask_size)
|
||||||
|
|
||||||
|
class Net:
|
||||||
|
__slots__ = ['mask_size', 'net', 'mask', 'ip_volume']
|
||||||
|
|
||||||
|
def __init__(self, net: int, mask_size: int):
|
||||||
|
self.mask_size = mask_size
|
||||||
|
self.net = net & getMaskByMaskSize(mask_size)
|
||||||
|
self.mask = getMaskByMaskSize(self.mask_size)
|
||||||
|
self.ip_volume = getIpVolumeByMaskSize(mask_size)
|
||||||
|
|
||||||
|
def hasSubnet(self, Net: 'Net'):
|
||||||
|
if Net.mask_size <= self.mask_size: return 0
|
||||||
|
return self.net == Net.net & self.mask
|
||||||
|
|
||||||
|
def isSameNet(self, Net: 'Net'):
|
||||||
|
return (Net.mask_size == self.mask_size) and (Net.net == self.net)
|
||||||
|
|
||||||
|
def getCommonNet(self, OtherNet: 'Net', min_mask_size: int):
|
||||||
|
if self.mask_size <= min_mask_size: return 0
|
||||||
|
if OtherNet.mask_size <= min_mask_size: return 0
|
||||||
|
for mask_size in range(min(self.mask_size, OtherNet.mask_size) - 1, min_mask_size - 1, -1):
|
||||||
|
mask = getMaskByMaskSize(mask_size)
|
||||||
|
if (self.net & mask) == (OtherNet.net & mask):
|
||||||
|
return Net(self.net, mask_size)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def getAsString(self, fmt='{addr}/{masklen}'):
|
||||||
|
net = self.net
|
||||||
|
mask = self.mask
|
||||||
|
addrbytes = []
|
||||||
|
maskbytes = []
|
||||||
|
for i in range(4):
|
||||||
|
addrbytes.append(str(net % 256))
|
||||||
|
maskbytes.append(str(mask % 256))
|
||||||
|
net = net >> 8
|
||||||
|
mask = mask >> 8
|
||||||
|
return fmt.format(addr='.'.join(reversed(addrbytes)), mask='.'.join(reversed(maskbytes)), masklen=self.mask_size)
|
||||||
|
|
||||||
|
class Node:
|
||||||
|
__slots__ = ['net', 'child1', 'child2', 'is_real_net', 'real_ip_volume', 'real_ip_records_count', 'weight', 'max_child_weight', 'added_fake_ip_volume']
|
||||||
|
|
||||||
|
def __init__(self, net: Net, is_real_net: int):
|
||||||
|
self.net = net
|
||||||
|
self.child1 = None
|
||||||
|
self.child2 = None
|
||||||
|
self.is_real_net = is_real_net
|
||||||
|
self.real_ip_volume = 0
|
||||||
|
self.real_ip_records_count = 0
|
||||||
|
self.weight = 0.0
|
||||||
|
self.max_child_weight = 0.0
|
||||||
|
self.added_fake_ip_volume = 0
|
||||||
|
|
||||||
|
def getNet(self):
|
||||||
|
return self.net
|
||||||
|
|
||||||
|
def addSubnet(self, NewNode: 'Node'):
|
||||||
|
if self.net.isSameNet(NewNode.net):
|
||||||
|
if not self.is_real_net and NewNode.is_real_net:
|
||||||
|
self.is_real_net = 1
|
||||||
|
self.child1 = None
|
||||||
|
self.child2 = None
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if self.is_real_net and self.net.hasSubnet(NewNode.net):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if not self.net.hasSubnet(NewNode.net):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child and Child.addSubnet(NewNode):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if self.child1:
|
||||||
|
CommonNet = self.child1.net.getCommonNet(NewNode.net, self.net.mask_size + 1)
|
||||||
|
if CommonNet:
|
||||||
|
CommonNode = Node(CommonNet, 0)
|
||||||
|
CommonNode.addSubnet(NewNode)
|
||||||
|
CommonNode.addSubnet(self.child1)
|
||||||
|
self.child1 = CommonNode
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if self.child2:
|
||||||
|
CommonNet = self.child2.net.getCommonNet(NewNode.net, self.net.mask_size + 1)
|
||||||
|
if CommonNet:
|
||||||
|
CommonNode = Node(CommonNet, 0)
|
||||||
|
CommonNode.addSubnet(NewNode)
|
||||||
|
CommonNode.addSubnet(self.child2)
|
||||||
|
self.child2 = CommonNode
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if not self.child1:
|
||||||
|
self.child1 = NewNode
|
||||||
|
else:
|
||||||
|
self.child2 = NewNode
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def printTree(self, level):
|
||||||
|
prefix = ''
|
||||||
|
for i in range(level):
|
||||||
|
prefix = prefix + ' '
|
||||||
|
|
||||||
|
if self.is_real_net: sign = '*'
|
||||||
|
elif self.weight == 0: sign = '.'
|
||||||
|
else: sign = ''
|
||||||
|
|
||||||
|
print(prefix + self.net.getAsString() + ' ' + str(self.real_ip_records_count))
|
||||||
|
|
||||||
|
if self.child1:
|
||||||
|
self.child1.printTree(level + 1)
|
||||||
|
if self.child2:
|
||||||
|
self.child2.printTree(level + 1)
|
||||||
|
|
||||||
|
def finishTreeFirst(self):
|
||||||
|
if self.is_real_net:
|
||||||
|
self.real_ip_volume = self.net.ip_volume
|
||||||
|
self.real_ip_records_count = 1
|
||||||
|
self.weight = 0
|
||||||
|
self.max_child_weight = 0
|
||||||
|
else:
|
||||||
|
self.real_ip_volume = 0
|
||||||
|
self.real_ip_records_count = 0
|
||||||
|
self.max_child_weight = 0
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child:
|
||||||
|
Child.finishTreeFirst()
|
||||||
|
self.real_ip_volume += Child.real_ip_volume
|
||||||
|
self.real_ip_records_count += Child.real_ip_records_count
|
||||||
|
self.max_child_weight = max(self.max_child_weight, Child.weight, Child.max_child_weight)
|
||||||
|
self.recalcWeight()
|
||||||
|
|
||||||
|
def collapse(self, min_weight, max_net_delta):
|
||||||
|
# trying to collapse self
|
||||||
|
if self.weight >= min_weight:
|
||||||
|
self.weight = 0
|
||||||
|
self.max_child_weight = 0
|
||||||
|
delta = (self.net.ip_volume - self.real_ip_volume) - self.added_fake_ip_volume
|
||||||
|
self.added_fake_ip_volume = self.net.ip_volume - self.real_ip_volume
|
||||||
|
return self.real_ip_records_count - 1, delta
|
||||||
|
|
||||||
|
net_delta = 0
|
||||||
|
fake_ip_delta = 0
|
||||||
|
self.max_child_weight = 0
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child:
|
||||||
|
if net_delta < max_net_delta and min_weight <= max(Child.weight, Child.max_child_weight):
|
||||||
|
child_net_delta, child_fake_ip_count = Child.collapse(min_weight, max_net_delta - net_delta)
|
||||||
|
net_delta += child_net_delta
|
||||||
|
fake_ip_delta += child_fake_ip_count
|
||||||
|
self.max_child_weight = max(self.max_child_weight, Child.weight, Child.max_child_weight)
|
||||||
|
|
||||||
|
if net_delta > 0:
|
||||||
|
self.added_fake_ip_volume += fake_ip_delta
|
||||||
|
self.real_ip_records_count -= net_delta
|
||||||
|
self.recalcWeight()
|
||||||
|
|
||||||
|
# trying to collapse self
|
||||||
|
if self.weight >= min_weight:
|
||||||
|
self.weight = 0
|
||||||
|
self.max_child_weight = 0
|
||||||
|
delta = (self.net.ip_volume - self.real_ip_volume) - (self.added_fake_ip_volume - fake_ip_delta)
|
||||||
|
self.added_fake_ip_volume = self.net.ip_volume - self.real_ip_volume
|
||||||
|
return self.real_ip_records_count - 1, delta
|
||||||
|
else:
|
||||||
|
return net_delta, fake_ip_delta
|
||||||
|
|
||||||
|
def collapseRoot(self, required_net_delta):
|
||||||
|
while required_net_delta > 0:
|
||||||
|
delta, fake_ip_volume = self.collapse(self.max_child_weight, required_net_delta)
|
||||||
|
required_net_delta -= delta
|
||||||
|
|
||||||
|
def printCollapsedTree(self, fmt='{addr}/{masklen}'):
|
||||||
|
if self.is_real_net or self.weight == 0:
|
||||||
|
print(self.net.getAsString(fmt))
|
||||||
|
else:
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child:
|
||||||
|
Child.printCollapsedTree(fmt)
|
||||||
|
|
||||||
|
def returnCollapsedTree(self, fmt='{addr}/{masklen}'):
|
||||||
|
if self.is_real_net or self.weight == 0:
|
||||||
|
return self.net.getAsString(fmt) + "\n"
|
||||||
|
else:
|
||||||
|
res = ""
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child:
|
||||||
|
res += Child.returnCollapsedTree(fmt)
|
||||||
|
return res
|
||||||
|
|
||||||
|
def recalcWeight(self):
|
||||||
|
fake_ip_delta = self.net.ip_volume - self.real_ip_volume - self.added_fake_ip_volume
|
||||||
|
if fake_ip_delta:
|
||||||
|
self.weight = (self.real_ip_records_count - 1) / fake_ip_delta
|
||||||
|
else:
|
||||||
|
self.weight = float('Inf')
|
||||||
|
|
||||||
|
def getNotRealIpCount(self):
|
||||||
|
if self.is_real_net: return 0
|
||||||
|
if self.weight == 0: return self.net.ip_volume - self.real_ip_volume
|
||||||
|
res = 0
|
||||||
|
for Child in (self.child1, self.child2):
|
||||||
|
if Child:
|
||||||
|
res = res + Child.getNotRealIpCount()
|
||||||
|
return res
|
Reference in New Issue
Block a user