Skip to content

Commit

Permalink
Reduce query to arin
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLau committed Feb 11, 2015
1 parent 7f33357 commit 9eaa42e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 37 deletions.
45 changes: 45 additions & 0 deletions domains.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Google
www.google.com
74.125.200.138
173.194.127.255
www.google.com.hk
www.google.sg
www.google.co.jp
Expand All @@ -11,6 +14,8 @@ wallet.google.com
www.gstatic.com
ssl.gstatic.com
lh5.googleusercontent.com

# YouTube
youtube.com
www.youtube.com
m.youtube.com
Expand All @@ -22,8 +27,12 @@ tc.v10.cache1.googlevideo.com
tc.v10.cache8.googlevideo.com
manifest.googlevideo.com
yt3.ggpht.com

# Blogger
www.blogger.com
googleblog.blogspot.com

# Facebook
facebook.com
www.facebook.com
developers.facebook.com
Expand All @@ -35,6 +44,8 @@ fbcdn-profile-a.akamaihd.net
fbexternal-a.akamaihd.net
fbcdn-sphotos-d-a.akamaihd.net
bit.ly

# Twitter
www.twitter.com
m.twitter.com
mobile.twitter.com
Expand All @@ -46,3 +57,37 @@ pbs.twimg.com
ma.twimg.com
t.co

# Wordpress
lb.wordpress.com
vip-lb.wordpress.com
66.155.9.244
76.74.255.123
192.0.83.250

# Instagram
instagram.com
54.209.6.86
54.210.210.200
54.236.116.18
107.23.173.176
i.instagram.com
54.236.180.84
54.84.154.64
telegraph-ec2proxy.instagram.com
54.152.147.196
help.instagram.com
blog.instagram.com
photos-e.ak.instagram.com
instagramstatic-a.akamaihd.net
igcdn-photos-h-a.akamaihd.net
instagramimages-a.akamaihd.net

# TuneIn
api.tunein.com
feed.tunein.com
api.radiotime.com
opml.radiotime.com

# Amazon AWS
s3.amazonaws.com

5 changes: 2 additions & 3 deletions route.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def query_cidr(ip):
for line in f:
domain = line.strip()

if len(domain) != 0:
if len(domain) != 0 and domain[0] != '#':
print("Processing domain [%s] " % domain),
ip = socket.gethostbyname(domain)
print("IP: %s" % ip),
decimal_ip = get_decimal_ip(ip)
exist = False
for t in route_table:
if (t & decimal_ip) == t:
if (get_decimal_ip(route_table[t][1]) & decimal_ip) == t:
exist = True
break
if exist:
Expand All @@ -62,7 +62,6 @@ def query_cidr(ip):
print("CIDR: %s/%s" % (addr, mask))

tables = sorted(route_table.items())
print tables

with open("route.txt", "w") as f:
for route in tables:
Expand Down
67 changes: 33 additions & 34 deletions route.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
route = 4.0.0.0/255.0.0.0
route = 8.0.0.0/255.0.0.0
route = 58.0.0.0/255.0.0.0
route = 23.0.0.0/255.0.0.0
route = 23.32.0.0/255.224.0.0
route = 23.64.0.0/255.252.0.0
route = 23.192.0.0/255.224.0.0
route = 31.0.0.0/255.0.0.0
route = 54.72.0.0/255.248.0.0
route = 54.80.0.0/255.240.0.0
route = 54.144.0.0/255.240.0.0
route = 54.160.0.0/255.240.0.0
route = 54.208.0.0/255.248.0.0
route = 54.216.0.0/255.252.0.0
route = 54.224.0.0/255.240.0.0
route = 54.236.0.0/255.254.0.0
route = 62.0.0.0/255.0.0.0
route = 64.212.0.0/255.252.0.0
route = 66.6.32.0/255.255.240.0
route = 66.155.0.0/255.255.128.0
route = 69.58.176.0/255.255.240.0
route = 74.125.0.0/255.255.0.0
route = 76.74.248.0/255.255.248.0
route = 80.0.0.0/255.0.0.0
route = 103.0.0.0/255.0.0.0
route = 107.20.0.0/255.252.0.0
route = 111.0.0.0/255.0.0.0
route = 117.0.0.0/255.0.0.0
route = 199.0.0.0/255.0.0.0
route = 190.0.0.0/255.0.0.0
route = 198.0.0.0/255.0.0.0
route = 173.0.0.0/255.0.0.0
route = 174.0.0.0/255.0.0.0
route = 168.0.0.0/255.0.0.0
route = 69.0.0.0/255.0.0.0
route = 128.0.0.0/255.0.0.0
route = 107.0.0.0/255.0.0.0
route = 109.0.0.0/255.0.0.0
route = 101.0.0.0/255.0.0.0
route = 141.0.0.0/255.0.0.0
route = 192.0.0.0/255.0.0.0
route = 72.0.0.0/255.0.0.0
route = 176.0.0.0/255.0.0.0
route = 78.0.0.0/255.0.0.0
route = 73.0.0.0/255.0.0.0
route = 74.0.0.0/255.0.0.0
route = 208.0.0.0/255.0.0.0
route = 205.0.0.0/255.0.0.0
route = 206.0.0.0/255.0.0.0
route = 173.194.0.0/255.255.0.0
route = 173.252.64.0/255.255.192.0
route = 184.154.0.0/255.255.0.0
route = 192.0.64.0/255.255.192.0
route = 199.16.156.0/255.255.252.0
route = 199.92.0.0/255.252.0.0
route = 199.96.56.0/255.255.248.0
route = 203.0.0.0/255.0.0.0
route = 204.69.221.0/255.255.255.0
route = 210.0.0.0/255.0.0.0
route = 220.0.0.0/255.0.0.0
route = 216.0.0.0/255.0.0.0
route = 54.0.0.0/255.0.0.0
route = 50.0.0.0/255.0.0.0
route = 59.0.0.0/255.0.0.0
route = 63.0.0.0/255.0.0.0
#route = 66.0.0.0/255.0.0.0
route = 92.0.0.0/255.0.0.0
route = 93.0.0.0/255.0.0.0
route = 97.0.0.0/255.0.0.0
route = 96.0.0.0/255.0.0.0
route = 125.0.0.0/255.0.0.0

0 comments on commit 9eaa42e

Please sign in to comment.