aboutsummaryrefslogtreecommitdiffstats
path: root/dtube
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-03-10 00:32:59 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2013-03-10 00:32:59 +0100
commit68c15713cfc7740a5b047440c57ba4fb3891a403 (patch)
tree0ce4966a7b6bc14d5b1572ea05b7632dfc071256 /dtube
parentdtube: handle IPrange DNS with empty PTR (diff)
downloadlaurent-tools-68c15713cfc7740a5b047440c57ba4fb3891a403.tar.xz
laurent-tools-68c15713cfc7740a5b047440c57ba4fb3891a403.zip
dtube: handle IP DNS with empty PTR
Diffstat (limited to 'dtube')
-rwxr-xr-xdtube/dtube.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/dtube/dtube.py b/dtube/dtube.py
index 1cab0db..61ca79d 100755
--- a/dtube/dtube.py
+++ b/dtube/dtube.py
@@ -217,8 +217,8 @@ class HeIP(He):
# DNS
dns_it = self.tree.xpath('//div[@id="dns"]')[0]
self.dns = dict()
- self.dns["PTR"] = dns_it.xpath('a[position()=1]/child::text()')[0]
- self.dns["PTR_href"] = dns_it.xpath('a[position()=1]')[0].get('href')
+ self.dns["PTR"] = dns_it.xpath('a[position()=1]/child::text()')[0] if len(dns_it.xpath('a[position()=1]/child::text()')) > 0 else ""
+ self.dns["PTR_href"] = dns_it.xpath('a[position()=1]')[0].get('href') if len(dns_it.xpath('a[position()=1]')) > 0 else ""
self.dns["A_list"] = dns_it.xpath('a[position()>1]/child::text()')
self.dns["A_href_list"] = [a.get('href') for a in dns_it.xpath('a[position()>1]')]
self.dns_txt = "%s\n" % self.dns["PTR"]