lib/wmap/utils/utils.rb
# Test the DNS server if zone transfer is allowed. If allowed, save the found hosts into the class variable.
Test the DNS server if zone transfer is allowed. If allowed, save the found hosts into the class variable.
Test the DNS server if zone transfer is allowed . If allowed save the found hosts into the class variable .
def zone_transferable?(domain)
		puts "Check if the domain allows free zone transfer: #{domain}"
		begin
			transferable=false
			domain=domain.downcase
			nameservers = get_nameservers(domain)
			raise "Unable to determine the name servers for domain #{domain}" if nameservers.nil?
			puts "Retrieved name servers: #{nameservers}" if @verbose
			nameservers.each do |nssrv|
				begin
					puts "Attempt zone transfer on name server: #{nssrv}"
					if nssrv.nil?
						abort "Method input variable error: no name server found!" if @verbose
						next
					end
					zt = Dnsruby::ZoneTransfer.new
					zt.server=(nssrv) if nssrv!=""
					records = zt.transfer(domain)
					if records==nil
						puts "#{domain} zone transfer is not allowed on name server: #{nssrv}"
						next
					else
						puts "#{domain} zone transfer is allowed!"
						transferable=true
					end
				rescue Exception=>ee
					puts "Exception on method zone_transferable? for domain #{domain}: #{ee}"
				end
			end
			return transferable
		rescue Exception => ee
			puts "Exception on method #{__method__}: #{ee}" if @verbose
			return false
		end
	end
def zone_transferable? ( domain ) puts "Check if the domain allows free zone transfer: #{domain}" begin transferable = false domain = domain . downcase nameservers = get_nameservers ( domain ) raise "Unable to determine the name servers for domain #{domain}" if nameservers . nil? puts "Retrieved name servers: #{nameservers}" if @verbose nameservers . each do | nssrv | begin puts "Attempt zone transfer on name server: #{nssrv}" if nssrv . nil? abort "Method input variable error: no name server found!" if @verbose next end zt = Dnsruby :: ZoneTransfer . new zt . server = ( nssrv ) if nssrv != "" records = zt . transfer ( domain ) if records == nil puts "#{domain} zone transfer is not allowed on name server: #{nssrv}" next else puts "#{domain} zone transfer is allowed!" transferable = true end rescue Exception => ee puts "Exception on method zone_transferable? for domain #{domain}: #{ee}" end end return transferable rescue Exception => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return false end end
Test the DNS server if zone transfer is allowed.
Test the DNS server if zone transfer is allowed .
domain
<not_specific>