Skip to content

Commit

Permalink
Adding patch for when DNS server point to localhost (Issue mschwager#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibon committed Aug 22, 2022
1 parent 5b95227 commit 57075d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fierce/fierce.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import http.client
import ipaddress
import itertools
from logging import warning
import multiprocessing
import os
import pprint
import random
import socket
import sys
import time
import warnings

import dns.exception
import dns.name
Expand Down Expand Up @@ -321,6 +323,9 @@ def fierce(**kwargs):
master = query(resolver, soa_mname, record_type='A', tcp=kwargs["tcp"])
master_address = master[0].address
print("SOA: {} ({})".format(soa_mname, master_address))
if master_address == "127.0.0.1":
warning("Master address is localhost, switching to provided resolver (%s) instead" % resolver.nameservers[0])
master_address = resolver.nameservers[0]
else:
print("SOA: failure")
fatal("Failed to lookup NS/SOA, Domain does not exist")
Expand Down

0 comments on commit 57075d5

Please sign in to comment.