Answered step by step
Verified Expert Solution
Question
1 Approved Answer
why do with this code : ## ! / usr / bin / env python 3 import sys from scapy.all import * def get _
why do with this code : ##usrbinenv python
import sys
from scapy.all import
def getsoarecorddomain:
# Create a DNS query packet for SOA record
dnsrequest IPdst UDPdport DNSrd qdDNSQRqnamedomain, qtype'SOA'
dnsresponse srdnsrequest, verbose timeout
if dnsresponse and dnsresponse.haslayerDNSRR:
for answer in dnsresponseDNSan:
if answer.type : # SOA type
return answer.mname.decode # Primary DNS server
return None
domain jctacil
primarydnsserver getsoarecorddomain
printfPrimary DNS Server for domain: primarydnsserver
def querydnsserverdnsserver, domain:
# Create a DNS query packet for A records
dnsrequest IPdstdnsserver UDPdport DNSrd qdDNSQRqnamedomain, qtypeA
dnsresponse srdnsrequest, verbose timeout
ipaddresses
if dnsresponse and dnsresponse.haslayerDNSRR:
for answer in dnsresponseDNSan:
if answer.type : # A type
ipaddresses.appendanswerrdata
return ipaddresses
ipaddresses querydnsserverprimarydnsserver, domain
printfIP Addresses for domain: ipaddresses
if namemain:
if lensysargv:
printUsage: dnsenum.py
sysexit
domain sysargv
primarydnsserver getsoarecorddomain
if not primarydnsserver:
printfCould not find the primary DNS server for domain
sysexit
printfPrimary DNS Server for domain: primarydnsserver
ipaddresses querydnsserverprimarydnsserver, domain
if not ipaddresses:
printfNo IP addresses found for domain
else:
printfIP Addresses for domain:
for ip in ipaddresses:
printipi get those error WARNING: No IPv address found on anpi
WARNING: No IPv address found on anpi
WARNING: more No IPv address found on en
Primary DNS Server for jctacil: None
IP Addresses for jctacil:
Usage: dnsenum.py
Could not find the primary DNS server for jctacil
Process finished with exit code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started