From 8c6fb5622de7fda3e039fd47a3f8e4f7607f6217 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 20 Jan 2020 20:24:27 +0100 Subject: [PATCH] Merge #17823: scripts: Read suspicious hosts from a file instead of hardcoding e1c582cbaa4c094d204da34c3b1fdd0d4c557519 contrib: makeseeds: Read suspicious hosts from a file instead of hardcoding (Sanjay K) Pull request description: referring to: https://github.com/bitcoin/bitcoin/issues/17020 good first issue: reading SUSPICIOUS_HOSTS from a file. I haven't changed the base hosts that were included in the original source, just made it readable from a file. ACKs for top commit: practicalswift: ACK e1c582cbaa4c094d204da34c3b1fdd0d4c557519 -- diff looks correct Tree-SHA512: 18684abc1c02cf52d63f6f6ecd98df01a9574a7c470524c37e152296504e2e3ffbabd6f3208214b62031512aeb809a6d37446af82c9f480ff14ce4c42c98e7c2 --- contrib/seeds/makeseeds.py | 5 +++-- contrib/seeds/suspicious_hosts.txt | 0 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 contrib/seeds/suspicious_hosts.txt diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py index 79a243ba52..e1aef34e85 100755 --- a/contrib/seeds/makeseeds.py +++ b/contrib/seeds/makeseeds.py @@ -19,8 +19,9 @@ MAX_SEEDS_PER_ASN=4 # These are hosts that have been observed to be behaving strangely (e.g. # aggressively connecting to every node). -SUSPICIOUS_HOSTS = { -} +with open("suspicious_hosts.txt", mode="r", encoding="utf-8") as f: + SUSPICIOUS_HOSTS = {s.strip() for s in f if s.strip()} + 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+)$") diff --git a/contrib/seeds/suspicious_hosts.txt b/contrib/seeds/suspicious_hosts.txt new file mode 100644 index 0000000000..e69de29bb2