Created
September 11, 2017 16:11
-
-
Save planglois925/bcd5e93553b434a88a87ebb80650e9e2 to your computer and use it in GitHub Desktop.
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
def load_domains(): | |
# start an empty array | |
domains = [] | |
# A little status information for us | |
print "[] Loading domains" | |
# We want our code to platform neutral, so use os.path.join | |
# to get to our data directory and extract out domains | |
file_location = os.path.join('data','domains.txt') | |
# First check to see if the file is actually there | |
if os.path.isfile(file_location): | |
# Open the file and ready each line | |
with open(file_location) as f: | |
for domain in f.readlines(): | |
# lets strip out newline characters + lower them | |
dom =domain.strip('\n').strip('\r').lower() | |
domains.append(str(dom)) | |
# At the end lets provide a status that | |
# tells us how many domains we got | |
print "[x] %s Domains Loaded" % len(domains) | |
else: | |
print '][ Failed to load domains, File not found' | |
# return to new array of domains | |
return domains |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment