Skip to content

Commit

Permalink
Create validator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkingfeeling authored Apr 5, 2023
1 parent 0a2711b commit f290270
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import socket

# specify the domain
domain = "domain.com"

# specify the output file path
output_file = "output.txt"

# loop through 100 numbers and generate the output
with open(output_file, "w") as f:
for i in range(1, 101):
# format the number with leading zeros
num = "{:03d}".format(i)
# generate the subdomain
subdomain = f"us-{num}.{domain}"
# run nslookup on the subdomain
try:
socket.gethostbyname(subdomain)
# write the subdomain to the output file if it resolves to an IP address
f.write(subdomain + os.linesep)
except socket.error:
# do nothing if the subdomain does not resolve to an IP address
pass

0 comments on commit f290270

Please sign in to comment.