Skip to content

Instantly share code, notes, and snippets.

@NKUCodingCat
Created November 25, 2016 22:26
Show Gist options
  • Save NKUCodingCat/9021caca8e4e9c76dadcf597f839bc89 to your computer and use it in GitHub Desktop.
Save NKUCodingCat/9021caca8e4e9c76dadcf597f839bc89 to your computer and use it in GitHub Desktop.
# This script may use ~8 MiB Memory, it is fast and safe
def find_IP(dns_ser, domain, timeout = 2):
import dns.resolver, sys
try:
T = dns.resolver.Resolver(); T.nameservers = [dns_ser, ]; T.timeout = T.lifetime = timeout
answers = T.query(domain, raise_on_no_answer=False)
return [rdata for rdata in answers]
except Exception as e:
if e.__class__.__base__ == dns.exception.DNSException:
return []
else :
raise
def _(ser):
return find_IP(ser, "ipswitchnetease.ddwscache.ourdvs.com", 3)
if __name__ == "__main__":
Ser = ["117.28.224.73", "119.92.145.152", "120.192.181.166", "120.196.165.7", "120.209.198.167", "120.80.88.88", "121.194.2.2", "121.28.199.126", "122.255.96.132", "123.150.150.150", "123.151.133.161", "123.151.133.162", "124.67.70.162", "139.175.1.1", "142.46.128.130", "146.185.134.104", "156.154.70.1", "156.154.71.1", "158.43.240.3", "159.226.8.6", "159.90.200.7", "163.121.2.2", "164.124.101.2", "165.21.83.88", "165.87.13.129", "168.210.2.2", "168.95.1.1", "168.95.192.1", "175.101.80.33", "180.131.144.144", "180.211.129.40", "189.38.95.95", "192.76.144.66", "193.95.93.77", "194.29.200.11", "195.129.12.122", "196.201.244.6", "196.220.59.188", "198.6.100.25", "199.2.252.10", "200.113.185.227", "200.57.2.108", "202.100.128.68", "202.100.138.68", "202.101.226.68", "202.102.134.68", "202.102.152.3", "202.103.225.68", "202.106.101.202", "202.106.196.115", "202.106.46.151", "202.121.127.200", "202.138.103.100", "202.175.1.198", "202.192.18.1", "202.192.18.2", "202.195.208.44", "202.196.64.130", "202.199.96.1", "202.200.144.40", "202.206.1.24", "202.45.84.58", "202.45.84.59", "202.46.113.21", "202.96.128.68", "202.96.197.1", "202.96.199.133", "202.96.64.68", "202.96.69.38", "202.98.0.68", "203.119.8.106", "203.12.160.35", "203.133.1.6", "203.198.7.66", "203.80.96.10", "203.81.192.16", "204.117.214.10", "206.165.6.11", "210.213.203.4", "210.22.66.253", "210.23.129.34", "210.27.176.200", "210.34.48.34", "210.36.80.26", "210.37.79.1", "210.40.128.35", "210.41.4.2", "210.77.16.1", "211.103.55.51", "211.137.191.26", "211.137.96.205", "211.138.126.93", "211.138.75.123", "211.138.75.124", "211.138.91.1", "211.139.5.29", "211.139.73.34", "211.140.14.36", "211.141.16.99", "211.142.44.108", "211.161.46.84", "211.162.62.1", "211.167.242.34", "211.71.128.6", "211.78.130.10", "211.82.40.4", "211.86.241.217", "211.97.96.65", "211.98.2.4", "211.98.4.1", "211.98.71.146", "212.118.241.1", "212.118.241.33", "212.252.114.8", "213.184.242.6", "216.52.94.33", "218.102.23.228", "218.104.111.114", "218.104.128.106", "218.195.24.1", "218.202.186.30", "218.205.192.6", "218.28.45.100", "218.30.26.68", "218.30.26.70", "218.85.152.99", "219.150.32.132", "219.155.49.154", "219.239.26.42", "221.13.65.34", "221.13.65.35", "221.130.33.60", "221.179.38.7", "221.207.38.222", "221.207.5.193", "221.210.50.234", "221.3.131.11", "221.3.131.12", "221.6.4.66", "221.7.43.71", "222.172.200.68", "222.18.224.10", "222.223.195.21", "222.37.4.2", "222.39.47.51", "222.39.47.53", "222.46.120.5", "222.47.29.93", "222.47.62.142", "222.88.49.150", "4.2.2.1", "4.2.2.2", "58.242.2.2", "60.12.93.221", "61.128.130.233", "61.134.11.227", "61.139.2.69", "61.166.150.123", "61.182.249.58", "61.183.132.1", "61.211.161.1", "61.211.161.33", "61.234.95.2", "61.235.249.226", "61.235.43.58", "61.31.1.1", "61.8.0.113", "62.140.218.148", "62.20.15.234", "62.40.32.33", "62.8.96.38", "64.212.106.84", "64.215.98.148", "64.215.98.149", "66.151.145.1", "74.82.42.42", "79.141.81.250", "82.216.111.122", "83.111.202.157", "85.29.26.8"]
from multiprocessing.dummy import Pool
import operator
p = Pool(20)
J = set(reduce(operator.add, p.map(_, Ser)))
for j in J:
print j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment