-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a2711b
commit f290270
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
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
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 |