lib/wmap/dns_bruter.rb
# Return a list of hosts in the mutation form from the original, i.e. "ww1.example.com" => ["ww1,example.com","ww2.example.com",...]
Return a list of hosts in the mutation form from the original, i.e.
Return a list of hosts in the mutation form from the original i . e .
def hostname_mutation(host)
		puts "Start host mutation emulation on: #{host}" if @verbose
		begin
			hosts=Array.new
			host=host.strip.downcase
			raise "Invalid host format: #{host}" unless is_fqdn?(host)
			unless is_domain_root?(host)
				hostname=host.split('.')[0]
				hosts.push(host)
				case hostname
				when /\d+/
					hostname.scan(/\d+/).map do |x|
						y=x.to_i
						5.times do |i|
								z=y+i+1
								w=(y-i-1).abs
								mut1=host.sub_domain(x,z.to_s)
								mut2=host.sub_domain(x,w.to_s)
								hosts.push(mut1,mut2)
						end
					end
				else
					puts "No mutation found for: #{host}" if @verbose
				end
			end
			puts "Host mutation found: #{hosts.uniq}" if @verbose
			return hosts.uniq
		rescue Exception => ee
			puts "Exception on method #{__method__}: #{ee}" if @verbose
			return hosts	
		end
	end
def hostname_mutation ( host ) puts "Start host mutation emulation on: #{host}" if @verbose begin hosts = Array . new host = host . strip . downcase raise "Invalid host format: #{host}" unless is_fqdn? ( host ) unless is_domain_root? ( host ) hostname = host . split ( '.' ) [ 0 ] hosts . push ( host ) case hostname when / \d + / hostname . scan ( / \d + / ) . map do | x | y = x . to_i 5 . times do | i | z = y + i + 1 w = ( y - i - 1 ) . abs mut1 = host . sub_domain ( x , z . to_s ) mut2 = host . sub_domain ( x , w . to_s ) hosts . push ( mut1 , mut2 ) end end else puts "No mutation found for: #{host}" if @verbose end end puts "Host mutation found: #{hosts.uniq}" if @verbose return hosts . uniq rescue Exception => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return hosts end end
Return a list of hosts in the mutation form from the original, i.e.
Return a list of hosts in the mutation form from the original i . e .
#first form of mutation, i.e. "ww1" => ["ww1","ww2",...] # fail-safe
host
<not_specific>