mirror of
https://github.com/The-Art-of-Hacking/h4cker
synced 2024-11-24 11:53:02 +00:00
Create mx_record_extractor.py
This commit is contained in:
parent
27e4851237
commit
cfbd3ae18c
1 changed files with 16 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
||||||
|
import dns.resolver
|
||||||
|
|
||||||
|
def get_mx_record(domain):
|
||||||
|
try:
|
||||||
|
result = dns.resolver.resolve(domain, 'MX')
|
||||||
|
for rdata in result:
|
||||||
|
print(f'MX Record: {rdata.exchange.to_text()} with priority {rdata.preference}')
|
||||||
|
except dns.resolver.NoAnswer:
|
||||||
|
print(f"No MX records found for domain {domain}")
|
||||||
|
except dns.resolver.NXDOMAIN:
|
||||||
|
print(f"The domain {domain} does not exist")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
|
|
||||||
|
# Replace 'websploit.org' with the domain you are interested in
|
||||||
|
get_mx_record('websploit.org')
|
Loading…
Reference in a new issue