|
1 |
| -#!/usr/bin/env python |
2 |
| -# Copyright (c) 2013-2016 The Bitcoin Core developers |
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Copyright (c) 2013-2017 The Bitcoin Core developers |
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 | #
|
|
14 | 14 |
|
15 | 15 | # These are hosts that have been observed to be behaving strangely (e.g.
|
16 | 16 | # aggressively connecting to every node).
|
17 |
| -SUSPICIOUS_HOSTS = set([ |
| 17 | +SUSPICIOUS_HOSTS = { |
18 | 18 | "130.211.129.106", "178.63.107.226",
|
19 | 19 | "83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6",
|
20 | 20 | "54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211",
|
21 | 21 | "54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214",
|
22 | 22 | "54.94.195.96", "54.94.200.247"
|
23 |
| -]) |
| 23 | +} |
24 | 24 |
|
25 | 25 | import re
|
26 | 26 | import sys
|
|
30 | 30 | PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
|
31 | 31 | PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
|
32 | 32 | PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
|
33 |
| -PATTERN_AGENT = re.compile(r"^(\/Satoshi:0\.8\.6\/|\/Satoshi:0\.9\.(2|3|4|5)\/|\/Satoshi:0\.10\.\d{1,2}\/|\/Satoshi:0\.11\.\d{1,2}\/)$") |
| 33 | +PATTERN_AGENT = re.compile(r"^(/Satoshi:0.12.(0|1|99)/|/Satoshi:0.13.(0|1|2|99)/)$") |
34 | 34 |
|
35 | 35 | def parseline(line):
|
36 | 36 | sline = line.split()
|
@@ -104,7 +104,7 @@ def filtermultiport(ips):
|
104 | 104 | hist = collections.defaultdict(list)
|
105 | 105 | for ip in ips:
|
106 | 106 | hist[ip['sortkey']].append(ip)
|
107 |
| - return [value[0] for (key,value) in hist.items() if len(value)==1] |
| 107 | + return [value[0] for (key,value) in list(hist.items()) if len(value)==1] |
108 | 108 |
|
109 | 109 | # Based on Greg Maxwell's seed_filter.py
|
110 | 110 | def filterbyasn(ips, max_per_asn, max_total):
|
@@ -164,9 +164,9 @@ def main():
|
164 | 164 |
|
165 | 165 | for ip in ips:
|
166 | 166 | if ip['net'] == 'ipv6':
|
167 |
| - print '[%s]:%i' % (ip['ip'], ip['port']) |
| 167 | + print('[%s]:%i' % (ip['ip'], ip['port'])) |
168 | 168 | else:
|
169 |
| - print '%s:%i' % (ip['ip'], ip['port']) |
| 169 | + print('%s:%i' % (ip['ip'], ip['port'])) |
170 | 170 |
|
171 | 171 | if __name__ == '__main__':
|
172 | 172 | main()
|
0 commit comments