Commit c7a9b35d authored by Tommy Lau's avatar Tommy Lau

Support mutli domain-name.txt

parent cbafb1e4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import socket
import xml.etree.ElementTree
import urllib2
......@@ -48,12 +50,14 @@ if __name__ == "__main__":
addr, mask = l.split('=')[1].strip().split('/')
route_table[get_decimal_ip(addr)] = (addr, mask)
with open("domains.txt", "r") as f:
for fn in glob.glob("domain-*.txt"):
print("Read from file [%s]" % fn)
with open(fn, "r") as f:
for line in f:
domain = line.strip()
if len(domain) != 0 and domain[0] != '#':
print("Processing domain [%s] " % domain),
print(" Processing domain [%s] " % domain),
ip = socket.gethostbyname(domain)
print("IP: %s" % ip),
decimal_ip = get_decimal_ip(ip)
......
......@@ -3,6 +3,7 @@ route = 4.0.0.0/255.0.0.0
route = 8.0.0.0/255.0.0.0
route = 23.0.0.0/255.0.0.0
route = 31.0.0.0/255.0.0.0
route = 38.0.0.0/255.0.0.0
route = 46.4.0.0/255.255.0.0
route = 54.0.0.0/255.0.0.0
route = 62.0.0.0/255.0.0.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment