December 2017
Intermediate to advanced
860 pages
16h 1m
English
A method or function is a set of statements that will execute when we make a call to it. We can declare methods easily in Ruby's interactive shell, or we can declare them using the script as well. Methods are an important concept when working with Metasploit modules. Let's see the syntax:
def method_name [( [arg [= default]]...[, * arg [, &expr ]])]
expr
end
To define a method, we use def followed by the method name, with arguments and expressions in parentheses. We also use an end statement following all the expressions to set an end to the method definition. Here, arg refers to the arguments that a method receives. In addition, expr refers to the expressions that a method receives or calculates inline. Let's ...
Read now
Unlock full access