def parse_pages(self, response): ipToDns = IpToDns() for url in response.css('#alx-content > div > section.content-fixed.page-product-content > span > span > section > div.listings > ul > li > div.desc-container > p > a::text').extract(): domain = url.lower() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) yield {'domain': domain, 'IPs':ips}
def parse_pages(self, response): ipToDns = IpToDns() for url in response.css( '#alx-content > div > section.content-fixed.page-product-content > span > span > section > div.listings > ul > li > div.desc-container > p > a::text' ).extract(): domain = url.lower() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) yield {'domain': domain, 'IPs': ips}
#!/usr/local/bin/python2.7 from iptodns import IpToDns from time import sleep ipToDns = IpToDns() print ipToDns.get_hostname_by_IP('74.86.144.194') for ip in ipToDns.get_all_IPs(): print ip,'->',ipToDns.get_hostname_by_IP(ip) sleep(0.1)
#!/usr/local/bin/python2.7 from iptodns import IpToDns from time import sleep ipToDns = IpToDns() print ipToDns.get_hostname_by_IP('74.86.144.194') for ip in ipToDns.get_all_IPs(): print ip, '->', ipToDns.get_hostname_by_IP(ip) sleep(0.1)
#!/usr/local/bin/python2.7 from iptodns import IpToDns import sys if len(sys.argv) == 2: domain = sys.argv[1] ipToDns = IpToDns() dns_id = ipToDns.add_DNS(domain) ips = ipToDns.get_IPs(domain) for ip in ips: ipToDns.add_IP_to_DNS(ip, dns_id) print "OK! Add with success!" else: print "Error"