Merge branch '0.10' into 0.11

pull/2093/head
sebres 7 years ago
commit 730e760666

@ -38,7 +38,8 @@ Optional:
- [pyinotify >= 0.8.3](https://github.com/seb-m/pyinotify) - [pyinotify >= 0.8.3](https://github.com/seb-m/pyinotify)
- Linux >= 2.6.13 - Linux >= 2.6.13
- [gamin >= 0.0.21](http://www.gnome.org/~veillard/gamin) - [gamin >= 0.0.21](http://www.gnome.org/~veillard/gamin)
- [systemd >= 204](http://www.freedesktop.org/wiki/Software/systemd) - [systemd >= 204](http://www.freedesktop.org/wiki/Software/systemd) and python bindings:
- [python-systemd package](https://www.freedesktop.org/software/systemd/python-systemd/index.html)
- [dnspython](http://www.dnspython.org/) - [dnspython](http://www.dnspython.org/)
To install, just do: To install, just do:

@ -166,15 +166,21 @@ class BanManager:
answers = resolver.query(question, "TXT") answers = resolver.query(question, "TXT")
if not answers: if not answers:
raise ValueError("No data retrieved") raise ValueError("No data retrieved")
asns = set()
countries = set()
rirs = set()
for rdata in answers: for rdata in answers:
asn, net, country, rir, changed =\ asn, net, country, rir, changed =\
[answer.strip("'\" ") for answer in rdata.to_text().split("|")] [answer.strip("'\" ") for answer in rdata.to_text().split("|")]
asn = self.handleBlankResult(asn) asn = self.handleBlankResult(asn)
country = self.handleBlankResult(country) country = self.handleBlankResult(country)
rir = self.handleBlankResult(rir) rir = self.handleBlankResult(rir)
return_dict["asn"].append(self.handleBlankResult(asn)) asns.add(self.handleBlankResult(asn))
return_dict["country"].append(self.handleBlankResult(country)) countries.add(self.handleBlankResult(country))
return_dict["rir"].append(self.handleBlankResult(rir)) rirs.add(self.handleBlankResult(rir))
return_dict["asn"].append(', '.join(sorted(asns)))
return_dict["country"].append(', '.join(sorted(countries)))
return_dict["rir"].append(', '.join(sorted(rirs)))
except dns.resolver.NXDOMAIN: except dns.resolver.NXDOMAIN:
return_dict["asn"].append("nxdomain") return_dict["asn"].append("nxdomain")
return_dict["country"].append("nxdomain") return_dict["country"].append("nxdomain")

Loading…
Cancel
Save