mirror of
https://github.com/alpkeskin/mosint.git
synced 2026-06-12 21:01:56 +08:00
Update DNS method
DNS over HTTPS integrated, 3rd party website removed
This commit is contained in:
parent
39de63ab28
commit
8ecf74155f
@ -1,4 +1,3 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from prettytable import PrettyTable
|
||||
from insides.bcolors import bcolors
|
||||
@ -6,14 +5,26 @@ from insides.bcolors import bcolors
|
||||
def DNS(mail,_verbose=None):
|
||||
if _verbose != None:
|
||||
try:
|
||||
at = "@"
|
||||
domain = (mail[mail.index(at) + len(at):])
|
||||
dnsurl = ("https://api.hackertarget.com/dnslookup/?q="+domain)
|
||||
dnstable = PrettyTable([f"{bcolors.WARNING}DNS LOOKUP{bcolors.ENDC}"])
|
||||
response = requests.get(dnsurl)
|
||||
html = response.content
|
||||
soup=BeautifulSoup(html,"html.parser")
|
||||
dnstable.add_row([soup])
|
||||
print(f"{bcolors.WARNING} -- DNS Records [ Cloudflare ]{bcolors.ENDC}")
|
||||
domain = mail.split("@")[1]
|
||||
dnstable = PrettyTable([f"{bcolors.WARNING}Record Type{bcolors.ENDC}","Answer"])
|
||||
recordTypes = ["NS", "A", "AAAA", "TXT", "MX"]
|
||||
for recordType in recordTypes:
|
||||
params = (
|
||||
('name', domain),
|
||||
('type', recordType),
|
||||
('cd', 'false'),
|
||||
)
|
||||
|
||||
r = requests.get('https://cloudflare-dns.com/dns-query', headers={ 'accept': 'application/dns-json' }, params=params).json().get("Answer") or []
|
||||
|
||||
if recordType == "NS" and r == []:
|
||||
print(f"{bcolors.FAIL}NS can not found! [ DNS Lookup ]{bcolors.ENDC}")
|
||||
return
|
||||
|
||||
for record in r:
|
||||
value = record.get('data')
|
||||
dnstable.add_row([recordType, value])
|
||||
print(dnstable)
|
||||
except:
|
||||
print(f"{bcolors.FAIL}Service Error! [ DNS Lookup ]{bcolors.ENDC}")
|
||||
print(f"{bcolors.FAIL}Cloudflare DoH error!{bcolors.ENDC}")
|
||||
Loading…
Reference in New Issue
Block a user