Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
