WIP - Metasploit & Ruby
Exploiting vulnerable applications with Ruby, as well as creating and editing Metasploit modules.
Last updated
Exploiting vulnerable applications with Ruby, as well as creating and editing Metasploit modules.
Last updated
Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Elegant syntax, natural to read and easy to write.
Use Ruby as a multi-paradigm language that supports a functional style of programming.
You can use high order programming methodology and lambda calculus.
Comes preinstalled with Kali.
Use for Windows.
Classic default prompt prints more information than the simple one:
So use in your scripts #!/usr/bin/ruby
as a shebang.
For Windows machines, the easiest way to perform the same task is to associate the Ruby files using the Ruby installer.
We'll cover two interesting examples which will be useful to explain the full potential of Ruby
irb: interactive ruby console.
Ruby One Liners: small programs that are defined with a single line of code, they are executed using the command line Ruby, they are often used for file/directory manipulation or simple file system scripting.
Some examples are:
File spacing
Numbering and calculations
Text Conversion or Substitution
cat
unix command in Ruby oneliner-e
: executes one line of ruby command.
-p
: iterates into a loop that reads each line and prints them to stdout.
-pe 0 'file'
: read 'file' line to line and prints then to stdout, executing 0 command.
wc
unix command in Ruby onliner-e
: executes one line of Ruby code between single quotes.
-n
: puts the code into a loop.
print
: prints the following string to stdout without adding a new line at the end.
END
: executes the next block of instructions.
$.
: global variable that holds the last line number read by ruby interpreter.
.
: used to concatenate strings.
-i
: specifies in-place edit mode, making a backup of the original file.
gsub
: global substitution.
There are different sources of libraries, but the most uses is the packaging system , which comes preinstalled with Ruby since version 1.9.
The library provides an interactive environment with many interesting features such as syntax highlighting.