Skip to content

Instantly share code, notes, and snippets.

@planglois925
Created September 11, 2017 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save planglois925/bcd5e93553b434a88a87ebb80650e9e2 to your computer and use it in GitHub Desktop.
Save planglois925/bcd5e93553b434a88a87ebb80650e9e2 to your computer and use it in GitHub Desktop.
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