aboutsummaryrefslogtreecommitdiff
path: root/contrib/seeds/makeseeds.py
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-02-22 15:04:46 +0100
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-02-22 15:04:46 +0100
commit9f27157894ee689736d0d0936d1af1620fd8f7d8 (patch)
tree3e62a9f888f03e00b66af930a4665de25fa5e8ef /contrib/seeds/makeseeds.py
parentc44e734dca64a15fae92255a5d848c04adaad2fa (diff)
downloadbitcoin-9f27157894ee689736d0d0936d1af1620fd8f7d8.tar.xz
contrib: make-seeds updates for 23.x
Documentation: - Use https URL for bitcoin.sipa.be (http sends a redirect, fooling curl). - Add explicit step to add manual seeds. Code: - Change PATTERN_ONION to v3 (effectively means that the no onion hosts are delivered). - Add versions to PATTERN_AGENT filter. - Print specific message on resolve exception.
Diffstat (limited to 'contrib/seeds/makeseeds.py')
-rwxr-xr-xcontrib/seeds/makeseeds.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py
index 9be6a690a6..2b377f6c01 100755
--- a/contrib/seeds/makeseeds.py
+++ b/contrib/seeds/makeseeds.py
@@ -25,7 +25,7 @@ with open("suspicious_hosts.txt", mode="r", encoding="utf-8") as f:
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
-PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
+PATTERN_ONION = re.compile(r"^([a-z2-7]{56}\.onion):(\d+)$")
PATTERN_AGENT = re.compile(
r"^/Satoshi:("
r"0.14.(0|1|2|3|99)|"
@@ -33,9 +33,11 @@ PATTERN_AGENT = re.compile(
r"0.16.(0|1|2|3|99)|"
r"0.17.(0|0.1|1|2|99)|"
r"0.18.(0|1|99)|"
- r"0.19.(0|1|99)|"
- r"0.20.(0|1|99)|"
- r"0.21.99"
+ r"0.19.(0|1|2|99)|"
+ r"0.20.(0|1|2|99)|"
+ r"0.21.(0|1|2|99)|"
+ r"22.(0|99)|"
+ r"23.99"
r")")
def parseline(line):
@@ -140,8 +142,8 @@ def lookup_asn(net, ip):
reversed(ipaddr.split('.'))) + prefix + '.asn.cymru.com',
'TXT').response.answer][0].split('\"')[1].split(' ')[0])
return asn
- except Exception:
- sys.stderr.write('ERR: Could not resolve ASN for "' + ip + '"\n')
+ except Exception as e:
+ sys.stderr.write(f'ERR: Could not resolve ASN for "{ip}": {e}\n')
return None
# Based on Greg Maxwell's seed_filter.py