Writing Ronin Ruby Scripts - Text

Table of Contents

Random

ronin-support provides a Ronin::Support::Text::Random::Mixin module which adds random_ methods for generating random text from different character sets:

require 'ronin/support/text/random'
include Ronin::Support::Text::Random::Mixin

random_alpha
# => "J"

random_alpha(10)
# => "kTNATXBYvW"

random_alpha_numeric(10)
# => "l5BOZws4KP"

See the documentation for Ronin::Support::Text::Random::Mixin for a complete list of available methods.

ERB

ronin-support provides a Ronin::Support::Text::ERB::Mixin module which adds a erb method which renders ERB template files. ERB is a dynamic template file language for Ruby, which allows embedding and rendering Ruby code within text.

template.erb file:

<html>
  <script type="text/javascript">
    var payload = <%= @payload.js_string -%>;
    // ...
  </script>
</html>
@payload = "PAYLOAD HERE"

html = erb('template.erb')

Typos

ronin-support adds methods to Ruby’s built-in String class for generating or enumerating over typos of a String.

require 'ronin/support/text/typo'

"microsoft".typo
# => "microssoft"

"consciousness".each_typo do |typo|
  # ...
end

"consciousness".typos
# => 
# ["consciusness",
#  "consciosness",
#  "conscuosness",
#  "consciosness",
#  "coonsciousness",
#  "conscioousness",
#  "conssciousness",
#  "conscioussness",
#  "consciousnesss",
#  "consciuosness",
#  "consciousnes"]

Homoglyphs

ronin-support adds methods to Ruby’s built-in String class for generating or enumerating over typos of a String.

require 'ronin/support/text/homoglyph'

"microsoft".homoglyph
# => "microsoft"

"microsoft".each_homoglyph do |homoglyph|
  # ...
end

"microsoft".homoglyphs
# => 
# ["ⅿicrosoft",
#  "microsoft",
#  "mіcrosoft",
#  "mⅰcrosoft",
#  "microsoft",
#  "miϲrosoft",
#  "miсrosoft",
#  "miⅽrosoft",
#  "microsoft",
#  "microsoft",
#  "micrοsoft",
#  "microsοft",
#  "micrоsoft",
#  "microsоft",
#  "microsoft",
#  "microsoft",
#  "microѕoft",
#  "microsoft",
#  "microsoft",
#  "microsoft"]