forked from maycuatroi/check-text-link-injected
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdns-record-scan.py
28 lines (22 loc) · 838 Bytes
/
dns-record-scan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import dns.resolver
import sys
def scan_dns_records(domain):
record_types = ["A", "AAAA", "MX", "NS", "TXT", "CNAME", "SOA"]
print(f"DNS records for {domain}:\n")
for record_type in record_types:
try:
answers = dns.resolver.resolve(domain, record_type)
print(f"{record_type} records:")
for rdata in answers:
print(f" {rdata}")
except dns.resolver.NoAnswer:
print(f"No {record_type} records found")
except dns.resolver.NXDOMAIN:
print(f"The domain {domain} does not exist")
return
except dns.exception.DNSException as e:
print(f"An error occurred while querying {record_type} records: {e}")
print()
if __name__ == "__main__":
domain = "bepduc.vn"
scan_dns_records(domain)