Changeset View
Changeset View
Standalone View
Standalone View
contrib/seeds/makeseeds.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2013-2017 The Bitcoin Core developers | # Copyright (c) 2013-2017 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# | # | ||||
# Generate seeds.txt from Pieter's DNS seeder | # Generate seeds.txt from Pieter's DNS seeder | ||||
# | # | ||||
import collections | |||||
import dns.resolver | |||||
import sys | |||||
import re | |||||
NSEEDS = 512 | NSEEDS = 512 | ||||
MAX_SEEDS_PER_ASN = 2 | MAX_SEEDS_PER_ASN = 2 | ||||
MIN_BLOCKS = 540000 | MIN_BLOCKS = 540000 | ||||
# These are hosts that have been observed to be behaving strangely (e.g. | # These are hosts that have been observed to be behaving strangely (e.g. | ||||
# aggressively connecting to every node). | # aggressively connecting to every node). | ||||
SUSPICIOUS_HOSTS = { | SUSPICIOUS_HOSTS = { | ||||
"23.92.36.9", "72.36.89.11", "130.211.129.106", "178.63.107.226", | "23.92.36.9", "72.36.89.11", "130.211.129.106", "178.63.107.226", | ||||
"83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6", | "83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6", | ||||
"54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211", | "54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211", | ||||
"54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214", | "54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214", | ||||
"54.94.195.96", "54.94.200.247" | "54.94.195.96", "54.94.200.247" | ||||
} | } | ||||
import re | |||||
import sys | |||||
import dns.resolver | |||||
import collections | |||||
PATTERN_IPV4 = re.compile( | PATTERN_IPV4 = re.compile( | ||||
r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$") | r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$") | ||||
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$") | PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$") | ||||
PATTERN_ONION = re.compile( | PATTERN_ONION = re.compile( | ||||
r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$") | r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$") | ||||
# Used to only select nodes with a user agent string compatible with the | # Used to only select nodes with a user agent string compatible with the | ||||
# BCH/UAHF specification. | # BCH/UAHF specification. | ||||
PATTERN_AGENT = re.compile( | PATTERN_AGENT = re.compile( | ||||
r"^(/Bitcoin ABC:0.(17|18).(\d+)\(.+\)/|/bitprim:\"0.(13|14).(\d+)\"/|/Bitcoin XT:0.11.(\d+)[J-Z]\(.+\)/|/BUCash:1.(4|5).(\d+)\(.+\)/|/bcash:v1.(\d+).(\d+)-(\S+)/)") | r"^(/Bitcoin ABC:0.(18).(\d+)\(.+\)/|/bitprim:\"0.(14).(\d+)\"/|/Bitcoin XT:0.11.(\d+)[K-Z]\(.+\)/|/BUCash:1.(5).(\d+)\(.+\)/|/bcash:v1.(\d+).(\d+)-(\S+)/)") | ||||
def parseline(line): | def parseline(line): | ||||
sline = line.split() | sline = line.split() | ||||
if len(sline) < 11: | if len(sline) < 11: | ||||
return None | return None | ||||
# The user agent is at the end of the line. It may contain space, so we concatenate. | # The user agent is at the end of the line. It may contain space, so we concatenate. | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |