Skip to content

Instantly share code, notes, and snippets.

@ptitoliv
Created April 3, 2018 21:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptitoliv/09f327aaf51a5c89193120330a29a36f to your computer and use it in GitHub Desktop.
Save ptitoliv/09f327aaf51a5c89193120330a29a36f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import dns.resolver
main_domain = "mail-out.ovh.net."
cur_mailout=1
while True:
try:
mail_out_answer = dns.resolver.query('mo' + str(cur_mailout) + '.' + main_domain,'A')
except dns.resolver.NXDOMAIN:
break
for cur_answer in mail_out_answer:
# Let's do the same with "sub mailout" (x.moY.mail-out.ovh.net)
print(cur_answer)
cur_sub_mailout=1
while True:
try:
sub_mail_out_answer = dns.resolver.query(str(cur_sub_mailout) + '.mo' + str(cur_mailout) + '.' + main_domain,'A')
except dns.resolver.NXDOMAIN:
break
for cur_sub_answer in sub_mail_out_answer:
print(cur_sub_answer)
cur_sub_mailout = cur_sub_mailout + 1
cur_mailout = cur_mailout + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment