Created
December 21, 2016 20:10
-
-
Save Psycojoker/a71144e6ea991a88bd66b327a290da0f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 re | |
| hosts = open("/etc/hosts", "r").read() | |
| # remove comments | |
| hosts = re.sub("#.*[^\n]", "", hosts) | |
| # split everywords | |
| hosts = re.split("\s+", hosts) | |
| hosts = map(lambda x: x.lower(), hosts) | |
| if domain.lower() not in hosts: | |
| # do stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment