Method: Rex::Text.rand_hostname

Defined in:
lib/rex/text.rb

.rand_hostnameString

Generate a random hostname

Returns:

  • (String)

    A random string conforming to the rules of FQDNs



1598
1599
1600
1601
1602
1603
1604
1605
# File 'lib/rex/text.rb', line 1598

def self.rand_hostname
  host = []
  (rand(5) + 1).times {
    host.push(Rex::Text.rand_text_alphanumeric(rand(10) + 1))
  }
  host.push(TLDs.sample)
  host.join('.').downcase
end