Last active
August 20, 2016 23:10
-
-
Save aveao/994561b84f61dd17d377 to your computer and use it in GitHub Desktop.
Checks a small list of websites to see if they are banned in turkey. Swap comment on Line 7 with Line 6 to see the results on Google DNS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dns.resolver #sudo apt-get install python-dnspython | |
import re #regex | |
my_resolver = dns.resolver.Resolver() | |
#my_resolver.nameservers = ['8.8.8.8', '8.8.4.4'] | |
my_resolver.nameservers = ['195.175.39.39', '195.175.39.40'] | |
ToCheck = ['youtube.com', 'facebook.com', 'twitter.com', 't.co', 'instagram.com', 'reddit.com', 'imgur.com', 'i.imgur.com'] | |
for Website in ToCheck: | |
print((str(my_resolver.query(Website).rrset).split('\n', 1)[0])) #Gets website data, then the ip addresses it resolved to, then converts it to string, and prints the first line of it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results for me, first one is Google DNS, second is Turkish DNS (of TTnet):
arda@arda-Inspiron-3542 ~/Desktop $ python test.py
facebook.com. 39 IN A 66.220.158.68
twitter.com. 6 IN A 199.16.156.102
t.co. 15 IN A 199.16.156.11
instagram.com. 30 IN A 52.21.53.45
reddit.com. 24 IN A 198.41.208.138
imgur.com. 584 IN A 185.31.19.193
imgur.com. 153 IN A 185.31.19.193
arda@arda-Inspiron-3542 ~/Desktop $ python test.py
facebook.com. 77 IN A 66.220.158.68
twitter.com. 29 IN A 199.16.156.6
t.co. 30 IN A 199.16.156.75
instagram.com. 59 IN A 52.72.144.215
reddit.com. 221 IN A 198.41.208.139
imgur.com. 587 IN A 185.31.17.193
i.imgur.com. 3600 IN A 85.111.6.83
You can clearly see that i.imgur.com is banned.